aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
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
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')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs66
-rw-r--r--OpenSim/Framework/Servers/CheckSumServer.cs2
-rw-r--r--OpenSim/Framework/Servers/RestMethod.cs2
-rw-r--r--OpenSim/Framework/Servers/RestObjectPoster.cs8
-rw-r--r--OpenSim/Framework/Servers/RestObjectPosterResponse.cs14
-rw-r--r--OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs14
-rw-r--r--OpenSim/Framework/Servers/XmlRpcMethod.cs2
7 files changed, 60 insertions, 48 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
diff --git a/OpenSim/Framework/Servers/CheckSumServer.cs b/OpenSim/Framework/Servers/CheckSumServer.cs
index e3a5df3..47b3f24 100644
--- a/OpenSim/Framework/Servers/CheckSumServer.cs
+++ b/OpenSim/Framework/Servers/CheckSumServer.cs
@@ -124,4 +124,4 @@ namespace OpenSim.Framework.Servers
124 } 124 }
125 * } 125 * }
126 */ 126 */
127} 127} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/RestMethod.cs b/OpenSim/Framework/Servers/RestMethod.cs
index 34e2669..ce2239b 100644
--- a/OpenSim/Framework/Servers/RestMethod.cs
+++ b/OpenSim/Framework/Servers/RestMethod.cs
@@ -28,4 +28,4 @@
28namespace OpenSim.Framework.Servers 28namespace OpenSim.Framework.Servers
29{ 29{
30 public delegate string RestMethod(string request, string path, string param); 30 public delegate string RestMethod(string request, string path, string param);
31} 31} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/RestObjectPoster.cs b/OpenSim/Framework/Servers/RestObjectPoster.cs
index b1565f1..212361c 100644
--- a/OpenSim/Framework/Servers/RestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/RestObjectPoster.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -44,7 +44,7 @@ namespace OpenSim.Framework.Servers
44 44
45 public static void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj) 45 public static void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
46 { 46 {
47 Type type = typeof(TRequest); 47 Type type = typeof (TRequest);
48 48
49 WebRequest request = WebRequest.Create(requestUrl); 49 WebRequest request = WebRequest.Create(requestUrl);
50 request.Method = verb; 50 request.Method = verb;
@@ -62,7 +62,7 @@ namespace OpenSim.Framework.Servers
62 writer.Flush(); 62 writer.Flush();
63 } 63 }
64 64
65 int length = (int)buffer.Length; 65 int length = (int) buffer.Length;
66 request.ContentLength = length; 66 request.ContentLength = length;
67 67
68 Stream requestStream = request.GetRequestStream(); 68 Stream requestStream = request.GetRequestStream();
@@ -72,7 +72,7 @@ namespace OpenSim.Framework.Servers
72 72
73 private static void AsyncCallback(IAsyncResult result) 73 private static void AsyncCallback(IAsyncResult result)
74 { 74 {
75 WebRequest request = (WebRequest)result.AsyncState; 75 WebRequest request = (WebRequest) result.AsyncState;
76 using (WebResponse resp = request.EndGetResponse(result)) 76 using (WebResponse resp = request.EndGetResponse(result))
77 { 77 {
78 } 78 }
diff --git a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
index 9d1f819..2961e04 100644
--- a/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
+++ b/OpenSim/Framework/Servers/RestObjectPosterResponse.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -48,7 +48,7 @@ namespace OpenSim.Framework.Servers
48 48
49 public void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj) 49 public void BeginPostObject<TRequest>(string verb, string requestUrl, TRequest obj)
50 { 50 {
51 Type type = typeof(TRequest); 51 Type type = typeof (TRequest);
52 52
53 WebRequest request = WebRequest.Create(requestUrl); 53 WebRequest request = WebRequest.Create(requestUrl);
54 request.Method = verb; 54 request.Method = verb;
@@ -66,7 +66,7 @@ namespace OpenSim.Framework.Servers
66 writer.Flush(); 66 writer.Flush();
67 } 67 }
68 68
69 int length = (int)buffer.Length; 69 int length = (int) buffer.Length;
70 request.ContentLength = length; 70 request.ContentLength = length;
71 71
72 Stream requestStream = request.GetRequestStream(); 72 Stream requestStream = request.GetRequestStream();
@@ -76,12 +76,12 @@ namespace OpenSim.Framework.Servers
76 76
77 private void AsyncCallback(IAsyncResult result) 77 private void AsyncCallback(IAsyncResult result)
78 { 78 {
79 WebRequest request = (WebRequest)result.AsyncState; 79 WebRequest request = (WebRequest) result.AsyncState;
80 using (WebResponse resp = request.EndGetResponse(result)) 80 using (WebResponse resp = request.EndGetResponse(result))
81 { 81 {
82 TResponse deserial; 82 TResponse deserial;
83 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 83 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
84 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream()); 84 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
85 85
86 if (deserial != null && ResponseCallback != null) 86 if (deserial != null && ResponseCallback != null)
87 { 87 {
@@ -90,4 +90,4 @@ namespace OpenSim.Framework.Servers
90 } 90 }
91 } 91 }
92 } 92 }
93} 93} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
index 6338531..cfb585b 100644
--- a/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
+++ b/OpenSim/Framework/Servers/SynchronousRestObjectPoster.cs
@@ -1,4 +1,4 @@
1/* 1/*
2* Copyright (c) Contributors, http://opensimulator.org/ 2* Copyright (c) Contributors, http://opensimulator.org/
3* See CONTRIBUTORS.TXT for a full list of copyright holders. 3* See CONTRIBUTORS.TXT for a full list of copyright holders.
4* 4*
@@ -39,7 +39,7 @@ namespace OpenSim.Framework.Servers
39 { 39 {
40 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj) 40 public static TResponse BeginPostObject<TRequest, TResponse>(string verb, string requestUrl, TRequest obj)
41 { 41 {
42 Type type = typeof(TRequest); 42 Type type = typeof (TRequest);
43 43
44 WebRequest request = WebRequest.Create(requestUrl); 44 WebRequest request = WebRequest.Create(requestUrl);
45 request.Method = verb; 45 request.Method = verb;
@@ -57,7 +57,7 @@ namespace OpenSim.Framework.Servers
57 writer.Flush(); 57 writer.Flush();
58 } 58 }
59 59
60 int length = (int)buffer.Length; 60 int length = (int) buffer.Length;
61 request.ContentLength = length; 61 request.ContentLength = length;
62 62
63 Stream requestStream = request.GetRequestStream(); 63 Stream requestStream = request.GetRequestStream();
@@ -65,12 +65,10 @@ namespace OpenSim.Framework.Servers
65 TResponse deserial = default(TResponse); 65 TResponse deserial = default(TResponse);
66 using (WebResponse resp = request.GetResponse()) 66 using (WebResponse resp = request.GetResponse())
67 { 67 {
68 68 XmlSerializer deserializer = new XmlSerializer(typeof (TResponse));
69 XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); 69 deserial = (TResponse) deserializer.Deserialize(resp.GetResponseStream());
70 deserial = (TResponse)deserializer.Deserialize(resp.GetResponseStream());
71 } 70 }
72 return deserial; 71 return deserial;
73 } 72 }
74
75 } 73 }
76} 74} \ No newline at end of file
diff --git a/OpenSim/Framework/Servers/XmlRpcMethod.cs b/OpenSim/Framework/Servers/XmlRpcMethod.cs
index e4993e3..b156cdd 100644
--- a/OpenSim/Framework/Servers/XmlRpcMethod.cs
+++ b/OpenSim/Framework/Servers/XmlRpcMethod.cs
@@ -30,4 +30,4 @@ using Nwc.XmlRpc;
30namespace OpenSim.Framework.Servers 30namespace OpenSim.Framework.Servers
31{ 31{
32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request); 32 public delegate XmlRpcResponse XmlRpcMethod(XmlRpcRequest request);
33} 33} \ No newline at end of file