diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r-- | OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | 81 |
1 files changed, 51 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs index fa17fb6..998f3d2 100644 --- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs | |||
@@ -233,9 +233,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
233 | return; | 233 | return; |
234 | } | 234 | } |
235 | 235 | ||
236 | foreach (UUID req in data.requests.Keys) | 236 | lock (m_RequestMap) |
237 | m_RequestMap.Remove(req); | 237 | { |
238 | 238 | foreach (UUID req in data.requests.Keys) | |
239 | m_RequestMap.Remove(req); | ||
240 | } | ||
241 | |||
239 | RemoveUrl(data); | 242 | RemoveUrl(data); |
240 | m_UrlMap.Remove(url); | 243 | m_UrlMap.Remove(url); |
241 | } | 244 | } |
@@ -243,36 +246,42 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
243 | 246 | ||
244 | public void HttpResponse(UUID request, int status, string body) | 247 | public void HttpResponse(UUID request, int status, string body) |
245 | { | 248 | { |
246 | if (m_RequestMap.ContainsKey(request)) | 249 | lock (m_RequestMap) |
247 | { | 250 | { |
248 | UrlData urlData = m_RequestMap[request]; | 251 | if (m_RequestMap.ContainsKey(request)) |
249 | if (!urlData.requests[request].responseSent) | ||
250 | { | 252 | { |
251 | urlData.requests[request].responseCode = status; | 253 | UrlData urlData = m_RequestMap[request]; |
252 | urlData.requests[request].responseBody = body; | 254 | if (!urlData.requests[request].responseSent) |
253 | //urlData.requests[request].ev.Set(); | 255 | { |
254 | urlData.requests[request].requestDone = true; | 256 | urlData.requests[request].responseCode = status; |
255 | urlData.requests[request].responseSent = true; | 257 | urlData.requests[request].responseBody = body; |
258 | //urlData.requests[request].ev.Set(); | ||
259 | urlData.requests[request].requestDone = true; | ||
260 | urlData.requests[request].responseSent = true; | ||
261 | } | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
256 | } | 266 | } |
257 | } | ||
258 | else | ||
259 | { | ||
260 | m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString()); | ||
261 | } | 267 | } |
262 | } | 268 | } |
263 | 269 | ||
264 | public string GetHttpHeader(UUID requestId, string header) | 270 | public string GetHttpHeader(UUID requestId, string header) |
265 | { | 271 | { |
266 | if (m_RequestMap.ContainsKey(requestId)) | 272 | lock (m_RequestMap) |
267 | { | ||
268 | UrlData urlData=m_RequestMap[requestId]; | ||
269 | string value; | ||
270 | if (urlData.requests[requestId].headers.TryGetValue(header,out value)) | ||
271 | return value; | ||
272 | } | ||
273 | else | ||
274 | { | 273 | { |
275 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | 274 | if (m_RequestMap.ContainsKey(requestId)) |
275 | { | ||
276 | UrlData urlData = m_RequestMap[requestId]; | ||
277 | string value; | ||
278 | if (urlData.requests[requestId].headers.TryGetValue(header, out value)) | ||
279 | return value; | ||
280 | } | ||
281 | else | ||
282 | { | ||
283 | m_log.Warn("[HttpRequestHandler] There was no http-in request with id " + requestId); | ||
284 | } | ||
276 | } | 285 | } |
277 | return String.Empty; | 286 | return String.Empty; |
278 | } | 287 | } |
@@ -294,8 +303,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
294 | { | 303 | { |
295 | RemoveUrl(url.Value); | 304 | RemoveUrl(url.Value); |
296 | removeURLs.Add(url.Key); | 305 | removeURLs.Add(url.Key); |
297 | foreach (UUID req in url.Value.requests.Keys) | 306 | lock (m_RequestMap) |
298 | m_RequestMap.Remove(req); | 307 | { |
308 | foreach (UUID req in url.Value.requests.Keys) | ||
309 | m_RequestMap.Remove(req); | ||
310 | } | ||
299 | } | 311 | } |
300 | } | 312 | } |
301 | 313 | ||
@@ -316,8 +328,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
316 | { | 328 | { |
317 | RemoveUrl(url.Value); | 329 | RemoveUrl(url.Value); |
318 | removeURLs.Add(url.Key); | 330 | removeURLs.Add(url.Key); |
319 | foreach (UUID req in url.Value.requests.Keys) | 331 | lock (m_RequestMap) |
320 | m_RequestMap.Remove(req); | 332 | { |
333 | foreach (UUID req in url.Value.requests.Keys) | ||
334 | m_RequestMap.Remove(req); | ||
335 | } | ||
321 | } | 336 | } |
322 | } | 337 | } |
323 | 338 | ||
@@ -355,7 +370,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
355 | lock (url) | 370 | lock (url) |
356 | { | 371 | { |
357 | url.requests.Remove(requestID); | 372 | url.requests.Remove(requestID); |
358 | m_RequestMap.Remove(requestID); | 373 | lock (m_RequestMap) |
374 | { | ||
375 | m_RequestMap.Remove(requestID); | ||
376 | } | ||
359 | } | 377 | } |
360 | 378 | ||
361 | return response; | 379 | return response; |
@@ -431,7 +449,10 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp | |||
431 | lock (url) | 449 | lock (url) |
432 | { | 450 | { |
433 | url.requests.Remove(requestID); | 451 | url.requests.Remove(requestID); |
434 | m_RequestMap.Remove(requestID); | 452 | lock (m_RequestMap) |
453 | { | ||
454 | m_RequestMap.Remove(requestID); | ||
455 | } | ||
435 | } | 456 | } |
436 | 457 | ||
437 | return response; | 458 | return response; |