From d19400db4479015fe334d81801025e13deec26a8 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 10 Oct 2008 12:59:16 +0000 Subject: [PATCH] * Just some OGP maintenance. Standards adherence type stuff. --- OpenSim/Framework/Servers/BaseHttpServer.cs | 35 ++++++++++++++++++- .../InterGrid/OpenGridProtocolModule.cs | 19 ++++++---- 2 files changed, 46 insertions(+), 8 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 558b3833db..644deb34c4 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -587,7 +587,40 @@ namespace OpenSim.Framework.Servers } else { + //HandleLLSDRequests(request, response); + response.ContentType = "text/plain"; + response.StatusCode = 404; + response.StatusDescription = "Not Found"; + response.ProtocolVersion = "HTTP/1.0"; + byte[] buf = Encoding.UTF8.GetBytes("Not found"); + response.KeepAlive = false; + m_log.ErrorFormat("[BASE HTTP SERVER] Handler not found for http request {0}", request.RawUrl); + + response.SendChunked = false; + response.ContentLength64 = buf.Length; + response.ContentEncoding = Encoding.UTF8; + try + { + response.OutputStream.Write(buf, 0, buf.Length); + } + catch (Exception ex) + { + m_log.Warn("[HTTPD]: Error - " + ex.Message); + } + finally + { + try + { + response.Send(); + } + catch (SocketException e) + { + // This has to be here to prevent a Linux/Mono crash + m_log.WarnFormat("[BASE HTTP SERVER] XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux.", e); + } + } + return; responseString = "Error"; } } @@ -1207,7 +1240,7 @@ namespace OpenSim.Framework.Servers public void SendHTML404(OSHttpResponse response, string host) { // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s - response.StatusCode = (int)OSHttpStatusCode.SuccessOk; + response.StatusCode = 404; response.AddHeader("Content-type", "text/html"); string responseString = GetHTTP404(host); diff --git a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs index cb525cc352..85e60d7aa2 100644 --- a/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/Environment/Modules/InterGrid/OpenGridProtocolModule.cs @@ -858,11 +858,12 @@ namespace OpenSim.Region.Environment.Modules.InterGrid int rrY = rezResponseMap["region_y"].AsInteger(); m_log.ErrorFormat("X:{0}, Y:{1}", rrX, rrY); UUID rrRID = rezResponseMap["region_id"].AsUUID(); - + LLSDArray RezResponsePositionArray = null; string rrAccess = rezResponseMap["sim_access"].AsString(); - - LLSDArray RezResponsePositionArray = (LLSDArray)rezResponseMap["position"]; - + if (rezResponseMap.ContainsKey("position")) + { + RezResponsePositionArray = (LLSDArray)rezResponseMap["position"]; + } // DEPRECIATED responseMap["seed_capability"] = LLSD.FromString(rezRespSeedCap); @@ -878,13 +879,17 @@ namespace OpenSim.Region.Environment.Modules.InterGrid responseMap["region_y"] = LLSD.FromInteger(rrY ); responseMap["region_id"] = LLSD.FromUUID(rrRID); responseMap["sim_access"] = LLSD.FromString(rrAccess); - responseMap["position"] = RezResponsePositionArray; + + if (RezResponsePositionArray != null) + { + responseMap["position"] = RezResponsePositionArray; + } responseMap["look_at"] = lookArray; responseMap["connect"] = LLSD.FromBoolean(true); ShutdownConnection(LocalID,this); - - m_log.Warn("RESPONSEDEREZ: " + responseMap.ToString()); + // PLEASE STOP CHANGING THIS TO an M_LOG, M_LOG DOESN'T WORK ON MULTILINE .TOSTRINGS + System.Console.WriteLine("RESPONSEDEREZ: " + responseMap.ToString()); return responseMap; } else