diff options
author | Melanie | 2009-10-02 08:23:38 +0100 |
---|---|---|
committer | Melanie | 2009-10-02 08:23:38 +0100 |
commit | 31d8cec0f8cd47ff445edc7771e5e73825a57927 (patch) | |
tree | a2d60604317739fa530502c40ffc71bab2a5c494 /OpenSim/Framework/Servers | |
parent | Restore the missing image handling to the image manager. The missing (diff) | |
parent | Merge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-31d8cec0f8cd47ff445edc7771e5e73825a57927.zip opensim-SC_OLD-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.gz opensim-SC_OLD-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.bz2 opensim-SC_OLD-31d8cec0f8cd47ff445edc7771e5e73825a57927.tar.xz |
Merge branch 'master' into diva-textures
Diffstat (limited to 'OpenSim/Framework/Servers')
11 files changed, 183 insertions, 94 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 7a244ff..632b551 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -158,7 +158,7 @@ namespace OpenSim.Framework.Servers | |||
158 | m_consoleAppender.Threshold = Level.All; | 158 | m_consoleAppender.Threshold = Level.All; |
159 | 159 | ||
160 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); | 160 | Notice(String.Format("Console log level is {0}", m_consoleAppender.Threshold)); |
161 | } | 161 | } |
162 | 162 | ||
163 | m_console.Commands.AddCommand("base", false, "quit", | 163 | m_console.Commands.AddCommand("base", false, "quit", |
164 | "quit", | 164 | "quit", |
@@ -196,7 +196,7 @@ namespace OpenSim.Framework.Servers | |||
196 | 196 | ||
197 | /// <summary> | 197 | /// <summary> |
198 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing | 198 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing |
199 | /// </summary> | 199 | /// </summary> |
200 | public virtual void ShutdownSpecific() {} | 200 | public virtual void ShutdownSpecific() {} |
201 | 201 | ||
202 | /// <summary> | 202 | /// <summary> |
@@ -286,7 +286,7 @@ namespace OpenSim.Framework.Servers | |||
286 | /// </summary> | 286 | /// </summary> |
287 | public virtual void Startup() | 287 | public virtual void Startup() |
288 | { | 288 | { |
289 | m_log.Info("[STARTUP]: Beginning startup processing"); | 289 | m_log.Info("[STARTUP]: Beginning startup processing"); |
290 | 290 | ||
291 | EnhanceVersionInformation(); | 291 | EnhanceVersionInformation(); |
292 | 292 | ||
@@ -301,7 +301,7 @@ namespace OpenSim.Framework.Servers | |||
301 | 301 | ||
302 | /// <summary> | 302 | /// <summary> |
303 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing | 303 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing |
304 | /// </summary> | 304 | /// </summary> |
305 | public virtual void Shutdown() | 305 | public virtual void Shutdown() |
306 | { | 306 | { |
307 | ShutdownSpecific(); | 307 | ShutdownSpecific(); |
@@ -367,7 +367,7 @@ namespace OpenSim.Framework.Servers | |||
367 | } | 367 | } |
368 | 368 | ||
369 | public virtual void HandleShow(string module, string[] cmd) | 369 | public virtual void HandleShow(string module, string[] cmd) |
370 | { | 370 | { |
371 | List<string> args = new List<string>(cmd); | 371 | List<string> args = new List<string>(cmd); |
372 | 372 | ||
373 | args.RemoveAt(0); | 373 | args.RemoveAt(0); |
@@ -375,7 +375,7 @@ namespace OpenSim.Framework.Servers | |||
375 | string[] showParams = args.ToArray(); | 375 | string[] showParams = args.ToArray(); |
376 | 376 | ||
377 | switch (showParams[0]) | 377 | switch (showParams[0]) |
378 | { | 378 | { |
379 | case "info": | 379 | case "info": |
380 | Notice("Version: " + m_version); | 380 | Notice("Version: " + m_version); |
381 | Notice("Startup directory: " + m_startupDirectory); | 381 | Notice("Startup directory: " + m_startupDirectory); |
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs deleted file mode 100644 index ad5281d..0000000 --- a/OpenSim/Framework/Servers/CheckSumServer.cs +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
diff --git a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs index fe69ad3..5afa110 100644 --- a/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs +++ b/OpenSim/Framework/Servers/HttpServer/AsynchronousRestObjectRequester.cs | |||
@@ -168,7 +168,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
168 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); | 168 | "[ASYNC REQUEST]: Request {0} {1} callback failed with exception {2}", verb, requestUrl, e); |
169 | } | 169 | } |
170 | 170 | ||
171 | }, null); | 171 | }, null); |
172 | } | 172 | } |
173 | } | 173 | } |
174 | } | 174 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 771ae05..6c63c6c 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -110,7 +110,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
110 | 110 | ||
111 | public BaseHttpServer(uint port, bool ssl) : this (port) | 111 | public BaseHttpServer(uint port, bool ssl) : this (port) |
112 | { | 112 | { |
113 | m_ssl = ssl; | 113 | m_ssl = ssl; |
114 | } | 114 | } |
115 | 115 | ||
116 | public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl) | 116 | public BaseHttpServer(uint port, bool ssl, uint sslport, string CN) : this (port, ssl) |
@@ -156,7 +156,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
156 | lock (m_rpcHandlers) | 156 | lock (m_rpcHandlers) |
157 | { | 157 | { |
158 | m_rpcHandlers[method] = handler; | 158 | m_rpcHandlers[method] = handler; |
159 | m_rpcHandlersKeepAlive[method] = keepAlive; // default | 159 | m_rpcHandlersKeepAlive[method] = keepAlive; // default |
160 | } | 160 | } |
161 | 161 | ||
162 | return true; | 162 | return true; |
@@ -256,13 +256,51 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
256 | IHttpClientContext context = (IHttpClientContext)source; | 256 | IHttpClientContext context = (IHttpClientContext)source; |
257 | IHttpRequest request = args.Request; | 257 | IHttpRequest request = args.Request; |
258 | 258 | ||
259 | |||
260 | PollServiceEventArgs psEvArgs; | 259 | PollServiceEventArgs psEvArgs; |
260 | |||
261 | if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) | 261 | if (TryGetPollServiceHTTPHandler(request.UriPath.ToString(), out psEvArgs)) |
262 | { | 262 | { |
263 | 263 | PollServiceHttpRequest psreq = new PollServiceHttpRequest(psEvArgs, context, request); | |
264 | m_PollServiceManager.Enqueue(new PollServiceHttpRequest(psEvArgs, context, request)); | 264 | |
265 | //DoHTTPGruntWork(psEvArgs.NoEvents(),new OSHttpResponse(new HttpResponse(context, request))); | 265 | if (psEvArgs.Request != null) |
266 | { | ||
267 | OSHttpRequest req = new OSHttpRequest(context, request); | ||
268 | |||
269 | Stream requestStream = req.InputStream; | ||
270 | |||
271 | Encoding encoding = Encoding.UTF8; | ||
272 | StreamReader reader = new StreamReader(requestStream, encoding); | ||
273 | |||
274 | string requestBody = reader.ReadToEnd(); | ||
275 | |||
276 | Hashtable keysvals = new Hashtable(); | ||
277 | Hashtable headervals = new Hashtable(); | ||
278 | |||
279 | string[] querystringkeys = req.QueryString.AllKeys; | ||
280 | string[] rHeaders = req.Headers.AllKeys; | ||
281 | |||
282 | keysvals.Add("body", requestBody); | ||
283 | keysvals.Add("uri", req.RawUrl); | ||
284 | keysvals.Add("content-type", req.ContentType); | ||
285 | keysvals.Add("http-method", req.HttpMethod); | ||
286 | |||
287 | foreach (string queryname in querystringkeys) | ||
288 | { | ||
289 | keysvals.Add(queryname, req.QueryString[queryname]); | ||
290 | } | ||
291 | |||
292 | foreach (string headername in rHeaders) | ||
293 | { | ||
294 | headervals[headername] = req.Headers[headername]; | ||
295 | } | ||
296 | |||
297 | keysvals.Add("headers",headervals); | ||
298 | keysvals.Add("querystringkeys", querystringkeys); | ||
299 | |||
300 | psEvArgs.Request(psreq.RequestID, keysvals); | ||
301 | } | ||
302 | |||
303 | m_PollServiceManager.Enqueue(psreq); | ||
266 | } | 304 | } |
267 | else | 305 | else |
268 | { | 306 | { |
@@ -275,49 +313,17 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
275 | { | 313 | { |
276 | OSHttpRequest req = new OSHttpRequest(context, request); | 314 | OSHttpRequest req = new OSHttpRequest(context, request); |
277 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); | 315 | OSHttpResponse resp = new OSHttpResponse(new HttpResponse(context, request),context); |
278 | //resp.KeepAlive = req.KeepAlive; | ||
279 | //m_log.Info("[Debug BASE HTTP SERVER]: Got Request"); | ||
280 | //HttpServerContextObj objstate= new HttpServerContextObj(req,resp); | ||
281 | //ThreadPool.QueueUserWorkItem(new WaitCallback(ConvertIHttpClientContextToOSHttp), (object)objstate); | ||
282 | HandleRequest(req, resp); | 316 | HandleRequest(req, resp); |
283 | } | 317 | } |
284 | 318 | ||
285 | public void ConvertIHttpClientContextToOSHttp(object stateinfo) | 319 | public void ConvertIHttpClientContextToOSHttp(object stateinfo) |
286 | { | 320 | { |
287 | HttpServerContextObj objstate = (HttpServerContextObj)stateinfo; | 321 | HttpServerContextObj objstate = (HttpServerContextObj)stateinfo; |
288 | //OSHttpRequest request = new OSHttpRequest(objstate.context,objstate.req); | ||
289 | //OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req)); | ||
290 | 322 | ||
291 | OSHttpRequest request = objstate.oreq; | 323 | OSHttpRequest request = objstate.oreq; |
292 | OSHttpResponse resp = objstate.oresp; | 324 | OSHttpResponse resp = objstate.oresp; |
293 | //OSHttpResponse resp = new OSHttpResponse(new HttpServer.HttpResponse(objstate.context, objstate.req)); | ||
294 | 325 | ||
295 | /* | 326 | HandleRequest(request,resp); |
296 | request.AcceptTypes = objstate.req.AcceptTypes; | ||
297 | request.ContentLength = (long)objstate.req.ContentLength; | ||
298 | request.Headers = objstate.req.Headers; | ||
299 | request.HttpMethod = objstate.req.Method; | ||
300 | request.InputStream = objstate.req.Body; | ||
301 | foreach (string str in request.Headers) | ||
302 | { | ||
303 | if (str.ToLower().Contains("content-type: ")) | ||
304 | { | ||
305 | request.ContentType = str.Substring(13, str.Length - 13); | ||
306 | break; | ||
307 | } | ||
308 | } | ||
309 | //request.KeepAlive = objstate.req. | ||
310 | foreach (HttpServer.HttpInput httpinput in objstate.req.QueryString) | ||
311 | { | ||
312 | request.QueryString.Add(httpinput.Name, httpinput[httpinput.Name]); | ||
313 | } | ||
314 | |||
315 | //request.Query = objstate.req.//objstate.req.QueryString; | ||
316 | //foreach ( | ||
317 | //request.QueryString = objstate.req.QueryString; | ||
318 | |||
319 | */ | ||
320 | HandleRequest(request,resp); | ||
321 | } | 327 | } |
322 | 328 | ||
323 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) | 329 | public virtual void HandleRequest(OSHttpRequest request, OSHttpResponse response) |
@@ -332,6 +338,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
332 | // probability event; if a request is matched it is normally expected to be | 338 | // probability event; if a request is matched it is normally expected to be |
333 | // handled | 339 | // handled |
334 | //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); | 340 | //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); |
341 | |||
335 | IHttpAgentHandler agentHandler; | 342 | IHttpAgentHandler agentHandler; |
336 | 343 | ||
337 | if (TryGetAgentHandler(request, response, out agentHandler)) | 344 | if (TryGetAgentHandler(request, response, out agentHandler)) |
@@ -342,10 +349,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
342 | } | 349 | } |
343 | } | 350 | } |
344 | 351 | ||
345 | IRequestHandler requestHandler; | ||
346 | //response.KeepAlive = true; | 352 | //response.KeepAlive = true; |
347 | response.SendChunked = false; | 353 | response.SendChunked = false; |
348 | 354 | ||
355 | IRequestHandler requestHandler; | ||
356 | |||
349 | string path = request.RawUrl; | 357 | string path = request.RawUrl; |
350 | string handlerKey = GetHandlerKey(request.HttpMethod, path); | 358 | string handlerKey = GetHandlerKey(request.HttpMethod, path); |
351 | 359 | ||
@@ -359,6 +367,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
359 | 367 | ||
360 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. | 368 | response.ContentType = requestHandler.ContentType; // Lets do this defaulting before in case handler has varying content type. |
361 | 369 | ||
370 | |||
362 | if (requestHandler is IStreamedRequestHandler) | 371 | if (requestHandler is IStreamedRequestHandler) |
363 | { | 372 | { |
364 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; | 373 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; |
@@ -404,6 +413,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
404 | // } | 413 | // } |
405 | 414 | ||
406 | keysvals.Add("requestbody", requestBody); | 415 | keysvals.Add("requestbody", requestBody); |
416 | keysvals.Add("headers",headervals); | ||
407 | if (keysvals.Contains("method")) | 417 | if (keysvals.Contains("method")) |
408 | { | 418 | { |
409 | //m_log.Warn("[HTTP]: Contains Method"); | 419 | //m_log.Warn("[HTTP]: Contains Method"); |
@@ -702,7 +712,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
702 | lock (m_rpcHandlers) | 712 | lock (m_rpcHandlers) |
703 | { | 713 | { |
704 | methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); | 714 | methodWasFound = m_rpcHandlers.TryGetValue(methodName, out method); |
705 | } | 715 | } |
706 | 716 | ||
707 | if (methodWasFound) | 717 | if (methodWasFound) |
708 | { | 718 | { |
@@ -726,8 +736,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
726 | else | 736 | else |
727 | { | 737 | { |
728 | xmlRpcResponse = new XmlRpcResponse(); | 738 | xmlRpcResponse = new XmlRpcResponse(); |
739 | |||
729 | // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php | 740 | // Code set in accordance with http://xmlrpc-epi.sourceforge.net/specs/rfc.fault_codes.php |
730 | xmlRpcResponse.SetFault(-32601, String.Format("Requested method [{0}] not found", methodName)); | 741 | xmlRpcResponse.SetFault( |
742 | XmlRpcErrorCodes.SERVER_ERROR_METHOD, | ||
743 | String.Format("Requested method [{0}] not found", methodName)); | ||
731 | } | 744 | } |
732 | 745 | ||
733 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); | 746 | responseString = XmlRpcResponseSerializer.Singleton.Serialize(xmlRpcResponse); |
@@ -747,6 +760,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
747 | response.SendChunked = false; | 760 | response.SendChunked = false; |
748 | response.ContentLength64 = buf.Length; | 761 | response.ContentLength64 = buf.Length; |
749 | response.ContentEncoding = Encoding.UTF8; | 762 | response.ContentEncoding = Encoding.UTF8; |
763 | |||
750 | try | 764 | try |
751 | { | 765 | { |
752 | response.OutputStream.Write(buf, 0, buf.Length); | 766 | response.OutputStream.Write(buf, 0, buf.Length); |
@@ -917,7 +931,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
917 | } | 931 | } |
918 | catch (IOException e) | 932 | catch (IOException e) |
919 | { | 933 | { |
920 | m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e); | 934 | m_log.DebugFormat("[BASE HTTP SERVER] LLSD IOException {0}.", e); |
921 | } | 935 | } |
922 | catch (SocketException e) | 936 | catch (SocketException e) |
923 | { | 937 | { |
@@ -1354,7 +1368,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1354 | bestMatch = pattern; | 1368 | bestMatch = pattern; |
1355 | } | 1369 | } |
1356 | } | 1370 | } |
1357 | } | 1371 | } |
1358 | 1372 | ||
1359 | if (String.IsNullOrEmpty(bestMatch)) | 1373 | if (String.IsNullOrEmpty(bestMatch)) |
1360 | { | 1374 | { |
@@ -1466,7 +1480,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1466 | { | 1480 | { |
1467 | m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); | 1481 | m_log.Warn("[BASE HTTP SERVER] XmlRpcRequest issue: " + e.Message); |
1468 | } | 1482 | } |
1469 | } | 1483 | } |
1470 | } | 1484 | } |
1471 | 1485 | ||
1472 | public void SendHTML404(OSHttpResponse response, string host) | 1486 | public void SendHTML404(OSHttpResponse response, string host) |
@@ -1575,7 +1589,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1575 | // if you want more detailed trace information from the HttpServer | 1589 | // if you want more detailed trace information from the HttpServer |
1576 | //m_httpListener2.UseTraceLogs = true; | 1590 | //m_httpListener2.UseTraceLogs = true; |
1577 | 1591 | ||
1578 | //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; | 1592 | //m_httpListener2.DisconnectHandler = httpServerDisconnectMonitor; |
1579 | } | 1593 | } |
1580 | else | 1594 | else |
1581 | { | 1595 | { |
@@ -1610,7 +1624,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1610 | } | 1624 | } |
1611 | 1625 | ||
1612 | public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err) | 1626 | public void httpServerDisconnectMonitor(IHttpClientContext source, SocketError err) |
1613 | { | 1627 | { |
1614 | switch (err) | 1628 | switch (err) |
1615 | { | 1629 | { |
1616 | case SocketError.NotSocket: | 1630 | case SocketError.NotSocket: |
@@ -1621,7 +1635,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1621 | } | 1635 | } |
1622 | 1636 | ||
1623 | public void httpServerException(object source, Exception exception) | 1637 | public void httpServerException(object source, Exception exception) |
1624 | { | 1638 | { |
1625 | m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); | 1639 | m_log.ErrorFormat("[HTTPSERVER]: {0} had an exception {1}", source.ToString(), exception.ToString()); |
1626 | /* | 1640 | /* |
1627 | if (HTTPDRunning)// && NotSocketErrors > 5) | 1641 | if (HTTPDRunning)// && NotSocketErrors > 5) |
@@ -1648,7 +1662,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1648 | } | 1662 | } |
1649 | catch (NullReferenceException) | 1663 | catch (NullReferenceException) |
1650 | { | 1664 | { |
1651 | m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer."); | 1665 | m_log.Warn("[BASEHTTPSERVER]: Null Reference when stopping HttpServer."); |
1652 | } | 1666 | } |
1653 | 1667 | ||
1654 | } | 1668 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs index 1bdf4fa..d13408d 100644 --- a/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/Interfaces/IHttpServer.cs | |||
@@ -128,6 +128,6 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
128 | 128 | ||
129 | string GetHTTP404(string host); | 129 | string GetHTTP404(string host); |
130 | 130 | ||
131 | string GetHTTP500(); | 131 | string GetHTTP500(); |
132 | } | 132 | } |
133 | } | 133 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index fed490e..9d512c6 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -30,20 +30,23 @@ using System.Collections; | |||
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | namespace OpenSim.Framework.Servers.HttpServer | 31 | namespace OpenSim.Framework.Servers.HttpServer |
32 | { | 32 | { |
33 | public delegate bool HasEventsMethod(UUID pId); | 33 | public delegate void RequestMethod(UUID requestID, Hashtable request); |
34 | public delegate bool HasEventsMethod(UUID requestID, UUID pId); | ||
34 | 35 | ||
35 | public delegate Hashtable GetEventsMethod(UUID pId, string request); | 36 | public delegate Hashtable GetEventsMethod(UUID requestID, UUID pId, string request); |
36 | 37 | ||
37 | public delegate Hashtable NoEventsMethod(); | 38 | public delegate Hashtable NoEventsMethod(UUID requestID, UUID pId); |
38 | 39 | ||
39 | public class PollServiceEventArgs : EventArgs | 40 | public class PollServiceEventArgs : EventArgs |
40 | { | 41 | { |
41 | public HasEventsMethod HasEvents; | 42 | public HasEventsMethod HasEvents; |
42 | public GetEventsMethod GetEvents; | 43 | public GetEventsMethod GetEvents; |
43 | public NoEventsMethod NoEvents; | 44 | public NoEventsMethod NoEvents; |
45 | public RequestMethod Request; | ||
44 | public UUID Id; | 46 | public UUID Id; |
45 | public PollServiceEventArgs(HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId) | 47 | public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId) |
46 | { | 48 | { |
49 | Request = pRequest; | ||
47 | HasEvents = pHasEvents; | 50 | HasEvents = pHasEvents; |
48 | GetEvents = pGetEvents; | 51 | GetEvents = pGetEvents; |
49 | NoEvents = pNoEvents; | 52 | NoEvents = pNoEvents; |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index ff7c1e8..553a7eb 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using HttpServer; | 29 | using HttpServer; |
30 | using OpenMetaverse; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace OpenSim.Framework.Servers.HttpServer |
32 | { | 33 | { |
@@ -37,12 +38,14 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
37 | public readonly IHttpClientContext HttpContext; | 38 | public readonly IHttpClientContext HttpContext; |
38 | public readonly IHttpRequest Request; | 39 | public readonly IHttpRequest Request; |
39 | public readonly int RequestTime; | 40 | public readonly int RequestTime; |
41 | public readonly UUID RequestID; | ||
40 | public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) | 42 | public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) |
41 | { | 43 | { |
42 | PollServiceArgs = pPollServiceArgs; | 44 | PollServiceArgs = pPollServiceArgs; |
43 | HttpContext = pHttpContext; | 45 | HttpContext = pHttpContext; |
44 | Request = pRequest; | 46 | Request = pRequest; |
45 | RequestTime = System.Environment.TickCount; | 47 | RequestTime = System.Environment.TickCount; |
48 | RequestID = UUID.Random(); | ||
46 | } | 49 | } |
47 | } | 50 | } |
48 | } | 51 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 4020190..1c54581 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -130,7 +130,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
130 | foreach (object o in m_requests) | 130 | foreach (object o in m_requests) |
131 | { | 131 | { |
132 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; | 132 | PollServiceHttpRequest req = (PollServiceHttpRequest) o; |
133 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); | 133 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request), req.HttpContext)); |
134 | } | 134 | } |
135 | 135 | ||
136 | m_requests.Clear(); | 136 | m_requests.Clear(); |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 41fb376..ce32443 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | |||
@@ -100,11 +100,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
100 | PollServiceHttpRequest req = m_request.Dequeue(); | 100 | PollServiceHttpRequest req = m_request.Dequeue(); |
101 | try | 101 | try |
102 | { | 102 | { |
103 | if (req.PollServiceArgs.HasEvents(req.PollServiceArgs.Id)) | 103 | if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) |
104 | { | 104 | { |
105 | StreamReader str = new StreamReader(req.Request.Body); | 105 | StreamReader str = new StreamReader(req.Request.Body); |
106 | 106 | ||
107 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.PollServiceArgs.Id, str.ReadToEnd()); | 107 | Hashtable responsedata = req.PollServiceArgs.GetEvents(req.RequestID, req.PollServiceArgs.Id, str.ReadToEnd()); |
108 | m_server.DoHTTPGruntWork(responsedata, | 108 | m_server.DoHTTPGruntWork(responsedata, |
109 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | 109 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); |
110 | } | 110 | } |
@@ -112,7 +112,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
112 | { | 112 | { |
113 | if ((Environment.TickCount - req.RequestTime) > m_timeout) | 113 | if ((Environment.TickCount - req.RequestTime) > m_timeout) |
114 | { | 114 | { |
115 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(), | 115 | m_server.DoHTTPGruntWork(req.PollServiceArgs.NoEvents(req.RequestID, req.PollServiceArgs.Id), |
116 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); | 116 | new OSHttpResponse(new HttpResponse(req.HttpContext, req.Request),req.HttpContext)); |
117 | } | 117 | } |
118 | else | 118 | else |
diff --git a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs new file mode 100644 index 0000000..a0d4008 --- /dev/null +++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs | |||
@@ -0,0 +1,95 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | using System.Xml; | ||
33 | using System.Xml.Serialization; | ||
34 | |||
35 | namespace OpenSim.Framework.Servers.HttpServer | ||
36 | { | ||
37 | public class SynchronousRestFormsRequester | ||
38 | { | ||
39 | /// <summary> | ||
40 | /// Perform a synchronous REST request. | ||
41 | /// </summary> | ||
42 | /// <param name="verb"></param> | ||
43 | /// <param name="requestUrl"></param> | ||
44 | /// <param name="obj"> </param> | ||
45 | /// <returns></returns> | ||
46 | /// | ||
47 | /// <exception cref="System.Net.WebException">Thrown if we encounter a network issue while posting | ||
48 | /// the request. You'll want to make sure you deal with this as they're not uncommon</exception> | ||
49 | public static string MakeRequest(string verb, string requestUrl, string obj) | ||
50 | { | ||
51 | WebRequest request = WebRequest.Create(requestUrl); | ||
52 | request.Method = verb; | ||
53 | |||
54 | if ((verb == "POST") || (verb == "PUT")) | ||
55 | { | ||
56 | request.ContentType = "text/www-form-urlencoded"; | ||
57 | |||
58 | MemoryStream buffer = new MemoryStream(); | ||
59 | int length = 0; | ||
60 | using (StreamWriter writer = new StreamWriter(buffer)) | ||
61 | { | ||
62 | writer.Write(obj); | ||
63 | writer.Flush(); | ||
64 | } | ||
65 | |||
66 | length = (int)obj.Length; | ||
67 | request.ContentLength = length; | ||
68 | |||
69 | Stream requestStream = request.GetRequestStream(); | ||
70 | requestStream.Write(buffer.ToArray(), 0, length); | ||
71 | } | ||
72 | |||
73 | string respstring = String.Empty; | ||
74 | |||
75 | try | ||
76 | { | ||
77 | using (WebResponse resp = request.GetResponse()) | ||
78 | { | ||
79 | if (resp.ContentLength > 0) | ||
80 | { | ||
81 | using (StreamReader reader = new StreamReader(resp.GetResponseStream())) | ||
82 | { | ||
83 | respstring = reader.ReadToEnd(); | ||
84 | } | ||
85 | } | ||
86 | } | ||
87 | } | ||
88 | catch (System.InvalidOperationException) | ||
89 | { | ||
90 | // This is what happens when there is invalid XML | ||
91 | } | ||
92 | return respstring; | ||
93 | } | ||
94 | } | ||
95 | } | ||
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs index 6f9b00c..9f98310 100644 --- a/OpenSim/Framework/Servers/VersionInfo.cs +++ b/OpenSim/Framework/Servers/VersionInfo.cs | |||
@@ -29,7 +29,7 @@ namespace OpenSim | |||
29 | { | 29 | { |
30 | public class VersionInfo | 30 | public class VersionInfo |
31 | { | 31 | { |
32 | private const string VERSION_NUMBER = "0.6.6"; | 32 | private const string VERSION_NUMBER = "0.6.8"; |
33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; | 33 | private const Flavour VERSION_FLAVOUR = Flavour.Dev; |
34 | 34 | ||
35 | public enum Flavour | 35 | public enum Flavour |
@@ -56,7 +56,7 @@ namespace OpenSim | |||
56 | public const int VERSIONINFO_VERSION_LENGTH = 27; | 56 | public const int VERSIONINFO_VERSION_LENGTH = 27; |
57 | 57 | ||
58 | /// <value> | 58 | /// <value> |
59 | /// This is the external interface version. It is separate from the OpenSimulator project version. | 59 | /// This is the external interface version. It is separate from the OpenSimulator project version. |
60 | /// | 60 | /// |
61 | /// This version number should be | 61 | /// This version number should be |
62 | /// increased by 1 every time a code change makes the previous OpenSimulator revision incompatible | 62 | /// increased by 1 every time a code change makes the previous OpenSimulator revision incompatible |
@@ -67,7 +67,7 @@ namespace OpenSim | |||
67 | /// | 67 | /// |
68 | /// Having this version number allows the grid service to reject connections from regions running a version | 68 | /// Having this version number allows the grid service to reject connections from regions running a version |
69 | /// of the code that is too old. | 69 | /// of the code that is too old. |
70 | /// | 70 | /// |
71 | /// </value> | 71 | /// </value> |
72 | public readonly static int MajorInterfaceVersion = 6; | 72 | public readonly static int MajorInterfaceVersion = 6; |
73 | } | 73 | } |