From e441c9cac127a834a1256e05ae754c0882f0398d Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Wed, 23 Sep 2015 23:59:50 +0100 Subject: [PATCH] dont let http keepalive and context reuse be true --- .../Framework/Servers/HttpServer/BaseHttpServer.cs | 13 ++++++++++--- .../Framework/Servers/HttpServer/OSHttpResponse.cs | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 85976abfa9..cd14212d21 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1270,7 +1270,8 @@ namespace OpenSim.Framework.Servers.HttpServer requestStream.Close(); //m_log.DebugFormat("[OGP]: {0}:{1}", request.RawUrl, requestBody); - response.KeepAlive = true; + // response.KeepAlive = true; + response.KeepAlive = false; OSD llsdRequest = null; OSD llsdResponse = null; @@ -1791,16 +1792,19 @@ namespace OpenSim.Framework.Servers.HttpServer { response.ProtocolVersion = (string)responsedata["http_protocol_version"]; } - +/* if (responsedata.ContainsKey("keepalive")) { bool keepalive = (bool)responsedata["keepalive"]; response.KeepAlive = keepalive; - } if (responsedata.ContainsKey("reusecontext")) response.ReuseContext = (bool) responsedata["reusecontext"]; +*/ + // disable this things + response.KeepAlive = false; + response.ReuseContext = false; // Cross-Origin Resource Sharing with simple requests if (responsedata.ContainsKey("access_control_allow_origin")) @@ -1814,8 +1818,11 @@ namespace OpenSim.Framework.Servers.HttpServer contentType = "text/html"; } + + // The client ignores anything but 200 here for web login, so ensure that this is 200 for that + response.StatusCode = responsecode; if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs index 89fb5d4562..17e9dc20ee 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpResponse.cs @@ -148,6 +148,7 @@ namespace OpenSim.Framework.Servers.HttpServer _httpResponse.Connection = ConnectionType.Close; _httpResponse.KeepAlive = 0; } + else { _httpResponse.Connection = ConnectionType.KeepAlive; @@ -320,6 +321,11 @@ namespace OpenSim.Framework.Servers.HttpServer public void Send() { _httpResponse.Body.Flush(); + + // disable this till they are safe to use + _httpResponse.Connection = ConnectionType.Close; + _httpResponse.Chunked = false; + _httpResponse.Send(); }