aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/BaseHttpServer.cs
diff options
context:
space:
mode:
authorJeff Ames2008-05-16 01:22:11 +0000
committerJeff Ames2008-05-16 01:22:11 +0000
commit65c5efe43b68700bad94076d4cd421160203c5de (patch)
tree589b56649ed02f4942671fd6e51c6dc43f682e0d /OpenSim/Framework/Servers/BaseHttpServer.cs
parentThank you very much, mjm for : (diff)
downloadopensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.zip
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.gz
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.bz2
opensim-SC-65c5efe43b68700bad94076d4cd421160203c5de.tar.xz
Formatting cleanup.
Diffstat (limited to 'OpenSim/Framework/Servers/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs42
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index 50f4e23..1eb1da9 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -82,10 +82,10 @@ namespace OpenSim.Framework.Servers
82 string path = handler.Path; 82 string path = handler.Path;
83 83
84 string handlerKey = GetHandlerKey(httpMethod, path); 84 string handlerKey = GetHandlerKey(httpMethod, path);
85 85
86 if (!m_streamHandlers.ContainsKey(handlerKey)) 86 if (!m_streamHandlers.ContainsKey(handlerKey))
87 { 87 {
88 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey); 88 //m_log.DebugFormat("[BASE HTTP SERVER]: Adding handler key {0}", handlerKey);
89 m_streamHandlers.Add(handlerKey, handler); 89 m_streamHandlers.Add(handlerKey, handler);
90 } 90 }
91 } 91 }
@@ -135,20 +135,20 @@ namespace OpenSim.Framework.Servers
135 try 135 try
136 { 136 {
137 HttpListenerContext context = (HttpListenerContext) stateinfo; 137 HttpListenerContext context = (HttpListenerContext) stateinfo;
138 138
139 HttpListenerRequest request = context.Request; 139 HttpListenerRequest request = context.Request;
140 HttpListenerResponse response = context.Response; 140 HttpListenerResponse response = context.Response;
141 141
142 response.KeepAlive = false; 142 response.KeepAlive = false;
143 response.SendChunked = false; 143 response.SendChunked = false;
144 144
145 string path = request.RawUrl; 145 string path = request.RawUrl;
146 string handlerKey = GetHandlerKey(request.HttpMethod, path); 146 string handlerKey = GetHandlerKey(request.HttpMethod, path);
147 147
148 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path); 148 //m_log.DebugFormat("[BASE HTTP SERVER]: Handling {0} request for {1}", request.HttpMethod, path);
149 149
150 IRequestHandler requestHandler; 150 IRequestHandler requestHandler;
151 151
152 if (TryGetStreamHandler(handlerKey, out requestHandler)) 152 if (TryGetStreamHandler(handlerKey, out requestHandler))
153 { 153 {
154 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler. 154 // Okay, so this is bad, but should be considered temporary until everything is IStreamHandler.
@@ -156,13 +156,13 @@ namespace OpenSim.Framework.Servers
156 if (requestHandler is IStreamedRequestHandler) 156 if (requestHandler is IStreamedRequestHandler)
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);
161 } 161 }
162 else 162 else
163 { 163 {
164 IStreamHandler streamHandler = (IStreamHandler) requestHandler; 164 IStreamHandler streamHandler = (IStreamHandler) requestHandler;
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);
@@ -170,11 +170,11 @@ namespace OpenSim.Framework.Servers
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 response.ContentType = requestHandler.ContentType;
176 response.ContentLength64 = buffer.LongLength; 176 response.ContentLength64 = buffer.LongLength;
177 177
178 try 178 try
179 { 179 {
180 response.OutputStream.Write(buffer, 0, buffer.Length); 180 response.OutputStream.Write(buffer, 0, buffer.Length);
@@ -273,7 +273,7 @@ namespace OpenSim.Framework.Servers
273 return true; 273 return true;
274 } 274 }
275 } 275 }
276 276
277 /// <summary> 277 /// <summary>
278 /// Try all the registered xmlrpc handlers when an xmlrpc request is received. 278 /// Try all the registered xmlrpc handlers when an xmlrpc request is received.
279 /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method. 279 /// Sends back an XMLRPC unknown request response if no handler is registered for the requested method.
@@ -434,7 +434,7 @@ namespace OpenSim.Framework.Servers
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.
437 // 437 //
438 // For this test to work, I used the following secondlife.exe parameters 438 // For this test to work, I used the following secondlife.exe parameters
439 // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2 439 // "C:\Program Files\SecondLifeWindLight\SecondLifeWindLight.exe" -settings settings_windlight.xml -channel "Second Life WindLight" -set SystemLanguage en-us -loginpage http://10.1.1.2:8002/?show_login_form=TRUE -loginuri http://10.1.1.2:8002 -user 10.1.1.2
440 // 440 //
@@ -461,7 +461,7 @@ namespace OpenSim.Framework.Servers
461 string[] querystringkeys = request.QueryString.AllKeys; 461 string[] querystringkeys = request.QueryString.AllKeys;
462 string[] rHeaders = request.Headers.AllKeys; 462 string[] rHeaders = request.Headers.AllKeys;
463 463
464 464
465 foreach (string queryname in querystringkeys) 465 foreach (string queryname in querystringkeys)
466 { 466 {
467 keysvals.Add(queryname, request.QueryString[queryname]); 467 keysvals.Add(queryname, request.QueryString[queryname]);
@@ -489,7 +489,7 @@ namespace OpenSim.Framework.Servers
489 { 489 {
490 Hashtable responsedata = requestprocessor(keysvals); 490 Hashtable responsedata = requestprocessor(keysvals);
491 DoHTTPGruntWork(responsedata,response); 491 DoHTTPGruntWork(responsedata,response);
492 492
493 //SendHTML500(response); 493 //SendHTML500(response);
494 } 494 }
495 else 495 else
@@ -519,7 +519,7 @@ namespace OpenSim.Framework.Servers
519 contentType = "text/html"; 519 contentType = "text/html";
520 } 520 }
521 521
522 // We're forgoing the usual error status codes here because the client 522 // We're forgoing the usual error status codes here because the client
523 // ignores anything but 200 and 301 523 // ignores anything but 200 and 301
524 524
525 response.StatusCode = 200; 525 response.StatusCode = 200;
@@ -649,10 +649,10 @@ namespace OpenSim.Framework.Servers
649 649
650 public void RemoveStreamHandler(string httpMethod, string path) 650 public void RemoveStreamHandler(string httpMethod, string path)
651 { 651 {
652 string handlerKey = GetHandlerKey(httpMethod, path); 652 string handlerKey = GetHandlerKey(httpMethod, path);
653 653
654 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey); 654 //m_log.DebugFormat("[BASE HTTP SERVER]: Removing handler key {0}", handlerKey);
655 655
656 m_streamHandlers.Remove(handlerKey); 656 m_streamHandlers.Remove(handlerKey);
657 } 657 }
658 658
@@ -660,7 +660,7 @@ namespace OpenSim.Framework.Servers
660 { 660 {
661 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); 661 m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
662 } 662 }
663 663
664 public string GetHTTP404(string host) 664 public string GetHTTP404(string host)
665 { 665 {
666 string file = Path.Combine(Util.configDir(), "http_404.html"); 666 string file = Path.Combine(Util.configDir(), "http_404.html");