fixes a couple of issues i introduced yesterday, one of them MapBlock queries crashing.

0.6.0-stable
Dr Scofield 2008-07-15 11:46:13 +00:00
parent 4848dcf0e3
commit b77bcb6660
2 changed files with 56 additions and 55 deletions

View File

@ -151,7 +151,7 @@ namespace OpenSim.Framework.Servers
body.Flush(); body.Flush();
// and ship it back // and ship it back
resp.HttpResponse.Send(); resp.Send();
} }
} }
catch (Exception e) catch (Exception e)

View File

@ -62,7 +62,10 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? _httpResponse.ContentType : _contentType; if (HttpServer)
return _httpResponse.ContentType;
else
return _httpListenerResponse.ContentType;
} }
set set
{ {
@ -72,12 +75,11 @@ namespace OpenSim.Framework.Servers
} }
else else
{ {
_contentType = value; _httpListenerResponse.ContentType = value;
_contentTypeSet = true; _contentTypeSet = true;
} }
} }
} }
private string _contentType;
/// <summary> /// <summary>
/// Boolean property indicating whether the content type /// Boolean property indicating whether the content type
@ -100,20 +102,22 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? _httpResponse.ContentLength : _contentLength; if (HttpServer)
return _httpResponse.ContentLength;
else
return _httpListenerResponse.ContentLength64;
} }
set set
{ {
if (HttpServer) if (HttpServer)
_httpResponse.ContentLength = value; _httpResponse.ContentLength = value;
else else
_contentLength = value; _httpListenerResponse.ContentLength64 = value;
} }
} }
private long _contentLength;
/// <summary> /// <summary>
/// Aliases for ContentLength. /// Alias for ContentLength.
/// </summary> /// </summary>
public long ContentLength64 public long ContentLength64
{ {
@ -126,18 +130,22 @@ namespace OpenSim.Framework.Servers
/// </summary> /// </summary>
public Encoding ContentEncoding public Encoding ContentEncoding
{ {
get { get
return HttpServer ? _httpResponse.Encoding : _contentEncoding; {
if (HttpServer)
return _httpResponse.Encoding;
else
return _httpListenerResponse.ContentEncoding;
} }
set set
{ {
if (HttpServer) if (HttpServer)
_httpResponse.Encoding = value; _httpResponse.Encoding = value;
else else
_contentEncoding = value; _httpListenerResponse.ContentEncoding = value;
} }
} }
private Encoding _contentEncoding;
/// <summary> /// <summary>
/// Headers of the response. /// Headers of the response.
@ -146,10 +154,12 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? null : _headers; if (HttpServer)
return null;
else
return _httpListenerResponse.Headers;
} }
} }
private WebHeaderCollection _headers;
/// <summary> /// <summary>
/// Get or set the keep alive property. /// Get or set the keep alive property.
@ -161,17 +171,17 @@ namespace OpenSim.Framework.Servers
if (HttpServer) if (HttpServer)
return _httpResponse.Connection == ConnectionType.KeepAlive; return _httpResponse.Connection == ConnectionType.KeepAlive;
else else
return _keepAlive; return _httpListenerResponse.KeepAlive;
} }
set set
{ {
if (HttpServer) if (HttpServer)
_httpResponse.Connection = ConnectionType.KeepAlive; _httpResponse.Connection = ConnectionType.KeepAlive;
else else
_keepAlive = value; _httpListenerResponse.KeepAlive = value;
} }
} }
private bool _keepAlive;
/// <summary> /// <summary>
/// Return the output stream feeding the body. /// Return the output stream feeding the body.
@ -183,11 +193,12 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? _httpResponse.Body : _outputStream; if (HttpServer)
return _httpResponse.Body;
else
return _httpListenerResponse.OutputStream;
} }
} }
private Stream _outputStream;
/// <summary> /// <summary>
/// Return the output stream feeding the body. /// Return the output stream feeding the body.
@ -212,12 +223,10 @@ namespace OpenSim.Framework.Servers
{ {
if (HttpServer) if (HttpServer)
_httpResponse.Redirect(value); _httpResponse.Redirect(value);
// else else
// _redirectLocation = value; _httpListenerResponse.RedirectLocation = value;
} }
} }
// private string _redirectLocation;
/// <summary> /// <summary>
@ -227,7 +236,10 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? _httpResponse.Chunked :_sendChunked; if (HttpServer)
return _httpResponse.Chunked;
else
return _httpListenerResponse.SendChunked;
} }
set set
@ -235,11 +247,9 @@ namespace OpenSim.Framework.Servers
if (HttpServer) if (HttpServer)
_httpResponse.Chunked = value; _httpResponse.Chunked = value;
else else
_sendChunked = value; _httpListenerResponse.SendChunked = value;
} }
} }
private bool _sendChunked;
/// <summary> /// <summary>
/// HTTP status code. /// HTTP status code.
@ -248,7 +258,10 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? (int)_httpResponse.Status : _statusCode; if (HttpServer)
return (int)_httpResponse.Status;
else
return _httpListenerResponse.StatusCode;
} }
set set
@ -256,10 +269,9 @@ namespace OpenSim.Framework.Servers
if (HttpServer) if (HttpServer)
_httpResponse.Status = (HttpStatusCode)value; _httpResponse.Status = (HttpStatusCode)value;
else else
_statusCode = value; _httpListenerResponse.StatusCode = value;
} }
} }
private int _statusCode;
/// <summary> /// <summary>
@ -269,7 +281,10 @@ namespace OpenSim.Framework.Servers
{ {
get get
{ {
return HttpServer ? _httpResponse.Reason : _statusDescription; if (HttpServer)
return _httpResponse.Reason;
else
return _httpListenerResponse.StatusDescription;
} }
set set
@ -277,22 +292,22 @@ namespace OpenSim.Framework.Servers
if (HttpServer) if (HttpServer)
_httpResponse.Reason = value; _httpResponse.Reason = value;
else else
_statusDescription = value; _httpListenerResponse.StatusDescription = value;
} }
} }
private string _statusDescription;
private HttpResponse _httpResponse;
internal bool HttpServer internal bool HttpServer
{ {
get { return null != _httpResponse; } get { return null != _httpResponse; }
} }
private HttpResponse _httpResponse;
private HttpListenerResponse _httpListenerResponse;
internal HttpResponse HttpResponse // internal HttpResponse HttpResponse
{ // {
get { return _httpResponse; } // get { return _httpResponse; }
} // }
public OSHttpResponse() public OSHttpResponse()
{ {
@ -308,21 +323,7 @@ namespace OpenSim.Framework.Servers
/// </remarks> /// </remarks>
public OSHttpResponse(HttpListenerResponse resp) public OSHttpResponse(HttpListenerResponse resp)
{ {
_contentEncoding = resp.ContentEncoding; _httpListenerResponse = resp;
_contentLength = resp.ContentLength64;
_contentType = resp.ContentType;
_headers = resp.Headers;
// _cookies = resp.Cookies;
_keepAlive = resp.KeepAlive;
_outputStream = resp.OutputStream;
// _redirectLocation = resp.RedirectLocation;
_sendChunked = resp.SendChunked;
_statusCode = resp.StatusCode;
_statusDescription = resp.StatusDescription;
_contentTypeSet = false;
// _resp = resp;
} }
/// <summary> /// <summary>
@ -348,7 +349,7 @@ namespace OpenSim.Framework.Servers
if (HttpServer) if (HttpServer)
_httpResponse.AddHeader(key, value); _httpResponse.AddHeader(key, value);
else else
_headers.Add(key, value); _httpListenerResponse.Headers.Add(key, value);
} }
/// <summary> /// <summary>