diff options
author | Teravus Ovares | 2008-01-10 04:37:03 +0000 |
---|---|---|
committer | Teravus Ovares | 2008-01-10 04:37:03 +0000 |
commit | a962653e04e8b1d06b36224bf20e85b3462197db (patch) | |
tree | 6e16786281d0b8384b9d80e45d78c3b6ff14a01b | |
parent | Fix r2959 - last letter was being sliced off region prim renames (diff) | |
download | opensim-SC-a962653e04e8b1d06b36224bf20e85b3462197db.zip opensim-SC-a962653e04e8b1d06b36224bf20e85b3462197db.tar.gz opensim-SC-a962653e04e8b1d06b36224bf20e85b3462197db.tar.bz2 opensim-SC-a962653e04e8b1d06b36224bf20e85b3462197db.tar.xz |
* After fighting with it a bit more, Opensim is now compatible with the most recent release client(RC) on the linden labs download page.
* Don't forget, you need -loginuri *and* -loginpage
* Ex: -loginpage http://10.1.1.2:8002/?method=login -loginuri http://10.1.1.2:8002/
* The ?method=login is important, don't forget to add it
* If you customize your http_loginform.html file, be sure to keep the form post address as is.
-rw-r--r-- | OpenSim/Framework/Communications/LoginService.cs | 61 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 39 | ||||
-rw-r--r-- | bin/http_loginform.html.example | 2 |
3 files changed, 57 insertions, 45 deletions
diff --git a/OpenSim/Framework/Communications/LoginService.cs b/OpenSim/Framework/Communications/LoginService.cs index 04b8501..8317073 100644 --- a/OpenSim/Framework/Communications/LoginService.cs +++ b/OpenSim/Framework/Communications/LoginService.cs | |||
@@ -421,45 +421,44 @@ namespace OpenSim.Framework.UserManagement | |||
421 | 421 | ||
422 | if (keysvals.ContainsKey("show_login_form")) | 422 | if (keysvals.ContainsKey("show_login_form")) |
423 | { | 423 | { |
424 | if ((string)keysvals["show_login_form"] == "TRUE") | 424 | |
425 | UserProfileData user = GetTheUser(firstname, lastname); | ||
426 | bool goodweblogin = false; | ||
427 | |||
428 | if (user != null) | ||
429 | goodweblogin = AuthenticateUser(user, password); | ||
430 | |||
431 | if (goodweblogin) | ||
425 | { | 432 | { |
433 | LLUUID webloginkey = LLUUID.Random(); | ||
434 | m_userManager.StoreWebLoginKey(user.UUID, webloginkey); | ||
435 | statuscode = 301; | ||
436 | |||
437 | string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" + | ||
438 | lastname + | ||
439 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString()); | ||
440 | //MainLog.Instance.Verbose("WEB", "R:" + redirectURL); | ||
426 | returnactions["int_response_code"] = statuscode; | 441 | returnactions["int_response_code"] = statuscode; |
427 | returnactions["str_response_string"] = loginform; | 442 | returnactions["str_redirect_location"] = redirectURL; |
443 | returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>"; | ||
428 | } | 444 | } |
429 | else | 445 | else |
430 | { | 446 | { |
431 | UserProfileData user = GetTheUser(firstname, lastname); | 447 | errormessages = "The Username and password supplied did not match our records. Check your caps lock and try again"; |
432 | bool goodweblogin = false; | ||
433 | |||
434 | if (user != null) | ||
435 | goodweblogin = AuthenticateUser(user, password); | ||
436 | 448 | ||
437 | if (goodweblogin) | 449 | loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); |
438 | { | 450 | returnactions["int_response_code"] = statuscode; |
439 | LLUUID webloginkey = LLUUID.Random(); | 451 | returnactions["str_response_string"] = loginform; |
440 | m_userManager.StoreWebLoginKey(user.UUID, webloginkey); | ||
441 | statuscode = 301; | ||
442 | |||
443 | string redirectURL = "secondlife:///app/login?first_name=" + firstname + "&last_name=" + | ||
444 | lastname + | ||
445 | "&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString(); | ||
446 | |||
447 | returnactions["int_response_code"] = statuscode; | ||
448 | returnactions["str_redirect_location"] = redirectURL; | ||
449 | returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>"; | ||
450 | } | ||
451 | else | ||
452 | { | ||
453 | errormessages = "The Username and password supplied did not match our records. Check your caps lock and try again"; | ||
454 | |||
455 | loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages); | ||
456 | returnactions["int_response_code"] = statuscode; | ||
457 | returnactions["str_response_string"] = loginform; | ||
458 | |||
459 | } | ||
460 | 452 | ||
461 | } | 453 | } |
462 | 454 | ||
455 | |||
456 | |||
457 | } | ||
458 | else | ||
459 | { | ||
460 | returnactions["int_response_code"] = statuscode; | ||
461 | returnactions["str_response_string"] = loginform; | ||
463 | } | 462 | } |
464 | return returnactions; | 463 | return returnactions; |
465 | 464 | ||
@@ -511,7 +510,7 @@ namespace OpenSim.Framework.UserManagement | |||
511 | responseString = responseString + "<body><br />"; | 510 | responseString = responseString + "<body><br />"; |
512 | responseString = responseString + "<div id=\"login_box\">"; | 511 | responseString = responseString + "<div id=\"login_box\">"; |
513 | 512 | ||
514 | responseString = responseString + "<form action=\"/\" method=\"GET\" id=\"login-form\">"; | 513 | responseString = responseString + "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">"; |
515 | 514 | ||
516 | responseString = responseString + "<div id=\"message\">[$errors]</div>"; | 515 | responseString = responseString + "<div id=\"message\">[$errors]</div>"; |
517 | responseString = responseString + "<fieldset id=\"firstname\">"; | 516 | responseString = responseString + "<fieldset id=\"firstname\">"; |
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 3ca4187..78554c3 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -381,6 +381,8 @@ namespace OpenSim.Framework.Servers | |||
381 | string responseString = String.Empty; | 381 | string responseString = String.Empty; |
382 | 382 | ||
383 | Hashtable keysvals = new Hashtable(); | 383 | Hashtable keysvals = new Hashtable(); |
384 | Hashtable headervals = new Hashtable(); | ||
385 | string host = ""; | ||
384 | 386 | ||
385 | string[] querystringkeys = request.QueryString.AllKeys; | 387 | string[] querystringkeys = request.QueryString.AllKeys; |
386 | string[] rHeaders = request.Headers.AllKeys; | 388 | string[] rHeaders = request.Headers.AllKeys; |
@@ -391,12 +393,23 @@ namespace OpenSim.Framework.Servers | |||
391 | keysvals.Add(queryname, request.QueryString[queryname]); | 393 | keysvals.Add(queryname, request.QueryString[queryname]); |
392 | 394 | ||
393 | } | 395 | } |
394 | 396 | ||
397 | foreach (string headername in rHeaders) | ||
398 | { | ||
399 | //MainLog.Instance.Warn("HEADER", headername + "=" + request.Headers[headername]); | ||
400 | headervals[headername] = request.Headers[headername]; | ||
401 | } | ||
402 | |||
403 | if (headervals.Contains("Host")) | ||
404 | { | ||
405 | host = (string)headervals["Host"]; | ||
406 | } | ||
407 | |||
395 | if (keysvals.Contains("method")) | 408 | if (keysvals.Contains("method")) |
396 | { | 409 | { |
397 | MainLog.Instance.Warn("HTTP", "Contains Method"); | 410 | //MainLog.Instance.Warn("HTTP", "Contains Method"); |
398 | string method = (string) keysvals["method"]; | 411 | string method = (string) keysvals["method"]; |
399 | MainLog.Instance.Warn("HTTP", requestBody); | 412 | //MainLog.Instance.Warn("HTTP", requestBody); |
400 | GenericHTTPMethod requestprocessor; | 413 | GenericHTTPMethod requestprocessor; |
401 | bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); | 414 | bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); |
402 | if (foundHandler) | 415 | if (foundHandler) |
@@ -409,14 +422,14 @@ namespace OpenSim.Framework.Servers | |||
409 | } | 422 | } |
410 | else | 423 | else |
411 | { | 424 | { |
412 | MainLog.Instance.Warn("HTTP", "Handler Not Found"); | 425 | //MainLog.Instance.Warn("HTTP", "Handler Not Found"); |
413 | SendHTML404(response); | 426 | SendHTML404(response, host); |
414 | } | 427 | } |
415 | } | 428 | } |
416 | else | 429 | else |
417 | { | 430 | { |
418 | MainLog.Instance.Warn("HTTP", "No Method specified"); | 431 | //MainLog.Instance.Warn("HTTP", "No Method specified"); |
419 | SendHTML404(response); | 432 | SendHTML404(response, host); |
420 | } | 433 | } |
421 | } | 434 | } |
422 | 435 | ||
@@ -457,13 +470,13 @@ namespace OpenSim.Framework.Servers | |||
457 | 470 | ||
458 | 471 | ||
459 | } | 472 | } |
460 | public void SendHTML404(HttpListenerResponse response) | 473 | public void SendHTML404(HttpListenerResponse response, string host) |
461 | { | 474 | { |
462 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s | 475 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s |
463 | response.StatusCode = 200; | 476 | response.StatusCode = 200; |
464 | response.AddHeader("Content-type", "text/html"); | 477 | response.AddHeader("Content-type", "text/html"); |
465 | 478 | ||
466 | string responseString = GetHTTP404(); | 479 | string responseString = GetHTTP404(host); |
467 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); | 480 | byte[] buffer = Encoding.UTF8.GetBytes(responseString); |
468 | 481 | ||
469 | response.SendChunked = false; | 482 | response.SendChunked = false; |
@@ -558,11 +571,11 @@ namespace OpenSim.Framework.Servers | |||
558 | m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); | 571 | m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path)); |
559 | } | 572 | } |
560 | 573 | ||
561 | public string GetHTTP404() | 574 | public string GetHTTP404(string host) |
562 | { | 575 | { |
563 | string file = Path.Combine(Util.configDir(), "http_404.html"); | 576 | string file = Path.Combine(Util.configDir(), "http_404.html"); |
564 | if (!File.Exists(file)) | 577 | if (!File.Exists(file)) |
565 | return getDefaultHTTP404(); | 578 | return getDefaultHTTP404(host); |
566 | 579 | ||
567 | StreamReader sr = File.OpenText(file); | 580 | StreamReader sr = File.OpenText(file); |
568 | string result = sr.ReadToEnd(); | 581 | string result = sr.ReadToEnd(); |
@@ -583,9 +596,9 @@ namespace OpenSim.Framework.Servers | |||
583 | } | 596 | } |
584 | 597 | ||
585 | // Fallback HTTP responses in case the HTTP error response files don't exist | 598 | // Fallback HTTP responses in case the HTTP error response files don't exist |
586 | private string getDefaultHTTP404() | 599 | private string getDefaultHTTP404(string host) |
587 | { | 600 | { |
588 | return "<HTML><HEAD><TITLE>404 Page not found</TITLE><BODY><BR /><H1>Ooops!</H1><P>The page you requested has been obsconded with by knomes. Find hippos quick!</P></BODY></HTML>"; | 601 | return "<HTML><HEAD><TITLE>404 Page not found</TITLE><BODY><BR /><H1>Ooops!</H1><P>The page you requested has been obsconded with by knomes. Find hippos quick!</P><P>If you are trying to log-in, your link parameters should have: "-loginpage http://" + host + "/?method=login -loginuri http://" + host + "/" in your link </P></BODY></HTML>"; |
589 | } | 602 | } |
590 | 603 | ||
591 | private string getDefaultHTTP500() | 604 | private string getDefaultHTTP500() |
diff --git a/bin/http_loginform.html.example b/bin/http_loginform.html.example index 16655de..41a1083 100644 --- a/bin/http_loginform.html.example +++ b/bin/http_loginform.html.example | |||
@@ -8,7 +8,7 @@ | |||
8 | <body><br /> | 8 | <body><br /> |
9 | <div id="login_box"> | 9 | <div id="login_box"> |
10 | 10 | ||
11 | <form action="/" method="GET" id="login-form"> | 11 | <form action="/go.cgi" method="GET" id="login-form"> |
12 | 12 | ||
13 | <div id="message">[$errors]</div> | 13 | <div id="message">[$errors]</div> |
14 | <fieldset id="firstname"> | 14 | <fieldset id="firstname"> |