aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/BaseHttpServer.cs
diff options
context:
space:
mode:
authorlbsa712007-12-27 21:41:48 +0000
committerlbsa712007-12-27 21:41:48 +0000
commitefd90b56b761219af6425b1c7a2cdd3b6ffb4de2 (patch)
treebf5b897e1e3c13211e3e2fc61d30508b94c928c0 /OpenSim/Framework/Servers/BaseHttpServer.cs
parent* removed always true if (diff)
downloadopensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.zip
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.gz
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.bz2
opensim-SC_OLD-efd90b56b761219af6425b1c7a2cdd3b6ffb4de2.tar.xz
* Optimized usings
* shortened references * Removed redundant 'this' * Normalized EOF
Diffstat (limited to 'OpenSim/Framework/Servers/BaseHttpServer.cs')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs66
1 files changed, 40 insertions, 26 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index d865ae8..7af1716 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -97,7 +97,7 @@ namespace OpenSim.Framework.Servers
97 97
98 HttpListenerRequest request = context.Request; 98 HttpListenerRequest request = context.Request;
99 HttpListenerResponse response = context.Response; 99 HttpListenerResponse response = context.Response;
100 100
101 101
102 response.KeepAlive = false; 102 response.KeepAlive = false;
103 response.SendChunked = false; 103 response.SendChunked = false;
@@ -192,15 +192,12 @@ namespace OpenSim.Framework.Servers
192 MainLog.Instance.Error("XML", responseString); 192 MainLog.Instance.Error("XML", responseString);
193 string[] querystringkeys = request.QueryString.AllKeys; 193 string[] querystringkeys = request.QueryString.AllKeys;
194 string[] rHeaders = request.Headers.AllKeys; 194 string[] rHeaders = request.Headers.AllKeys;
195
196
197 195
198 196
199 foreach (string queryname in querystringkeys) 197 foreach (string queryname in querystringkeys)
200 { 198 {
201 keysvals.Add(queryname, request.QueryString[queryname]); 199 keysvals.Add(queryname, request.QueryString[queryname]);
202 MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]); 200 MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]);
203
204 } 201 }
205 foreach (string headername in rHeaders) 202 foreach (string headername in rHeaders)
206 { 203 {
@@ -218,7 +215,6 @@ namespace OpenSim.Framework.Servers
218 string methodName = xmlRprcRequest.MethodName; 215 string methodName = xmlRprcRequest.MethodName;
219 if (methodName != null) 216 if (methodName != null)
220 { 217 {
221
222 XmlRpcResponse xmlRpcResponse; 218 XmlRpcResponse xmlRpcResponse;
223 219
224 XmlRpcMethod method; 220 XmlRpcMethod method;
@@ -241,8 +237,8 @@ namespace OpenSim.Framework.Servers
241 } 237 }
242 else 238 else
243 { 239 {
244 System.Console.WriteLine("Handler not found for http request " +request.RawUrl); 240 System.Console.WriteLine("Handler not found for http request " + request.RawUrl);
245 responseString = "Error"; 241 responseString = "Error";
246 } 242 }
247 } 243 }
248 244
@@ -266,7 +262,8 @@ namespace OpenSim.Framework.Servers
266 response.OutputStream.Close(); 262 response.OutputStream.Close();
267 } 263 }
268 } 264 }
269 public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response) 265
266 public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response)
270 { 267 {
271 // This is a test. There's a workable alternative.. as this way sucks. 268 // This is a test. There's a workable alternative.. as this way sucks.
272 // We'd like to put this into a text file parhaps that's easily editable. 269 // We'd like to put this into a text file parhaps that's easily editable.
@@ -280,12 +277,14 @@ namespace OpenSim.Framework.Servers
280 // to display the form, or process it. 277 // to display the form, or process it.
281 // a better way would be nifty. 278 // a better way would be nifty.
282 279
283 if ((string)keysvals["show_login_form"] == "TRUE") 280 if ((string) keysvals["show_login_form"] == "TRUE")
284 { 281 {
285 string responseString = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">"; 282 string responseString =
283 "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
286 responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">"; 284 responseString = responseString + "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
287 responseString = responseString + "<head>"; 285 responseString = responseString + "<head>";
288 responseString = responseString + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />"; 286 responseString = responseString +
287 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
289 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">"; 288 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
290 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">"; 289 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
291 responseString = responseString + "<title>Second Life Login</title>"; 290 responseString = responseString + "<title>Second Life Login</title>";
@@ -299,37 +298,50 @@ namespace OpenSim.Framework.Servers
299 responseString = responseString + "</div>"; 298 responseString = responseString + "</div>";
300 responseString = responseString + "<fieldset id=\"firstname\">"; 299 responseString = responseString + "<fieldset id=\"firstname\">";
301 responseString = responseString + "<legend>First Name:</legend>"; 300 responseString = responseString + "<legend>First Name:</legend>";
302 responseString = responseString + "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"" + keysvals["username"] + "\" />"; 301 responseString = responseString +
302 "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"" +
303 keysvals["username"] + "\" />";
303 responseString = responseString + "</fieldset>"; 304 responseString = responseString + "</fieldset>";
304 responseString = responseString + "<fieldset id=\"lastname\">"; 305 responseString = responseString + "<fieldset id=\"lastname\">";
305 responseString = responseString + "<legend>Last Name:</legend>"; 306 responseString = responseString + "<legend>Last Name:</legend>";
306 responseString = responseString + "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"" + keysvals["lastname"] + "\" />"; 307 responseString = responseString +
308 "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"" +
309 keysvals["lastname"] + "\" />";
307 responseString = responseString + "</fieldset>"; 310 responseString = responseString + "</fieldset>";
308 responseString = responseString + "<fieldset id=\"password\">"; 311 responseString = responseString + "<fieldset id=\"password\">";
309 responseString = responseString + "<legend>Password:</legend>"; 312 responseString = responseString + "<legend>Password:</legend>";
310 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">"; 313 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
311 responseString = responseString + "<tr>"; 314 responseString = responseString + "<tr>";
312 responseString = responseString + "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"" + keysvals["password"] + "\" /></td>"; 315 responseString = responseString +
316 "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"" +
317 keysvals["password"] + "\" /></td>";
313 responseString = responseString + "</tr>"; 318 responseString = responseString + "</tr>";
314 responseString = responseString + "<tr>"; 319 responseString = responseString + "<tr>";
315 responseString = responseString + "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" value=\"" + keysvals["remember_password"] + "\" checked style=\"margin-left:0px;\"/></td>"; 320 responseString = responseString +
321 "<td valign=\"middle\"><input type=\"checkbox\" name=\"remember_password\" id=\"remember_password\" value=\"" +
322 keysvals["remember_password"] + "\" checked style=\"margin-left:0px;\"/></td>";
316 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>"; 323 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>";
317 responseString = responseString + "</tr>"; 324 responseString = responseString + "</tr>";
318 responseString = responseString + "</table>"; 325 responseString = responseString + "</table>";
319 responseString = responseString + "</fieldset>"; 326 responseString = responseString + "</fieldset>";
320 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />"; 327 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />";
321 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"" + keysvals["grid"] + "\" />"; 328 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"" +
329 keysvals["grid"] + "\" />";
322 responseString = responseString + "<div id=\"submitbtn\">"; 330 responseString = responseString + "<div id=\"submitbtn\">";
323 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />"; 331 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />";
324 responseString = responseString + "</div>"; 332 responseString = responseString + "</div>";
325 responseString = responseString + "<div id=\"connecting\" style=\"visibility:hidden\"><img src=\"/_img/sl_logo_rotate_black.gif\" align=\"absmiddle\"> Connecting...</div>"; 333 responseString = responseString +
334 "<div id=\"connecting\" style=\"visibility:hidden\"><img src=\"/_img/sl_logo_rotate_black.gif\" align=\"absmiddle\"> Connecting...</div>";
326 335
327 responseString = responseString + "<div id=\"helplinks\">"; 336 responseString = responseString + "<div id=\"helplinks\">";
328 responseString = responseString + "<a href=\"http://www.secondlife.com/join/index.php\" target=\"_blank\">Create new account</a> | "; 337 responseString = responseString +
329 responseString = responseString + "<a href=\"http://www.secondlife.com/account/request.php\" target=\"_blank\">Forgot password?</a>"; 338 "<a href=\"http://www.secondlife.com/join/index.php\" target=\"_blank\">Create new account</a> | ";
339 responseString = responseString +
340 "<a href=\"http://www.secondlife.com/account/request.php\" target=\"_blank\">Forgot password?</a>";
330 responseString = responseString + "</div>"; 341 responseString = responseString + "</div>";
331 342
332 responseString = responseString + "<div id=\"channelinfo\"> " + keysvals["channel"] + " | " + keysvals["version"] + "=" + keysvals["lang"] + "</div>"; 343 responseString = responseString + "<div id=\"channelinfo\"> " + keysvals["channel"] + " | " +
344 keysvals["version"] + "=" + keysvals["lang"] + "</div>";
333 responseString = responseString + "</form>"; 345 responseString = responseString + "</form>";
334 responseString = responseString + "<script language=\"JavaScript\">"; 346 responseString = responseString + "<script language=\"JavaScript\">";
335 responseString = responseString + "document.getElementById('firstname_input').focus();"; 347 responseString = responseString + "document.getElementById('firstname_input').focus();";
@@ -359,7 +371,7 @@ namespace OpenSim.Framework.Servers
359 } 371 }
360 } // show_login_form == "TRUE" 372 } // show_login_form == "TRUE"
361 else 373 else
362 { 374 {
363 // show_login_form is present but FALSE 375 // show_login_form is present but FALSE
364 // 376 //
365 // The idea here is that we're telling the client to log in immediately here using the following information 377 // The idea here is that we're telling the client to log in immediately here using the following information
@@ -371,12 +383,14 @@ namespace OpenSim.Framework.Servers
371 // 383 //
372 384
373 response.StatusCode = 301; 385 response.StatusCode = 301;
374 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" + keysvals["lastname"] + "&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458"; 386 response.RedirectLocation = "secondlife:///app/login?first_name=" + keysvals["username"] + "&last_name=" +
375 387 keysvals["lastname"] +
388 "&location=home&grid=Other&web_login_key=796f2b2a-0131-41e4-af12-00f60c24c458";
389
376 response.OutputStream.Close(); 390 response.OutputStream.Close();
377 } // show_login_form == "FALSE" 391 } // show_login_form == "FALSE"
378
379 } 392 }
393
380 public void Start() 394 public void Start()
381 { 395 {
382 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server"); 396 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server");
@@ -422,4 +436,4 @@ namespace OpenSim.Framework.Servers
422 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path)); 436 m_streamHandlers.Remove(GetHandlerKey(httpMethod, path));
423 } 437 }
424 } 438 }
425} 439} \ No newline at end of file