diff options
Diffstat (limited to 'OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index b018e57..2cd626f 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -542,11 +542,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
542 | { | 542 | { |
543 | case null: | 543 | case null: |
544 | case "text/html": | 544 | case "text/html": |
545 | |||
546 | if (DebugLevel >= 3) | 545 | if (DebugLevel >= 3) |
547 | m_log.DebugFormat( | 546 | LogIncomingToContentTypeHandler(request); |
548 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", | ||
549 | RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | ||
550 | 547 | ||
551 | buffer = HandleHTTPRequest(request, response); | 548 | buffer = HandleHTTPRequest(request, response); |
552 | break; | 549 | break; |
@@ -554,11 +551,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
554 | case "application/llsd+xml": | 551 | case "application/llsd+xml": |
555 | case "application/xml+llsd": | 552 | case "application/xml+llsd": |
556 | case "application/llsd+json": | 553 | case "application/llsd+json": |
557 | |||
558 | if (DebugLevel >= 3) | 554 | if (DebugLevel >= 3) |
559 | m_log.DebugFormat( | 555 | LogIncomingToContentTypeHandler(request); |
560 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", | ||
561 | RequestNumber, Port, request.ContentType, request.HttpMethod, request.Url.PathAndQuery, request.RemoteIPEndPoint); | ||
562 | 556 | ||
563 | buffer = HandleLLSDRequests(request, response); | 557 | buffer = HandleLLSDRequests(request, response); |
564 | break; | 558 | break; |
@@ -693,7 +687,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
693 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", | 687 | "[BASE HTTP SERVER]: HTTP IN {0} :{1} {2} content type handler {3} {4} from {5}", |
694 | RequestNumber, | 688 | RequestNumber, |
695 | Port, | 689 | Port, |
696 | request.ContentType, | 690 | (request.ContentType == null || request.ContentType == "") ? "not set" : request.ContentType, |
697 | request.HttpMethod, | 691 | request.HttpMethod, |
698 | request.Url.PathAndQuery, | 692 | request.Url.PathAndQuery, |
699 | request.RemoteIPEndPoint); | 693 | request.RemoteIPEndPoint); |
@@ -725,8 +719,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
725 | if (DebugLevel == 5) | 719 | if (DebugLevel == 5) |
726 | { | 720 | { |
727 | const int sampleLength = 80; | 721 | const int sampleLength = 80; |
728 | char[] sampleChars = new char[sampleLength]; | 722 | char[] sampleChars = new char[sampleLength + 3]; |
729 | reader.Read(sampleChars, 0, sampleLength); | 723 | reader.Read(sampleChars, 0, sampleLength); |
724 | sampleChars[80] = '.'; | ||
725 | sampleChars[81] = '.'; | ||
726 | sampleChars[82] = '.'; | ||
730 | output = new string(sampleChars); | 727 | output = new string(sampleChars); |
731 | } | 728 | } |
732 | else | 729 | else |
@@ -734,7 +731,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
734 | output = reader.ReadToEnd(); | 731 | output = reader.ReadToEnd(); |
735 | } | 732 | } |
736 | 733 | ||
737 | m_log.DebugFormat("[BASE HTTP SERVER]: {0}...", output.Replace("\n", @"\n")); | 734 | m_log.DebugFormat("[BASE HTTP SERVER]: {0}", output.Replace("\n", @"\n")); |
738 | } | 735 | } |
739 | } | 736 | } |
740 | 737 | ||
@@ -1285,59 +1282,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1285 | map["login"] = OSD.FromString("false"); | 1282 | map["login"] = OSD.FromString("false"); |
1286 | return map; | 1283 | return map; |
1287 | } | 1284 | } |
1288 | /// <summary> | ||
1289 | /// A specific agent handler was provided. Such a handler is expecetd to have an | ||
1290 | /// intimate, and highly specific relationship with the client. Consequently, | ||
1291 | /// nothing is done here. | ||
1292 | /// </summary> | ||
1293 | /// <param name="handler"></param> | ||
1294 | /// <param name="request"></param> | ||
1295 | /// <param name="response"></param> | ||
1296 | |||
1297 | private bool HandleAgentRequest(IHttpAgentHandler handler, OSHttpRequest request, OSHttpResponse response) | ||
1298 | { | ||
1299 | // In the case of REST, then handler is responsible for ALL aspects of | ||
1300 | // the request/response handling. Nothing is done here, not even encoding. | ||
1301 | |||
1302 | try | ||
1303 | { | ||
1304 | return handler.Handle(request, response); | ||
1305 | } | ||
1306 | catch (Exception e) | ||
1307 | { | ||
1308 | // If the handler did in fact close the stream, then this will blow | ||
1309 | // chunks. So that that doesn't disturb anybody we throw away any | ||
1310 | // and all exceptions raised. We've done our best to release the | ||
1311 | // client. | ||
1312 | try | ||
1313 | { | ||
1314 | m_log.Warn("[HTTP-AGENT]: Error - " + e.Message); | ||
1315 | response.SendChunked = false; | ||
1316 | response.KeepAlive = true; | ||
1317 | response.StatusCode = (int)OSHttpStatusCode.ServerErrorInternalError; | ||
1318 | //response.OutputStream.Close(); | ||
1319 | try | ||
1320 | { | ||
1321 | response.Send(); | ||
1322 | //response.FreeContext(); | ||
1323 | } | ||
1324 | catch (SocketException f) | ||
1325 | { | ||
1326 | // This has to be here to prevent a Linux/Mono crash | ||
1327 | m_log.Warn( | ||
1328 | String.Format("[BASE HTTP SERVER]: XmlRpcRequest issue {0}.\nNOTE: this may be spurious on Linux. ", f.Message), f); | ||
1329 | } | ||
1330 | } | ||
1331 | catch(Exception) | ||
1332 | { | ||
1333 | } | ||
1334 | } | ||
1335 | |||
1336 | // Indicate that the request has been "handled" | ||
1337 | |||
1338 | return true; | ||
1339 | |||
1340 | } | ||
1341 | 1285 | ||
1342 | public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) | 1286 | public byte[] HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) |
1343 | { | 1287 | { |