If a response cannot be obtained (the script has no handler) return a more friendly 500 error instead of crashing out with a null reference and letting the connection hang

avinationmerge
Tom 2011-05-17 19:12:37 -07:00
parent 1f17960e67
commit 74dd619575
1 changed files with 18 additions and 4 deletions

View File

@ -1510,11 +1510,25 @@ namespace OpenSim.Framework.Servers.HttpServer
internal void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) internal void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
{ {
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); int responsecode;
int responsecode = (int)responsedata["int_response_code"]; string responseString;
string responseString = (string)responsedata["str_response_string"]; string contentType;
string contentType = (string)responsedata["content_type"];
if (responsedata == null)
{
responsecode = 500;
responseString = "No response could be obtained";
contentType = "text/plain";
responsedata = new Hashtable();
}
else
{
//m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response");
responsecode = (int)responsedata["int_response_code"];
responseString = (string)responsedata["str_response_string"];
contentType = (string)responsedata["content_type"];
}
if (responsedata.ContainsKey("error_status_text")) if (responsedata.ContainsKey("error_status_text"))
{ {