* Fixed another potential httpserver leak.
parent
22a533b675
commit
23a8895d29
|
@ -1321,6 +1321,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
string responseString = (string)responsedata["str_response_string"];
|
string responseString = (string)responsedata["str_response_string"];
|
||||||
string contentType = (string)responsedata["content_type"];
|
string contentType = (string)responsedata["content_type"];
|
||||||
|
|
||||||
|
|
||||||
if (responsedata.ContainsKey("error_status_text"))
|
if (responsedata.ContainsKey("error_status_text"))
|
||||||
{
|
{
|
||||||
response.StatusDescription = (string)responsedata["error_status_text"];
|
response.StatusDescription = (string)responsedata["error_status_text"];
|
||||||
|
@ -1336,6 +1337,10 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
response.KeepAlive = keepalive;
|
response.KeepAlive = keepalive;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (responsedata.ContainsKey("reusecontext"))
|
||||||
|
response.ReuseContext = (bool) responsedata["reusecontext"];
|
||||||
|
|
||||||
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
|
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
|
||||||
//and should check for NullReferenceExceptions
|
//and should check for NullReferenceExceptions
|
||||||
|
|
||||||
|
@ -1391,7 +1396,7 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
response.OutputStream.Flush();
|
response.OutputStream.Flush();
|
||||||
response.Send();
|
response.Send();
|
||||||
|
|
||||||
if (!response.KeepAlive)
|
if (!response.KeepAlive && response.ReuseContext)
|
||||||
response.FreeContext();
|
response.FreeContext();
|
||||||
}
|
}
|
||||||
catch (SocketException e)
|
catch (SocketException e)
|
||||||
|
|
|
@ -256,6 +256,25 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ReuseContext
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_httpClientContext != null)
|
||||||
|
{
|
||||||
|
return !_httpClientContext.EndWhenDone;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (_httpClientContext != null)
|
||||||
|
{
|
||||||
|
_httpClientContext.EndWhenDone = !value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
protected IHttpResponse _httpResponse;
|
protected IHttpResponse _httpResponse;
|
||||||
private IHttpClientContext _httpClientContext;
|
private IHttpClientContext _httpClientContext;
|
||||||
|
|
|
@ -68,6 +68,7 @@ namespace OpenSim.Framework.Servers.Tests
|
||||||
public void Send(byte[] buffer, int offset, int size) {}
|
public void Send(byte[] buffer, int offset, int size) {}
|
||||||
public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {}
|
public void Respond(string httpVersion, HttpStatusCode statusCode, string reason, string body, string contentType) {}
|
||||||
public void Close() { }
|
public void Close() { }
|
||||||
|
public bool EndWhenDone { get { return false;} set { return;}}
|
||||||
|
|
||||||
public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
|
public event EventHandler<DisconnectedEventArgs> Disconnected = delegate { };
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -375,7 +375,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
responsedata["int_response_code"] = 200;
|
responsedata["int_response_code"] = 200;
|
||||||
responsedata["content_type"] = "application/xml";
|
responsedata["content_type"] = "application/xml";
|
||||||
responsedata["keepalive"] = true;
|
responsedata["keepalive"] = false;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
|
responsedata["str_response_string"] = OSDParser.SerializeLLSDXmlString(events);
|
||||||
return responsedata;
|
return responsedata;
|
||||||
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
|
//m_log.DebugFormat("[EVENTQUEUE]: sending response for {0} in region {1}: {2}", agentID, m_scene.RegionInfo.RegionName, responsedata["str_response_string"]);
|
||||||
|
@ -386,7 +387,8 @@ namespace OpenSim.Region.CoreModules.Framework.EventQueue
|
||||||
Hashtable responsedata = new Hashtable();
|
Hashtable responsedata = new Hashtable();
|
||||||
responsedata["int_response_code"] = 502;
|
responsedata["int_response_code"] = 502;
|
||||||
responsedata["content_type"] = "text/plain";
|
responsedata["content_type"] = "text/plain";
|
||||||
responsedata["keepalive"] = true;
|
responsedata["keepalive"] = false;
|
||||||
|
responsedata["reusecontext"] = false;
|
||||||
responsedata["str_response_string"] = "Upstream error: ";
|
responsedata["str_response_string"] = "Upstream error: ";
|
||||||
responsedata["error_status_text"] = "Upstream error:";
|
responsedata["error_status_text"] = "Upstream error:";
|
||||||
responsedata["http_protocol_version"] = "HTTP/1.0";
|
responsedata["http_protocol_version"] = "HTTP/1.0";
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue