diff options
author | Teravus Ovares | 2008-09-27 09:42:31 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-09-27 09:42:31 +0000 |
commit | 85b280385fd7400da8bc721131d25eee9fd7f8da (patch) | |
tree | f0fdba12f4442e01c9a3032c6c0b8881194f3509 /OpenSim/Framework/Servers/BaseHttpServer.cs | |
parent | Update unit tests (diff) | |
download | opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.zip opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.gz opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.bz2 opensim-SC-85b280385fd7400da8bc721131d25eee9fd7f8da.tar.xz |
* This is the very very early beginnings of an EventQueue:get module.
* This won't function yet as far as the client can tell.. because it doesn't respond to the first query with a 200 message.
* We have to figure out how to encode those binary values in the example code in the module...
* Committing this so we have a start point. Will continue to work on this more today.
Diffstat (limited to 'OpenSim/Framework/Servers/BaseHttpServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 61 |
1 files changed, 56 insertions, 5 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index ae07895..24bba2b 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -361,9 +361,57 @@ namespace OpenSim.Framework.Servers | |||
361 | 361 | ||
362 | buffer = streamedRequestHandler.Handle(path, request.InputStream, request, response); | 362 | buffer = streamedRequestHandler.Handle(path, request.InputStream, request, response); |
363 | } | 363 | } |
364 | else if (requestHandler is IGenericHTTPHandler) | ||
365 | { | ||
366 | IGenericHTTPHandler HTTPRequestHandler = requestHandler as IGenericHTTPHandler; | ||
367 | Stream requestStream = request.InputStream; | ||
368 | |||
369 | Encoding encoding = Encoding.UTF8; | ||
370 | StreamReader reader = new StreamReader(requestStream, encoding); | ||
371 | |||
372 | string requestBody = reader.ReadToEnd(); | ||
373 | |||
374 | |||
375 | reader.Close(); | ||
376 | requestStream.Close(); | ||
377 | |||
378 | Hashtable keysvals = new Hashtable(); | ||
379 | Hashtable headervals = new Hashtable(); | ||
380 | string host = String.Empty; | ||
381 | |||
382 | string[] querystringkeys = request.QueryString.AllKeys; | ||
383 | string[] rHeaders = request.Headers.AllKeys; | ||
384 | |||
385 | |||
386 | foreach (string queryname in querystringkeys) | ||
387 | { | ||
388 | keysvals.Add(queryname, request.QueryString[queryname]); | ||
389 | } | ||
390 | |||
391 | foreach (string headername in rHeaders) | ||
392 | { | ||
393 | //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); | ||
394 | headervals[headername] = request.Headers[headername]; | ||
395 | } | ||
396 | |||
397 | if (headervals.Contains("Host")) | ||
398 | { | ||
399 | host = (string)headervals["Host"]; | ||
400 | } | ||
401 | keysvals.Add("requestbody",requestBody); | ||
402 | if (keysvals.Contains("method")) | ||
403 | { | ||
404 | //m_log.Warn("[HTTP]: Contains Method"); | ||
405 | string method = (string)keysvals["method"]; | ||
406 | //m_log.Warn("[HTTP]: " + requestBody); | ||
407 | |||
408 | } | ||
409 | DoHTTPGruntWork(HTTPRequestHandler.Handle(path,keysvals), response); | ||
410 | return; | ||
411 | } | ||
364 | else | 412 | else |
365 | { | 413 | { |
366 | IStreamHandler streamHandler = (IStreamHandler) requestHandler; | 414 | IStreamHandler streamHandler = (IStreamHandler)requestHandler; |
367 | 415 | ||
368 | using (MemoryStream memoryStream = new MemoryStream()) | 416 | using (MemoryStream memoryStream = new MemoryStream()) |
369 | { | 417 | { |
@@ -943,6 +991,9 @@ namespace OpenSim.Framework.Servers | |||
943 | string responseString = (string)responsedata["str_response_string"]; | 991 | string responseString = (string)responsedata["str_response_string"]; |
944 | string contentType = (string)responsedata["content_type"]; | 992 | string contentType = (string)responsedata["content_type"]; |
945 | 993 | ||
994 | if (responsedata.ContainsKey("keepalive")) | ||
995 | response.KeepAlive = true; | ||
996 | |||
946 | //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this | 997 | //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this |
947 | //and should check for NullReferenceExceptions | 998 | //and should check for NullReferenceExceptions |
948 | 999 | ||
@@ -951,10 +1002,9 @@ namespace OpenSim.Framework.Servers | |||
951 | contentType = "text/html"; | 1002 | contentType = "text/html"; |
952 | } | 1003 | } |
953 | 1004 | ||
954 | // We're forgoing the usual error status codes here because the client | 1005 | // The client ignores anything but 200 here for web login, so ensure that this is 200 for that |
955 | // ignores anything but 200 and 301 | 1006 | |
956 | 1007 | response.StatusCode = responsecode; | |
957 | response.StatusCode = (int)OSHttpStatusCode.SuccessOk; | ||
958 | 1008 | ||
959 | if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) | 1009 | if (responsecode == (int)OSHttpStatusCode.RedirectMovedPermanently) |
960 | { | 1010 | { |
@@ -978,6 +1028,7 @@ namespace OpenSim.Framework.Servers | |||
978 | response.SendChunked = false; | 1028 | response.SendChunked = false; |
979 | response.ContentLength64 = buffer.Length; | 1029 | response.ContentLength64 = buffer.Length; |
980 | response.ContentEncoding = Encoding.UTF8; | 1030 | response.ContentEncoding = Encoding.UTF8; |
1031 | |||
981 | 1032 | ||
982 | try | 1033 | try |
983 | { | 1034 | { |