From 74dd619575c2e260ba680312a87249e284f3d2c9 Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 17 May 2011 19:12:37 -0700 Subject: [PATCH] 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 --- .../Servers/HttpServer/BaseHttpServer.cs | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 598e5d17cd..36c6c75075 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs @@ -1510,11 +1510,25 @@ namespace OpenSim.Framework.Servers.HttpServer internal void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) { - //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); - int responsecode = (int)responsedata["int_response_code"]; - string responseString = (string)responsedata["str_response_string"]; - string contentType = (string)responsedata["content_type"]; + int responsecode; + string responseString; + string contentType; + 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")) {