diff options
author | Justin Clark-Casey (justincc) | 2012-06-22 23:16:18 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-22 23:16:18 +0100 |
commit | dca04c7b61abb7b7ea70299a192425ce3bd05937 (patch) | |
tree | c5af21989c732e8bd90b7c95a8ea1b3978c2e5b1 /OpenSim/Framework/Servers | |
parent | Avoid race condition between m_PrimObjects iteration in XEngine.PostObjectEve... (diff) | |
download | opensim-SC-dca04c7b61abb7b7ea70299a192425ce3bd05937.zip opensim-SC-dca04c7b61abb7b7ea70299a192425ce3bd05937.tar.gz opensim-SC-dca04c7b61abb7b7ea70299a192425ce3bd05937.tar.bz2 opensim-SC-dca04c7b61abb7b7ea70299a192425ce3bd05937.tar.xz |
Avoid a race condition where an incoming request to a script external URL can trigger an exception is the URL was being removed at the same time.
This involves three steps
1) Return gracefully in UrlModule.HttpRequestHandler() instead of throwing an exception when the url cannot be found in its index
2) Return true instead of false in HasEvents() if no matching request is found in the map. This call will only happen in the first place for raced requests.
3) Return a 404 in GetEvents() if the request is not in the index, rather than a blank 200 OK.
Many thanks to Tom Haines in http://opensimulator.org/mantis/view.php?id=6051 for doing some of the work on this.
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | 9 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | 7 |
2 files changed, 11 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index 9d512c6..3089351 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using OpenMetaverse; | 30 | using OpenMetaverse; |
31 | |||
31 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace OpenSim.Framework.Servers.HttpServer |
32 | { | 33 | { |
33 | public delegate void RequestMethod(UUID requestID, Hashtable request); | 34 | public delegate void RequestMethod(UUID requestID, Hashtable request); |
@@ -44,7 +45,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
44 | public NoEventsMethod NoEvents; | 45 | public NoEventsMethod NoEvents; |
45 | public RequestMethod Request; | 46 | public RequestMethod Request; |
46 | public UUID Id; | 47 | public UUID Id; |
47 | public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId) | 48 | |
49 | public PollServiceEventArgs( | ||
50 | RequestMethod pRequest, | ||
51 | HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents, | ||
52 | UUID pId) | ||
48 | { | 53 | { |
49 | Request = pRequest; | 54 | Request = pRequest; |
50 | HasEvents = pHasEvents; | 55 | HasEvents = pHasEvents; |
@@ -53,4 +58,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
53 | Id = pId; | 58 | Id = pId; |
54 | } | 59 | } |
55 | } | 60 | } |
56 | } | 61 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs index 553a7eb..723530a 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs | |||
@@ -31,7 +31,6 @@ using OpenMetaverse; | |||
31 | 31 | ||
32 | namespace OpenSim.Framework.Servers.HttpServer | 32 | namespace OpenSim.Framework.Servers.HttpServer |
33 | { | 33 | { |
34 | |||
35 | public class PollServiceHttpRequest | 34 | public class PollServiceHttpRequest |
36 | { | 35 | { |
37 | public readonly PollServiceEventArgs PollServiceArgs; | 36 | public readonly PollServiceEventArgs PollServiceArgs; |
@@ -39,7 +38,9 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
39 | public readonly IHttpRequest Request; | 38 | public readonly IHttpRequest Request; |
40 | public readonly int RequestTime; | 39 | public readonly int RequestTime; |
41 | public readonly UUID RequestID; | 40 | public readonly UUID RequestID; |
42 | public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) | 41 | |
42 | public PollServiceHttpRequest( | ||
43 | PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest) | ||
43 | { | 44 | { |
44 | PollServiceArgs = pPollServiceArgs; | 45 | PollServiceArgs = pPollServiceArgs; |
45 | HttpContext = pHttpContext; | 46 | HttpContext = pHttpContext; |
@@ -48,4 +49,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
48 | RequestID = UUID.Random(); | 49 | RequestID = UUID.Random(); |
49 | } | 50 | } |
50 | } | 51 | } |
51 | } | 52 | } \ No newline at end of file |