* Get the code up to speed with my -#dev e-mail example. (uncomment out lines 227 - 235 to test.

0.6.0-stable
Teravus Ovares 2008-09-30 05:39:52 +00:00
parent f6699892dc
commit 6ea5b515d0
3 changed files with 45 additions and 5 deletions

View File

@ -323,7 +323,8 @@ namespace OpenSim.Framework.Servers
OSHttpRequest request = new OSHttpRequest(context.Request); OSHttpRequest request = new OSHttpRequest(context.Request);
OSHttpResponse response = new OSHttpResponse(context.Response); OSHttpResponse response = new OSHttpResponse(context.Response);
context.Response.ProtocolVersion = new Version("1.0");
context.Response.KeepAlive = false;
// This is the REST agent interface. We require an agent to properly identify // This is the REST agent interface. We require an agent to properly identify
// itself. If the REST handler recognizes the prefix it will attempt to // itself. If the REST handler recognizes the prefix it will attempt to
// satisfy the request. If it is not recognizable, and no damage has occurred // satisfy the request. If it is not recognizable, and no damage has occurred
@ -991,11 +992,17 @@ namespace OpenSim.Framework.Servers
int responsecode = (int)responsedata["int_response_code"]; int responsecode = (int)responsedata["int_response_code"];
string responseString = (string)responsedata["str_response_string"]; string responseString = (string)responsedata["str_response_string"];
string contentType = (string)responsedata["content_type"]; string contentType = (string)responsedata["content_type"];
if (responsedata.ContainsKey("error_status_text"))
{
response.StatusDescription = (string)responsedata["error_status_text"];
}
if (responsedata.ContainsKey("keepalive")) if (responsedata.ContainsKey("keepalive"))
response.KeepAlive = true; {
bool keepalive = (bool)responsedata["keepalive"];
response.KeepAlive = keepalive;
}
//Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this //Even though only one other part of the entire code uses HTTPHandlers, we shouldn't expect this
//and should check for NullReferenceExceptions //and should check for NullReferenceExceptions
@ -1014,7 +1021,7 @@ namespace OpenSim.Framework.Servers
response.StatusCode = responsecode; response.StatusCode = responsecode;
} }
response.AddHeader("Content-type", contentType); response.AddHeader("Content-Type", contentType);
byte[] buffer; byte[] buffer;
@ -1121,12 +1128,18 @@ namespace OpenSim.Framework.Servers
if (!m_ssl) if (!m_ssl)
{ {
m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
//m_httpListener.Prefixes.Add("http://10.1.1.5:" + m_port + "/");
} }
else else
{ {
m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/"); m_httpListener.Prefixes.Add("https://+:" + (m_sslport) + "/");
m_httpListener.Prefixes.Add("http://+:" + m_port + "/"); m_httpListener.Prefixes.Add("http://+:" + m_port + "/");
} }
HttpListenerPrefixCollection prefixs = m_httpListener.Prefixes;
foreach (string prefix in prefixs)
System.Console.WriteLine("Listening on: " + prefix);
m_httpListener.Start(); m_httpListener.Start();
HttpListenerContext context; HttpListenerContext context;

View File

@ -200,6 +200,23 @@ namespace OpenSim.Framework.Servers
} }
} }
public Version ProtocolVersion
{
get
{
if (!HttpServer)
return _httpListenerResponse.ProtocolVersion;
return new Version("1.0");
}
set
{
if (!HttpServer)
_httpListenerResponse.ProtocolVersion = value;
}
}
/// <summary> /// <summary>
/// Return the output stream feeding the body. /// Return the output stream feeding the body.
/// </summary> /// </summary>

View File

@ -177,7 +177,7 @@ namespace OpenSim.Region.Environment.Modules.Framework
if (m_ids.ContainsKey(avatar.UUID)) if (m_ids.ContainsKey(avatar.UUID))
{ {
// close the event queue. // close the event queue.
m_ids[avatar.UUID] = -1; //m_ids[avatar.UUID] = -1;
} }
} }
} }
@ -224,6 +224,16 @@ namespace OpenSim.Region.Environment.Modules.Framework
lock (m_ids) lock (m_ids)
thisID = m_ids[agentID]; thisID = m_ids[agentID];
//if (element == null)
//{
// responsedata["int_response_code"] = 502;
// responsedata["content_type"] = "text/plain";
// responsedata["keepalive"] = false;
// responsedata["str_response_string"] = "Upstream error: ";
// responsedata["error_status_text"] = "Upstream error:";
// return responsedata;
//}
if (thisID == -1) // close-request if (thisID == -1) // close-request
{ {
responsedata["int_response_code"] = 502; responsedata["int_response_code"] = 502;