diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index ede425d7c4..d865ae8288 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs @@ -97,6 +97,7 @@ namespace OpenSim.Framework.Servers HttpListenerRequest request = context.Request; HttpListenerResponse response = context.Response; + response.KeepAlive = false; response.SendChunked = false; @@ -186,7 +187,30 @@ namespace OpenSim.Framework.Servers } catch (XmlException e) { + Hashtable keysvals = new Hashtable(); responseString = String.Format("XmlException:\n{0}", e.Message); + MainLog.Instance.Error("XML", responseString); + string[] querystringkeys = request.QueryString.AllKeys; + string[] rHeaders = request.Headers.AllKeys; + + + + + foreach (string queryname in querystringkeys) + { + keysvals.Add(queryname, request.QueryString[queryname]); + MainLog.Instance.Warn("HTTP", queryname + "=" + request.QueryString[queryname]); + + } + foreach (string headername in rHeaders) + { + MainLog.Instance.Warn("HEADER", headername + "=" + request.Headers[headername]); + } + if (keysvals.ContainsKey("show_login_form")) + { + HandleHTTPRequest(keysvals, request, response); + return; + } } if (xmlRprcRequest != null) @@ -242,7 +266,117 @@ namespace OpenSim.Framework.Servers response.OutputStream.Close(); } } + public void HandleHTTPRequest(Hashtable keysvals, HttpListenerRequest request, HttpListenerResponse response) + { + // This is a test. There's a workable alternative.. as this way sucks. + // We'd like to put this into a text file parhaps that's easily editable. + // + // For this test to work, I used the following secondlife.exe parameters + // "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 + // + // Even after all that, there's still an error, but it's a start. + // + // I depend on show_login_form being in the secondlife.exe parameters to figure out + // to display the form, or process it. + // a better way would be nifty. + if ((string)keysvals["show_login_form"] == "TRUE") + { + string responseString = ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + "Second Life Login"; + responseString = responseString + ""; + responseString = responseString + "
"; + // Linden Grid Form Post + //responseString = responseString + "
"; + responseString = responseString + ""; + + responseString = responseString + "
"; + responseString = responseString + "
"; + responseString = responseString + "
"; + responseString = responseString + "First Name:"; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + "
"; + responseString = responseString + "Last Name:"; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + "
"; + responseString = responseString + "Password:"; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + "
"; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + "
Connecting...
"; + + responseString = responseString + "
"; + responseString = responseString + "Create new account | "; + responseString = responseString + "Forgot password?"; + responseString = responseString + "
"; + + responseString = responseString + "
" + keysvals["channel"] + " | " + keysvals["version"] + "=" + keysvals["lang"] + "
"; + responseString = responseString + "
"; + responseString = responseString + ""; + responseString = responseString + "
"; + responseString = responseString + ""; + responseString = responseString + ""; + responseString = responseString + ""; + response.AddHeader("Content-type", "text/html"); + + byte[] buffer = Encoding.UTF8.GetBytes(responseString); + + response.SendChunked = false; + response.ContentLength64 = buffer.Length; + response.ContentEncoding = Encoding.UTF8; + try + { + response.OutputStream.Write(buffer, 0, buffer.Length); + } + catch (Exception ex) + { + MainLog.Instance.Warn("HTTPD", "Error - " + ex.Message); + } + finally + { + response.OutputStream.Close(); + } + } // show_login_form == "TRUE" + else + { + // show_login_form is present but FALSE + // + // The idea here is that we're telling the client to log in immediately here using the following information + // For my testing, I'm hard coding the web_login_key temporarily. + // Telling the client to go to the new improved SLURL for immediate logins + + // The fact that it says grid=Other is important + + // + + response.StatusCode = 301; + 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"; + + response.OutputStream.Close(); + } // show_login_form == "FALSE" + + } public void Start() { MainLog.Instance.Verbose("HTTPD", "Starting up HTTP Server");