aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-24 23:35:30 +0000
committerTeravus Ovares2007-12-24 23:35:30 +0000
commit69cc4596b1d430fcfaffd8a052c40e9af5b5f056 (patch)
tree070866a8abe17942e500cbb0534617e531a235fc
parentPrim inventory script saving phase 1. Create necessary CAPS structures for c... (diff)
downloadopensim-SC-69cc4596b1d430fcfaffd8a052c40e9af5b5f056.zip
opensim-SC-69cc4596b1d430fcfaffd8a052c40e9af5b5f056.tar.gz
opensim-SC-69cc4596b1d430fcfaffd8a052c40e9af5b5f056.tar.bz2
opensim-SC-69cc4596b1d430fcfaffd8a052c40e9af5b5f056.tar.xz
* Added some ugly hackish code to the user server to start implementing the new login method. You still can't yet log-in via the new method. Does not interfere with normal userserver operation, ie safe to update if you want.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/BaseHttpServer.cs134
1 files changed, 134 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs
index ede425d..d865ae8 100644
--- a/OpenSim/Framework/Servers/BaseHttpServer.cs
+++ b/OpenSim/Framework/Servers/BaseHttpServer.cs
@@ -97,6 +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 response.KeepAlive = false; 102 response.KeepAlive = false;
102 response.SendChunked = false; 103 response.SendChunked = false;
@@ -186,7 +187,30 @@ namespace OpenSim.Framework.Servers
186 } 187 }
187 catch (XmlException e) 188 catch (XmlException e)
188 { 189 {
190 Hashtable keysvals = new Hashtable();
189 responseString = String.Format("XmlException:\n{0}", e.Message); 191 responseString = String.Format("XmlException:\n{0}", e.Message);
192 MainLog.Instance.Error("XML", responseString);
193 string[] querystringkeys = request.QueryString.AllKeys;
194 string[] rHeaders = request.Headers.AllKeys;
195
196
197
198
199 foreach (string queryname in querystringkeys)
200 {
201 keysvals.Add(queryname, request.QueryString[queryname]);
202 MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]);
203
204 }
205 foreach (string headername in rHeaders)
206 {
207 MainLog.Instance.Warn("HEADER", headername + "=" + request.Headers[headername]);
208 }
209 if (keysvals.ContainsKey("show_login_form"))
210 {
211 HandleHTTPRequest(keysvals, request, response);
212 return;
213 }
190 } 214 }
191 215
192 if (xmlRprcRequest != null) 216 if (xmlRprcRequest != null)
@@ -242,7 +266,117 @@ namespace OpenSim.Framework.Servers
242 response.OutputStream.Close(); 266 response.OutputStream.Close();
243 } 267 }
244 } 268 }
269 public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response)
270 {
271 // 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.
273 //
274 // For this test to work, I used the following secondlife.exe parameters
275 // "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
276 //
277 // Even after all that, there's still an error, but it's a start.
278 //
279 // I depend on show_login_form being in the secondlife.exe parameters to figure out
280 // to display the form, or process it.
281 // a better way would be nifty.
282
283 if ((string)keysvals["show_login_form"] == "TRUE")
284 {
285 string responseString = "<!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\">";
287 responseString = responseString + "<head>";
288 responseString = responseString + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />";
289 responseString = responseString + "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
290 responseString = responseString + "<meta http-equiv=\"Pragma\" content=\"no-cache\">";
291 responseString = responseString + "<title>Second Life Login</title>";
292 responseString = responseString + "<body>";
293 responseString = responseString + "<div id=\"login_box\">";
294 // Linden Grid Form Post
295 //responseString = responseString + "<form action=\"https://secure-web16.secondlife.com/app/login/go.php?show_login_form=True&show_grid=&show_start_location=\" method=\"POST\" id=\"login-form\">";
296 responseString = responseString + "<form action=\"/\" method=\"GET\" id=\"login-form\">";
297
298 responseString = responseString + "<div id=\"message\">";
299 responseString = responseString + "</div>";
300 responseString = responseString + "<fieldset id=\"firstname\">";
301 responseString = responseString + "<legend>First Name:</legend>";
302 responseString = responseString + "<input type=\"text\" id=\"firstname_input\" size=\"15\" maxlength=\"100\" name=\"username\" value=\"" + keysvals["username"] + "\" />";
303 responseString = responseString + "</fieldset>";
304 responseString = responseString + "<fieldset id=\"lastname\">";
305 responseString = responseString + "<legend>Last Name:</legend>";
306 responseString = responseString + "<input type=\"text\" size=\"15\" maxlength=\"100\" name=\"lastname\" value=\"" + keysvals["lastname"] + "\" />";
307 responseString = responseString + "</fieldset>";
308 responseString = responseString + "<fieldset id=\"password\">";
309 responseString = responseString + "<legend>Password:</legend>";
310 responseString = responseString + "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\">";
311 responseString = responseString + "<tr>";
312 responseString = responseString + "<td colspan=\"2\"><input type=\"password\" size=\"15\" maxlength=\"100\" name=\"password\" value=\"" + keysvals["password"] + "\" /></td>";
313 responseString = responseString + "</tr>";
314 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>";
316 responseString = responseString + "<td><label for=\"remember_password\">Remember password</label></td>";
317 responseString = responseString + "</tr>";
318 responseString = responseString + "</table>";
319 responseString = responseString + "</fieldset>";
320 responseString = responseString + "<input type=\"hidden\" name=\"show_login_form\" value=\"FALSE\" />";
321 responseString = responseString + "<input type=\"hidden\" id=\"grid\" name=\"grid\" value=\"" + keysvals["grid"] + "\" />";
322 responseString = responseString + "<div id=\"submitbtn\">";
323 responseString = responseString + "<input class=\"input_over\" type=\"submit\" value=\"Connect\" />";
324 responseString = responseString + "</div>";
325 responseString = responseString + "<div id=\"connecting\" style=\"visibility:hidden\"><img src=\"/_img/sl_logo_rotate_black.gif\" align=\"absmiddle\"> Connecting...</div>";
326
327 responseString = responseString + "<div id=\"helplinks\">";
328 responseString = responseString + "<a href=\"http://www.secondlife.com/join/index.php\" target=\"_blank\">Create new account</a> | ";
329 responseString = responseString + "<a href=\"http://www.secondlife.com/account/request.php\" target=\"_blank\">Forgot password?</a>";
330 responseString = responseString + "</div>";
331
332 responseString = responseString + "<div id=\"channelinfo\"> " + keysvals["channel"] + " | " + keysvals["version"] + "=" + keysvals["lang"] + "</div>";
333 responseString = responseString + "</form>";
334 responseString = responseString + "<script language=\"JavaScript\">";
335 responseString = responseString + "document.getElementById('firstname_input').focus();";
336 responseString = responseString + "</script>";
337 responseString = responseString + "</div>";
338 responseString = responseString + "</div>";
339 responseString = responseString + "</body>";
340 responseString = responseString + "</html>";
341 response.AddHeader("Content-type", "text/html");
342
343 byte[] buffer = Encoding.UTF8.GetBytes(responseString);
344
345 response.SendChunked = false;
346 response.ContentLength64 = buffer.Length;
347 response.ContentEncoding = Encoding.UTF8;
348 try
349 {
350 response.OutputStream.Write(buffer, 0, buffer.Length);
351 }
352 catch (Exception ex)
353 {
354 MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message);
355 }
356 finally
357 {
358 response.OutputStream.Close();
359 }
360 } // show_login_form == "TRUE"
361 else
362 {
363 // show_login_form is present but FALSE
364 //
365 // The idea here is that we're telling the client to log in immediately here using the following information
366 // For my testing, I'm hard coding the web_login_key temporarily.
367 // Telling the client to go to the new improved SLURL for immediate logins
245 368
369 // The fact that it says grid=Other is important
370
371 //
372
373 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";
375
376 response.OutputStream.Close();
377 } // show_login_form == "FALSE"
378
379 }
246 public void Start() 380 public void Start()
247 { 381 {
248 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server"); 382 MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server");