aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs90
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs11
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs3
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs2
-rw-r--r--OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs6
-rw-r--r--OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs4
-rw-r--r--OpenSim/Framework/Servers/VersionInfo.cs4
7 files changed, 70 insertions, 50 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
index 771ae05..01990fa 100644
--- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs
@@ -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,48 +313,16 @@ 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
295 /*
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 325
319 */
320 HandleRequest(request,resp); 326 HandleRequest(request,resp);
321 } 327 }
322 328
@@ -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");
@@ -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);
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;
30using OpenMetaverse; 30using OpenMetaverse;
31namespace OpenSim.Framework.Servers.HttpServer 31namespace 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
28using System; 28using System;
29using HttpServer; 29using HttpServer;
30using OpenMetaverse;
30 31
31namespace OpenSim.Framework.Servers.HttpServer 32namespace 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
index 0f0c790..ebb2691 100644
--- a/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
+++ b/OpenSim/Framework/Servers/HttpServer/SynchronousRestFormsRequester.cs
@@ -56,14 +56,14 @@ namespace OpenSim.Framework.Servers.HttpServer
56 request.ContentType = "text/www-form-urlencoded"; 56 request.ContentType = "text/www-form-urlencoded";
57 57
58 MemoryStream buffer = new MemoryStream(); 58 MemoryStream buffer = new MemoryStream();
59 59 int length = 0;
60 using (StreamWriter writer = new StreamWriter(buffer)) 60 using (StreamWriter writer = new StreamWriter(buffer))
61 { 61 {
62 writer.WriteLine(obj); 62 writer.WriteLine(obj);
63 writer.Flush(); 63 writer.Flush();
64 length = (int)buffer.Length;
64 } 65 }
65 66
66 int length = (int) buffer.Length;
67 request.ContentLength = length; 67 request.ContentLength = length;
68 68
69 Stream requestStream = request.GetRequestStream(); 69 Stream requestStream = request.GetRequestStream();
diff --git a/OpenSim/Framework/Servers/VersionInfo.cs b/OpenSim/Framework/Servers/VersionInfo.cs
index 6f9b00c..22a660e 100644
--- a/OpenSim/Framework/Servers/VersionInfo.cs
+++ b/OpenSim/Framework/Servers/VersionInfo.cs
@@ -29,8 +29,8 @@ 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.7";
33 private const Flavour VERSION_FLAVOUR = Flavour.Dev; 33 private const Flavour VERSION_FLAVOUR = Flavour.Release;
34 34
35 public enum Flavour 35 public enum Flavour
36 { 36 {