aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Servers/OSHttpHandler.cs1
-rw-r--r--OpenSim/Framework/Servers/OSHttpRequestPump.cs64
2 files changed, 39 insertions, 26 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpHandler.cs b/OpenSim/Framework/Servers/OSHttpHandler.cs
index c4ab81c..da96cca 100644
--- a/OpenSim/Framework/Servers/OSHttpHandler.cs
+++ b/OpenSim/Framework/Servers/OSHttpHandler.cs
@@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers
57 /// </summary> 57 /// </summary>
58 public enum OSHttpHandlerResult 58 public enum OSHttpHandlerResult
59 { 59 {
60 Unprocessed,
60 Pass, 61 Pass,
61 Handled, 62 Handled,
62 Detached, 63 Detached,
diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
index 3459cc6..44fba47 100644
--- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs
+++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
@@ -98,42 +98,54 @@ namespace OpenSim.Framework.Servers
98 { 98 {
99 OSHttpRequest req = null; 99 OSHttpRequest req = null;
100 100
101 try { 101 while (true)
102 while (true) 102 {
103 { 103 try {
104 // get job to do 104 // dequeue an OSHttpRequest from OSHttpServer's
105 // request queue
105 req = _queue.Dequeue(); 106 req = _queue.Dequeue();
106 107
107 // get list of registered handlers 108 // get a copy of the list of registered handlers
108 List<OSHttpHandler> handlers = _server.OSHttpHandlers; 109 List<OSHttpHandler> handlers = _server.OSHttpHandlers;
109 110
110 // prune list and sort from most specific to least 111 // prune list and have it sorted from most
111 // specific 112 // specific to least specific
112 handlers = MatchHandlers(req, handlers); 113 handlers = MatchHandlers(req, handlers);
113 114
114 // process req 115 // process req: we try each handler in turn until
116 // we are either out of handlers or get back a
117 // Handled or Detached
118 OSHttpHandlerResult rc = OSHttpHandlerResult.Unprocessed;
115 foreach(OSHttpHandler h in handlers) 119 foreach(OSHttpHandler h in handlers)
116 { 120 {
117 OSHttpHandlerResult rc = h.Process(req); 121 rc = h.Process(req);
118 // handler did not process the request, try 122
119 // next handler 123 // Pass: handler did not process the request,
124 // try next handler
120 if (OSHttpHandlerResult.Pass == rc) continue; 125 if (OSHttpHandlerResult.Pass == rc) continue;
121 // handler is taking over processing of 126 // Detached: handler is taking over processing
122 // request, we are done 127 // of request, we are done
123 if (OSHttpHandlerResult.Detached == rc) break; 128 if (OSHttpHandlerResult.Detached == rc) break;
124 129
125 // request was handled, we need to clean up 130 if (OSHttpHandlerResult.Handled != rc)
126 // TODO: cleanup :-) 131 {
127 132 // something went wrong
133 throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
134 }
135
136 // Handled: clean up
137 // response.KeepAlive = false;
138 // response.SendChunked = false;
139
128 break; 140 break;
129 } 141 }
130 142
143 }
144 catch (Exception e)
145 {
146 _log.DebugFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.ToString());
147 _log.ErrorFormat("[{0}] OSHttpHandler problem: {1}", EngineID, e.Message);
131 } 148 }
132 }
133 catch (Exception e)
134 {
135 _log.DebugFormat("[{0}] something went wrong: {1}", EngineID, e.ToString());
136 _log.ErrorFormat("[{0}] something went wrong: {1}, terminating this pump", EngineID, e.Message);
137 } 149 }
138 } 150 }
139 151