* 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.ThreadPoolClientBranch
parent
b0904f471d
commit
a962653e04
|
@ -421,45 +421,44 @@ namespace OpenSim.Framework.UserManagement
|
||||||
|
|
||||||
if (keysvals.ContainsKey("show_login_form"))
|
if (keysvals.ContainsKey("show_login_form"))
|
||||||
{
|
{
|
||||||
if ((string)keysvals["show_login_form"] == "TRUE")
|
|
||||||
|
UserProfileData user = GetTheUser(firstname, lastname);
|
||||||
|
bool goodweblogin = false;
|
||||||
|
|
||||||
|
if (user != null)
|
||||||
|
goodweblogin = AuthenticateUser(user, password);
|
||||||
|
|
||||||
|
if (goodweblogin)
|
||||||
{
|
{
|
||||||
|
LLUUID webloginkey = LLUUID.Random();
|
||||||
|
m_userManager.StoreWebLoginKey(user.UUID, webloginkey);
|
||||||
|
statuscode = 301;
|
||||||
|
|
||||||
|
string redirectURL = "about:blank?redirect-http-hack=" + System.Web.HttpUtility.UrlEncode("secondlife:///app/login?first_name=" + firstname + "&last_name=" +
|
||||||
|
lastname +
|
||||||
|
"&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString());
|
||||||
|
//MainLog.Instance.Verbose("WEB", "R:" + redirectURL);
|
||||||
returnactions["int_response_code"] = statuscode;
|
returnactions["int_response_code"] = statuscode;
|
||||||
returnactions["str_response_string"] = loginform;
|
returnactions["str_redirect_location"] = redirectURL;
|
||||||
|
returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UserProfileData user = GetTheUser(firstname, lastname);
|
errormessages = "The Username and password supplied did not match our records. Check your caps lock and try again";
|
||||||
bool goodweblogin = false;
|
|
||||||
|
|
||||||
if (user != null)
|
loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages);
|
||||||
goodweblogin = AuthenticateUser(user, password);
|
returnactions["int_response_code"] = statuscode;
|
||||||
|
returnactions["str_response_string"] = loginform;
|
||||||
if (goodweblogin)
|
|
||||||
{
|
|
||||||
LLUUID webloginkey = LLUUID.Random();
|
|
||||||
m_userManager.StoreWebLoginKey(user.UUID, webloginkey);
|
|
||||||
statuscode = 301;
|
|
||||||
|
|
||||||
string redirectURL = "secondlife:///app/login?first_name=" + firstname + "&last_name=" +
|
|
||||||
lastname +
|
|
||||||
"&location=" + location + "&grid=Other&web_login_key=" + webloginkey.ToString();
|
|
||||||
|
|
||||||
returnactions["int_response_code"] = statuscode;
|
|
||||||
returnactions["str_redirect_location"] = redirectURL;
|
|
||||||
returnactions["str_response_string"] = "<HTML><BODY>GoodLogin</BODY></HTML>";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
errormessages = "The Username and password supplied did not match our records. Check your caps lock and try again";
|
|
||||||
|
|
||||||
loginform = GetLoginForm(firstname, lastname, location, region, grid, channel, version, lang, password, errormessages);
|
|
||||||
returnactions["int_response_code"] = statuscode;
|
|
||||||
returnactions["str_response_string"] = loginform;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
returnactions["int_response_code"] = statuscode;
|
||||||
|
returnactions["str_response_string"] = loginform;
|
||||||
}
|
}
|
||||||
return returnactions;
|
return returnactions;
|
||||||
|
|
||||||
|
@ -511,7 +510,7 @@ namespace OpenSim.Framework.UserManagement
|
||||||
responseString = responseString + "<body><br />";
|
responseString = responseString + "<body><br />";
|
||||||
responseString = responseString + "<div id=\"login_box\">";
|
responseString = responseString + "<div id=\"login_box\">";
|
||||||
|
|
||||||
responseString = responseString + "<form action=\"/\" method=\"GET\" id=\"login-form\">";
|
responseString = responseString + "<form action=\"/go.cgi\" method=\"GET\" id=\"login-form\">";
|
||||||
|
|
||||||
responseString = responseString + "<div id=\"message\">[$errors]</div>";
|
responseString = responseString + "<div id=\"message\">[$errors]</div>";
|
||||||
responseString = responseString + "<fieldset id=\"firstname\">";
|
responseString = responseString + "<fieldset id=\"firstname\">";
|
||||||
|
|
|
@ -381,6 +381,8 @@ namespace OpenSim.Framework.Servers
|
||||||
string responseString = String.Empty;
|
string responseString = String.Empty;
|
||||||
|
|
||||||
Hashtable keysvals = new Hashtable();
|
Hashtable keysvals = new Hashtable();
|
||||||
|
Hashtable headervals = new Hashtable();
|
||||||
|
string host = "";
|
||||||
|
|
||||||
string[] querystringkeys = request.QueryString.AllKeys;
|
string[] querystringkeys = request.QueryString.AllKeys;
|
||||||
string[] rHeaders = request.Headers.AllKeys;
|
string[] rHeaders = request.Headers.AllKeys;
|
||||||
|
@ -391,12 +393,23 @@ namespace OpenSim.Framework.Servers
|
||||||
keysvals.Add(queryname, request.QueryString[queryname]);
|
keysvals.Add(queryname, request.QueryString[queryname]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (string headername in rHeaders)
|
||||||
|
{
|
||||||
|
//MainLog.Instance.Warn("HEADER", headername + "=" + request.Headers[headername]);
|
||||||
|
headervals[headername] = request.Headers[headername];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (headervals.Contains("Host"))
|
||||||
|
{
|
||||||
|
host = (string)headervals["Host"];
|
||||||
|
}
|
||||||
|
|
||||||
if (keysvals.Contains("method"))
|
if (keysvals.Contains("method"))
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("HTTP", "Contains Method");
|
//MainLog.Instance.Warn("HTTP", "Contains Method");
|
||||||
string method = (string) keysvals["method"];
|
string method = (string) keysvals["method"];
|
||||||
MainLog.Instance.Warn("HTTP", requestBody);
|
//MainLog.Instance.Warn("HTTP", requestBody);
|
||||||
GenericHTTPMethod requestprocessor;
|
GenericHTTPMethod requestprocessor;
|
||||||
bool foundHandler = TryGetHTTPHandler(method, out requestprocessor);
|
bool foundHandler = TryGetHTTPHandler(method, out requestprocessor);
|
||||||
if (foundHandler)
|
if (foundHandler)
|
||||||
|
@ -409,14 +422,14 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("HTTP", "Handler Not Found");
|
//MainLog.Instance.Warn("HTTP", "Handler Not Found");
|
||||||
SendHTML404(response);
|
SendHTML404(response, host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MainLog.Instance.Warn("HTTP", "No Method specified");
|
//MainLog.Instance.Warn("HTTP", "No Method specified");
|
||||||
SendHTML404(response);
|
SendHTML404(response, host);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,13 +470,13 @@ namespace OpenSim.Framework.Servers
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public void SendHTML404(HttpListenerResponse response)
|
public void SendHTML404(HttpListenerResponse response, string host)
|
||||||
{
|
{
|
||||||
// I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
|
// I know this statuscode is dumb, but the client doesn't respond to 404s and 500s
|
||||||
response.StatusCode = 200;
|
response.StatusCode = 200;
|
||||||
response.AddHeader("Content-type", "text/html");
|
response.AddHeader("Content-type", "text/html");
|
||||||
|
|
||||||
string responseString = GetHTTP404();
|
string responseString = GetHTTP404(host);
|
||||||
byte[] buffer = Encoding.UTF8.GetBytes(responseString);
|
byte[] buffer = Encoding.UTF8.GetBytes(responseString);
|
||||||
|
|
||||||
response.SendChunked = false;
|
response.SendChunked = false;
|
||||||
|
@ -558,11 +571,11 @@ namespace OpenSim.Framework.Servers
|
||||||
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
|
m_HTTPHandlers.Remove(GetHandlerKey(httpMethod, path));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetHTTP404()
|
public string GetHTTP404(string host)
|
||||||
{
|
{
|
||||||
string file = Path.Combine(Util.configDir(), "http_404.html");
|
string file = Path.Combine(Util.configDir(), "http_404.html");
|
||||||
if (!File.Exists(file))
|
if (!File.Exists(file))
|
||||||
return getDefaultHTTP404();
|
return getDefaultHTTP404(host);
|
||||||
|
|
||||||
StreamReader sr = File.OpenText(file);
|
StreamReader sr = File.OpenText(file);
|
||||||
string result = sr.ReadToEnd();
|
string result = sr.ReadToEnd();
|
||||||
|
@ -583,9 +596,9 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback HTTP responses in case the HTTP error response files don't exist
|
// Fallback HTTP responses in case the HTTP error response files don't exist
|
||||||
private string getDefaultHTTP404()
|
private string getDefaultHTTP404(string host)
|
||||||
{
|
{
|
||||||
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>";
|
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>";
|
||||||
}
|
}
|
||||||
|
|
||||||
private string getDefaultHTTP500()
|
private string getDefaultHTTP500()
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<body><br />
|
<body><br />
|
||||||
<div id="login_box">
|
<div id="login_box">
|
||||||
|
|
||||||
<form action="/" method="GET" id="login-form">
|
<form action="/go.cgi" method="GET" id="login-form">
|
||||||
|
|
||||||
<div id="message">[$errors]</div>
|
<div id="message">[$errors]</div>
|
||||||
<fieldset id="firstname">
|
<fieldset id="firstname">
|
||||||
|
|
Loading…
Reference in New Issue