From b77bcb6660b5ebd5d6f00ada6ccc695033483877 Mon Sep 17 00:00:00 2001
From: Dr Scofield
Date: Tue, 15 Jul 2008 11:46:13 +0000
Subject: fixes a couple of issues i introduced yesterday, one of them MapBlock
queries crashing.
---
OpenSim/Framework/Servers/OSHttpRequestPump.cs | 2 +-
OpenSim/Framework/Servers/OSHttpResponse.cs | 109 +++++++++++++------------
2 files changed, 56 insertions(+), 55 deletions(-)
diff --git a/OpenSim/Framework/Servers/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
index 56714fa..9d0ffc1 100644
--- a/OpenSim/Framework/Servers/OSHttpRequestPump.cs
+++ b/OpenSim/Framework/Servers/OSHttpRequestPump.cs
@@ -151,7 +151,7 @@ namespace OpenSim.Framework.Servers
body.Flush();
// and ship it back
- resp.HttpResponse.Send();
+ resp.Send();
}
}
catch (Exception e)
diff --git a/OpenSim/Framework/Servers/OSHttpResponse.cs b/OpenSim/Framework/Servers/OSHttpResponse.cs
index d93124b..eb7e400 100644
--- a/OpenSim/Framework/Servers/OSHttpResponse.cs
+++ b/OpenSim/Framework/Servers/OSHttpResponse.cs
@@ -62,7 +62,10 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? _httpResponse.ContentType : _contentType;
+ if (HttpServer)
+ return _httpResponse.ContentType;
+ else
+ return _httpListenerResponse.ContentType;
}
set
{
@@ -72,12 +75,11 @@ namespace OpenSim.Framework.Servers
}
else
{
- _contentType = value;
+ _httpListenerResponse.ContentType = value;
_contentTypeSet = true;
}
}
}
- private string _contentType;
///
/// Boolean property indicating whether the content type
@@ -100,20 +102,22 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? _httpResponse.ContentLength : _contentLength;
+ if (HttpServer)
+ return _httpResponse.ContentLength;
+ else
+ return _httpListenerResponse.ContentLength64;
}
set
{
if (HttpServer)
_httpResponse.ContentLength = value;
else
- _contentLength = value;
+ _httpListenerResponse.ContentLength64 = value;
}
}
- private long _contentLength;
///
- /// Aliases for ContentLength.
+ /// Alias for ContentLength.
///
public long ContentLength64
{
@@ -126,18 +130,22 @@ namespace OpenSim.Framework.Servers
///
public Encoding ContentEncoding
{
- get {
- return HttpServer ? _httpResponse.Encoding : _contentEncoding;
+ get
+ {
+ if (HttpServer)
+ return _httpResponse.Encoding;
+ else
+ return _httpListenerResponse.ContentEncoding;
}
+
set
{
if (HttpServer)
_httpResponse.Encoding = value;
else
- _contentEncoding = value;
+ _httpListenerResponse.ContentEncoding = value;
}
}
- private Encoding _contentEncoding;
///
/// Headers of the response.
@@ -146,10 +154,12 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? null : _headers;
+ if (HttpServer)
+ return null;
+ else
+ return _httpListenerResponse.Headers;
}
}
- private WebHeaderCollection _headers;
///
/// Get or set the keep alive property.
@@ -161,17 +171,17 @@ namespace OpenSim.Framework.Servers
if (HttpServer)
return _httpResponse.Connection == ConnectionType.KeepAlive;
else
- return _keepAlive;
+ return _httpListenerResponse.KeepAlive;
}
+
set
{
if (HttpServer)
_httpResponse.Connection = ConnectionType.KeepAlive;
else
- _keepAlive = value;
+ _httpListenerResponse.KeepAlive = value;
}
}
- private bool _keepAlive;
///
/// Return the output stream feeding the body.
@@ -183,11 +193,12 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? _httpResponse.Body : _outputStream;
+ if (HttpServer)
+ return _httpResponse.Body;
+ else
+ return _httpListenerResponse.OutputStream;
}
}
- private Stream _outputStream;
-
///
/// Return the output stream feeding the body.
@@ -212,12 +223,10 @@ namespace OpenSim.Framework.Servers
{
if (HttpServer)
_httpResponse.Redirect(value);
- // else
- // _redirectLocation = value;
+ else
+ _httpListenerResponse.RedirectLocation = value;
}
}
- // private string _redirectLocation;
-
///
@@ -227,7 +236,10 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? _httpResponse.Chunked :_sendChunked;
+ if (HttpServer)
+ return _httpResponse.Chunked;
+ else
+ return _httpListenerResponse.SendChunked;
}
set
@@ -235,11 +247,9 @@ namespace OpenSim.Framework.Servers
if (HttpServer)
_httpResponse.Chunked = value;
else
- _sendChunked = value;
+ _httpListenerResponse.SendChunked = value;
}
}
- private bool _sendChunked;
-
///
/// HTTP status code.
@@ -248,7 +258,10 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? (int)_httpResponse.Status : _statusCode;
+ if (HttpServer)
+ return (int)_httpResponse.Status;
+ else
+ return _httpListenerResponse.StatusCode;
}
set
@@ -256,10 +269,9 @@ namespace OpenSim.Framework.Servers
if (HttpServer)
_httpResponse.Status = (HttpStatusCode)value;
else
- _statusCode = value;
+ _httpListenerResponse.StatusCode = value;
}
}
- private int _statusCode;
///
@@ -269,7 +281,10 @@ namespace OpenSim.Framework.Servers
{
get
{
- return HttpServer ? _httpResponse.Reason : _statusDescription;
+ if (HttpServer)
+ return _httpResponse.Reason;
+ else
+ return _httpListenerResponse.StatusDescription;
}
set
@@ -277,22 +292,22 @@ namespace OpenSim.Framework.Servers
if (HttpServer)
_httpResponse.Reason = value;
else
- _statusDescription = value;
+ _httpListenerResponse.StatusDescription = value;
}
}
- private string _statusDescription;
- private HttpResponse _httpResponse;
internal bool HttpServer
{
get { return null != _httpResponse; }
}
+ private HttpResponse _httpResponse;
+ private HttpListenerResponse _httpListenerResponse;
- internal HttpResponse HttpResponse
- {
- get { return _httpResponse; }
- }
+ // internal HttpResponse HttpResponse
+ // {
+ // get { return _httpResponse; }
+ // }
public OSHttpResponse()
{
@@ -308,21 +323,7 @@ namespace OpenSim.Framework.Servers
///
public OSHttpResponse(HttpListenerResponse resp)
{
- _contentEncoding = resp.ContentEncoding;
- _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;
+ _httpListenerResponse = resp;
}
///
@@ -348,7 +349,7 @@ namespace OpenSim.Framework.Servers
if (HttpServer)
_httpResponse.AddHeader(key, value);
else
- _headers.Add(key, value);
+ _httpListenerResponse.Headers.Add(key, value);
}
///
--
cgit v1.1