aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/OSHttpRequestPump.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/OSHttpRequestPump.cs39
1 files changed, 19 insertions, 20 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
index 8d4dc0d..b4270b3 100644
--- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs
+++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
@@ -39,7 +39,6 @@ using System.Threading;
39using log4net; 39using log4net;
40using HttpServer; 40using HttpServer;
41 41
42
43namespace OpenSim.Framework.Servers 42namespace OpenSim.Framework.Servers
44{ 43{
45 /// <summary> 44 /// <summary>
@@ -58,13 +57,12 @@ namespace OpenSim.Framework.Servers
58 protected Thread _engine; 57 protected Thread _engine;
59 58
60 private int _id; 59 private int _id;
61 60
62 public string EngineID 61 public string EngineID
63 { 62 {
64 get { return String.Format("{0} pump {1}", _server.EngineID, _id); } 63 get { return String.Format("{0} pump {1}", _server.EngineID, _id); }
65 } 64 }
66 65
67
68 public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id) 66 public OSHttpRequestPump(OSHttpServer server, OSHttpRequestQueue queue, int id)
69 { 67 {
70 _server = server; 68 _server = server;
@@ -77,7 +75,6 @@ namespace OpenSim.Framework.Servers
77 _engine.Start(); 75 _engine.Start();
78 76
79 ThreadTracker.Add(_engine); 77 ThreadTracker.Add(_engine);
80
81 } 78 }
82 79
83 public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize) 80 public static OSHttpRequestPump[] Pumps(OSHttpServer server, OSHttpRequestQueue queue, int poolSize)
@@ -104,21 +101,22 @@ namespace OpenSim.Framework.Servers
104 public void Engine() 101 public void Engine()
105 { 102 {
106 OSHttpRequest req = null; 103 OSHttpRequest req = null;
107 104
108 while (true) 105 while (true)
109 { 106 {
110 try { 107 try
108 {
111 // dequeue an OSHttpRequest from OSHttpServer's 109 // dequeue an OSHttpRequest from OSHttpServer's
112 // request queue 110 // request queue
113 req = _queue.Dequeue(); 111 req = _queue.Dequeue();
114 112
115 // get a copy of the list of registered handlers 113 // get a copy of the list of registered handlers
116 List<OSHttpHandler> handlers = _server.OSHttpHandlers; 114 List<OSHttpHandler> handlers = _server.OSHttpHandlers;
117 115
118 // prune list and have it sorted from most 116 // prune list and have it sorted from most
119 // specific to least specific 117 // specific to least specific
120 handlers = MatchHandlers(req, handlers); 118 handlers = MatchHandlers(req, handlers);
121 119
122 // process req: we try each handler in turn until 120 // process req: we try each handler in turn until
123 // we are either out of handlers or get back a 121 // we are either out of handlers or get back a
124 // Pass or Done 122 // Pass or Done
@@ -126,18 +124,18 @@ namespace OpenSim.Framework.Servers
126 foreach (OSHttpHandler h in handlers) 124 foreach (OSHttpHandler h in handlers)
127 { 125 {
128 rc = h.Process(req); 126 rc = h.Process(req);
129 127
130 // Pass: handler did not process the request, 128 // Pass: handler did not process the request,
131 // try next handler 129 // try next handler
132 if (OSHttpHandlerResult.Pass == rc) continue; 130 if (OSHttpHandlerResult.Pass == rc) continue;
133 131
134 // Handled: handler has processed the request 132 // Handled: handler has processed the request
135 if (OSHttpHandlerResult.Done == rc) break; 133 if (OSHttpHandlerResult.Done == rc) break;
136 134
137 // hmm, something went wrong 135 // hmm, something went wrong
138 throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc)); 136 throw new Exception(String.Format("[{0}] got unexpected OSHttpHandlerResult {1}", EngineID, rc));
139 } 137 }
140 138
141 if (OSHttpHandlerResult.Unprocessed == rc) 139 if (OSHttpHandlerResult.Unprocessed == rc)
142 { 140 {
143 _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req); 141 _log.InfoFormat("[{0}] OSHttpHandler: no handler registered for {1}", EngineID, req);
@@ -190,7 +188,7 @@ namespace OpenSim.Framework.Servers
190 if (null != remote) 188 if (null != remote)
191 { 189 {
192 Match epm = h.IPEndPointWhitelist.Match(remote.ToString()); 190 Match epm = h.IPEndPointWhitelist.Match(remote.ToString());
193 if (!epm.Success) 191 if (!epm.Success)
194 { 192 {
195 scoredHandlers.Remove(h); 193 scoredHandlers.Remove(h);
196 continue; 194 continue;
@@ -201,7 +199,7 @@ namespace OpenSim.Framework.Servers
201 if (null != h.Method) 199 if (null != h.Method)
202 { 200 {
203 Match m = h.Method.Match(req.HttpMethod); 201 Match m = h.Method.Match(req.HttpMethod);
204 if (!m.Success) 202 if (!m.Success)
205 { 203 {
206 scoredHandlers.Remove(h); 204 scoredHandlers.Remove(h);
207 continue; 205 continue;
@@ -213,7 +211,7 @@ namespace OpenSim.Framework.Servers
213 if (null != h.Path) 211 if (null != h.Path)
214 { 212 {
215 Match m = h.Path.Match(req.RawUrl); 213 Match m = h.Path.Match(req.RawUrl);
216 if (!m.Success) 214 if (!m.Success)
217 { 215 {
218 scoredHandlers.Remove(h); 216 scoredHandlers.Remove(h);
219 continue; 217 continue;
@@ -272,14 +270,15 @@ namespace OpenSim.Framework.Servers
272 { 270 {
273 return 0; 271 return 0;
274 } 272 }
275 273
276 // does the content of collection[tag] match 274 // does the content of collection[tag] match
277 // the supplied regex? 275 // the supplied regex?
278 Match cm = regexs[tag].Match(collection[tag]); 276 Match cm = regexs[tag].Match(collection[tag]);
279 if (!cm.Success) { 277 if (!cm.Success)
278 {
280 return 0; 279 return 0;
281 } 280 }
282 281
283 // ok: matches 282 // ok: matches
284 matched++; 283 matched++;
285 continue; 284 continue;
@@ -288,7 +287,7 @@ namespace OpenSim.Framework.Servers
288 return matched; 287 return matched;
289 } 288 }
290 289
291 [ConditionalAttribute("DEBUGGING")] 290 [ConditionalAttribute("DEBUGGING")]
292 private void LogDumpHandlerList(List<OSHttpHandler> l) 291 private void LogDumpHandlerList(List<OSHttpHandler> l)
293 { 292 {
294 _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID); 293 _log.DebugFormat("[{0}] OSHttpHandlerList dump:", EngineID);