protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { // m_log.DebugFormat("[SIMULATION]: Stream handler called"); httpResponse.ContentType = "text/html"; //?? httpResponse.KeepAlive = false; if (httpRequest.HttpMethod != "POST") { httpResponse.StatusCode = (int)HttpStatusCode.MethodNotAllowed; httpResponse.RawBuffer = Utils.falseStrBytes; } if (httpRequest.ContentType != "application/json" && httpRequest.ContentType != "application/x-gzip") { httpResponse.StatusCode = (int)HttpStatusCode.NotAcceptable; httpResponse.RawBuffer = Utils.falseStrBytes; } UUID agentID; UUID regionID; string action; if (!Utils.GetParams(httpRequest.UriPath, out agentID, out regionID, out action)) { m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", httpRequest.RawUrl); httpResponse.StatusCode = (int)HttpStatusCode.NotFound; httpResponse.RawBuffer = Utils.falseStrBytes; } OSDMap args = Utils.DeserializeJSONOSMap(httpRequest); if (args == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; } DoAgentPost(args, httpRequest.RemoteIPEndPoint.Address.ToString(), httpResponse, agentID); httpResponse.StatusCode = 200; }
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { httpResponse.KeepAlive = false; if (m_SimulationService == null) { httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; httpResponse.RawBuffer = Utils.falseStrBytes; return; } /*this things are ignored * if (!Utils.GetParams(httpRequest.UriPath, out UUID objectID, out UUID regionID, out string action)) * { * m_log.InfoFormat("[OBJECT HANDLER]: Invalid parameters for object message {0}", httpRequest.UriPath); * httpResponse.StatusCode = (int)HttpStatusCode.NotFound; * return; * } */ switch (httpRequest.HttpMethod) { case "POST": { OSDMap args = Utils.DeserializeJSONOSMap(httpRequest); if (args == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } DoObjectPost(args, httpResponse); break; } case "DELETE": default: { httpResponse.StatusCode = (int)HttpStatusCode.MethodNotAllowed; return; } } }
protected override void ProcessRequest(IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) { httpResponse.KeepAlive = false; httpResponse.ContentType = "application/json"; if (m_SimulationService == null) { m_log.Debug("[AGENT HANDLER]: ProcessRequest called with null Simulation Service"); httpResponse.StatusCode = (int)HttpStatusCode.InternalServerError; httpResponse.RawBuffer = Utils.falseStrBytes; return; } if (!Utils.GetParams(httpRequest.UriPath, out UUID agentID, out UUID regionID, out string action)) { m_log.InfoFormat("[AGENT HANDLER]: Invalid parameters for agent message {0}", httpRequest.UriPath); httpResponse.StatusCode = (int)HttpStatusCode.NotFound; httpResponse.RawBuffer = Utils.falseStrBytes; return; } switch (httpRequest.HttpMethod) { case "QUERYACCESS": { if (agentID == UUID.Zero || regionID == UUID.Zero) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } OSDMap args = Utils.DeserializeJSONOSMap(httpRequest); if (args == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } DoQueryAccess(args, httpResponse, agentID, regionID); break; } case "PUT": { OSDMap args = Utils.DeserializeJSONOSMap(httpRequest); if (args == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } DoAgentPut(args, httpResponse); break; } case "POST": { if (agentID == UUID.Zero) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } OSDMap args = Utils.DeserializeJSONOSMap(httpRequest); if (args == null) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } DoAgentPost(args, httpRequest, httpResponse, agentID); break; } case "DELETE": { if (agentID == UUID.Zero || regionID == UUID.Zero) { httpResponse.StatusCode = (int)HttpStatusCode.BadRequest; httpResponse.RawBuffer = Utils.falseStrBytes; return; } httpRequest.QueryAsDictionary.TryGetValue("auth", out string auth_token); DoAgentDelete(httpRequest, httpResponse, agentID, action, regionID, auth_token); break; } default: { httpResponse.StatusCode = (int)HttpStatusCode.MethodNotAllowed; httpResponse.RawBuffer = Utils.falseStrBytes; return; } } }