aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/BaseHttpServer.cs
diff options
context:
space:
mode:
authorDr Scofield2008-05-19 11:38:35 +0000
committerDr Scofield2008-05-19 11:38:35 +0000
commitd725d1208bfbeae02f181cc6731f5a98dc7fce6d (patch)
treefd27fe08b43c7ef5d15ee0e829947f06d97e8375 /OpenSim/Framework/Servers/BaseHttpServer.cs
parentRework some of the animation logic in an attempt to resolve #1318 (diff)
downloadopensim-SC_OLD-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.zip
opensim-SC_OLD-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.gz
opensim-SC_OLD-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.bz2
opensim-SC_OLD-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.xz
adding OSHttpRequest and OSHttpResponse which wrap HttpListenerRequest and HttpListenerResponse respectively.
enhancing IStreamHandler and IStreamedHandler interfaces so that OSHttp{Request,Response} get passed in, allowing RestHandlers to set response status code, redirections, etc.
Diffstat (limited to 'OpenSim/Framework/Servers/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs24
1 files changed, 12 insertions, 12 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 1eb1da9..eeb63e1 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -136,8 +136,8 @@ namespace OpenSim.Framework.Servers
136 { 136 {
137 HttpListenerContext context = (HttpListenerContext) stateinfo; 137 HttpListenerContext context = (HttpListenerContext) stateinfo;
138 138
139 HttpListenerRequest request = context.Request; 139 OSHttpRequest request = new OSHttpRequest(context.Request);
140 HttpListenerResponse response = context.Response; 140 OSHttpResponse response = new OSHttpResponse(context.Response);
141 141
142 response.KeepAlive = false; 142 response.KeepAlive = false;
143 response.SendChunked = false; 143 response.SendChunked = false;
@@ -157,7 +157,7 @@ namespace OpenSim.Framework.Servers
157 { 157 {
158 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; 158 IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler;
159 159
160 buffer = streamedRequestHandler.Handle(path, request.InputStream); 160 buffer = streamedRequestHandler.Handle(path, request.InputStream, request, response);
161 } 161 }
162 else 162 else
163 { 163 {
@@ -165,14 +165,14 @@ namespace OpenSim.Framework.Servers
165 165
166 using (MemoryStream memoryStream = new MemoryStream()) 166 using (MemoryStream memoryStream = new MemoryStream())
167 { 167 {
168 streamHandler.Handle(path, request.InputStream, memoryStream); 168 streamHandler.Handle(path, request.InputStream, memoryStream, request, response);
169 memoryStream.Flush(); 169 memoryStream.Flush();
170 buffer = memoryStream.ToArray(); 170 buffer = memoryStream.ToArray();
171 } 171 }
172 } 172 }
173 173
174 request.InputStream.Close(); 174 request.InputStream.Close();
175 response.ContentType = requestHandler.ContentType; 175 if (!response.IsContentTypeSet) response.ContentType = requestHandler.ContentType;
176 response.ContentLength64 = buffer.LongLength; 176 response.ContentLength64 = buffer.LongLength;
177 177
178 try 178 try
@@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers
280 /// </summary> 280 /// </summary>
281 /// <param name="request"></param> 281 /// <param name="request"></param>
282 /// <param name="response"></param> 282 /// <param name="response"></param>
283 private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response) 283 private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response)
284 { 284 {
285 Stream requestStream = request.InputStream; 285 Stream requestStream = request.InputStream;
286 286
@@ -358,7 +358,7 @@ namespace OpenSim.Framework.Servers
358 } 358 }
359 } 359 }
360 360
361 private void HandleLLSDRequests(HttpListenerRequest request, HttpListenerResponse response) 361 private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response)
362 { 362 {
363 Stream requestStream = request.InputStream; 363 Stream requestStream = request.InputStream;
364 364
@@ -416,7 +416,7 @@ namespace OpenSim.Framework.Servers
416 } 416 }
417 } 417 }
418 418
419 public void HandleHTTPRequest(HttpListenerRequest request, HttpListenerResponse response) 419 public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response)
420 { 420 {
421 switch (request.HttpMethod) 421 switch (request.HttpMethod)
422 { 422 {
@@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers
430 } 430 }
431 } 431 }
432 432
433 private void HandleContentVerbs(HttpListenerRequest request, HttpListenerResponse response) 433 private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response)
434 { 434 {
435 // This is a test. There's a workable alternative.. as this way sucks. 435 // This is a test. There's a workable alternative.. as this way sucks.
436 // We'd like to put this into a text file parhaps that's easily editable. 436 // We'd like to put this into a text file parhaps that's easily editable.
@@ -505,7 +505,7 @@ namespace OpenSim.Framework.Servers
505 } 505 }
506 } 506 }
507 507
508 private static void DoHTTPGruntWork(Hashtable responsedata, HttpListenerResponse response) 508 private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response)
509 { 509 {
510 int responsecode = (int)responsedata["int_response_code"]; 510 int responsecode = (int)responsedata["int_response_code"];
511 string responseString = (string)responsedata["str_response_string"]; 511 string responseString = (string)responsedata["str_response_string"];
@@ -552,7 +552,7 @@ namespace OpenSim.Framework.Servers
552 } 552 }
553 } 553 }
554 554
555 public void SendHTML404(HttpListenerResponse response, string host) 555 public void SendHTML404(OSHttpResponse response, string host)
556 { 556 {
557 // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s 557 // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
558 response.StatusCode = 200; 558 response.StatusCode = 200;
@@ -579,7 +579,7 @@ namespace OpenSim.Framework.Servers
579 } 579 }
580 } 580 }
581 581
582 public void SendHTML500(HttpListenerResponse response) 582 public void SendHTML500(OSHttpResponse response)
583 { 583 {
584 // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s 584 // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
585 response.StatusCode = 200; 585 response.StatusCode = 200;