From 6ea5b515d025a14f706921fdaa5143c041ad7b4c Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Tue, 30 Sep 2008 05:39:52 +0000 Subject: [PATCH] * Get the code up to speed with my -#dev e-mail example. (uncomment out lines 227 - 235 to test. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 21 +++++++++++++++---- OpenSim/Framework/Servers/OSHttpResponse.cs | 17 +++++++++++++++ .../Modules/Framework/EventQueueGetModule.cs | 12 ++++++++++- 3 files changed, 45 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index e44a301804..707f621d1e 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -323,7 +323,8 @@ namespace OpenSim.Framework.Servers OSHttpRequest request = new OSHttpRequest(context.Request); OSHttpResponse response = new OSHttpResponse(context.Response); - + context.Response.ProtocolVersion = new Version("1.0"); + context.Response.KeepAlive = false; // This is the REST agent interface. We require an agent to properly identify // itself. If the REST handler recognizes the prefix it will attempt to // satisfy the request. If it is not recognizable, and no damage has occurred @@ -991,11 +992,17 @@ namespace OpenSim.Framework.Servers int responsecode = (int)responsedata["int_response_code"]; string responseString = (string)responsedata["str_response_string"]; string contentType = (string)responsedata["content_type"]; + if (responsedata.ContainsKey("error_status_text")) + { + response.StatusDescription = (string)responsedata["error_status_text"]; + } - if (responsedata.ContainsKey("keepalive")) - response.KeepAlive = true; + { + bool keepalive = (bool)responsedata["keepalive"]; + response.KeepAlive = keepalive; + } //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //and should check for NullReferenceExceptions @@ -1014,7 +1021,7 @@ namespace OpenSim.Framework.Servers response.StatusCode = responsecode; } - response.AddHeader("Content-type", contentType); + response.AddHeader("Content-Type", contentType); byte[] buffer; @@ -1121,12 +1128,18 @@ namespace OpenSim.Framework.Servers if (!m_ssl) { m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); + //m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/"); } else { m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); } + HttpListenerPrefixCollection prefixs = m_httpListener.Prefixes; + + foreach (string prefix in prefixs) + System.Console.WriteLine("Listening on: " + prefix); + m_httpListener.Start(); HttpListenerContext context; diff --git a/OpenSim/Framework/Servers/OSHttpResponse.cs b/OpenSim/Framework/Servers/OSHttpResponse.cs index 6fff02670b..f881a221a1 100644 --- a/OpenSim/Framework/Servers/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/OSHttpResponse.cs @@ -200,6 +200,23 @@ namespace OpenSim.Framework.Servers } } + public Version ProtocolVersion + { + get + { + if (!HttpServer) + return _httpListenerResponse.ProtocolVersion; + + return new Version("1.0"); + } + set + { + if (!HttpServer) + _httpListenerResponse.ProtocolVersion = value; + + } + } + /// /// Return the output stream feeding the body. /// diff --git a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs index 2eb0ecd6cf..4f4c6ead7d 100644 --- a/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs +++ b/OpenSim/Region/Environment/Modules/Framework/EventQueueGetModule.cs @@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Modules.Framework if (m_ids.ContainsKey(avatar.UUID)) { // close the event queue. - m_ids[avatar.UUID] = -1; + //m_ids[avatar.UUID] = -1; } } } @@ -224,6 +224,16 @@ namespace OpenSim.Region.Environment.Modules.Framework lock (m_ids) thisID = m_ids[agentID]; + //if (element == null) + //{ + // responsedata["int_response_code"] = 502; + // responsedata["content_type"] = "text/plain"; + // responsedata["keepalive"] = false; + // responsedata["str_response_string"] = "Upstream error: "; + // responsedata["error_status_text"] = "Upstream error:"; + // return responsedata; + //} + if (thisID == -1) // close-request { responsedata["int_response_code"] = 502;