diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpResponse.cs index 25553a6f32..eab6f013f4 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/HttpResponse.cs @@ -89,7 +89,6 @@ namespace OSHttpServer m_body = new MemoryStream(); return m_body; } - set { m_body = value; } } /// @@ -298,7 +297,6 @@ namespace OSHttpServer if(m_body != null && m_body.Length > 0) { - m_body.Flush(); m_body.Seek(0, SeekOrigin.Begin); var buffer = new byte[8192]; @@ -592,12 +590,12 @@ namespace OSHttpServer if (m_body != null && m_body.Length != 0) { - m_body.Flush(); - m_body.Seek(0, SeekOrigin.Begin); - - RawBuffer = new byte[m_body.Length]; - RawBufferLen = m_body.Read(RawBuffer, 0, (int)m_body.Length); - m_body.Dispose(); + MemoryStream mb = m_body as MemoryStream; + RawBuffer = mb.GetBuffer(); + RawBufferStart = 0; // must be a internal buffer, or starting at 0 + RawBufferLen = (int)mb.Length; + mb.Dispose(); + m_body = null; if(RawBufferLen > 0) { @@ -634,32 +632,6 @@ namespace OSHttpServer m_context.ReqResponseSent(requestID, Connection); } - /// - /// Redirect client to somewhere else using the 302 status code. - /// - /// Destination of the redirect - /// If headers already been sent. - /// You can not do anything more with the request when a redirect have been done. This should be your last - /// action. - public void Redirect(Uri uri) - { - Status = HttpStatusCode.Redirect; - m_headers["location"] = uri.ToString(); - } - - /// - /// redirect to somewhere - /// - /// where the redirect should go - /// - /// No body are allowed when doing redirects. - /// - public void Redirect(string url) - { - Status = HttpStatusCode.Redirect; - m_headers["location"] = url; - } - public void Clear() { if(Body != null && Body.CanRead) diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpResponse.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpResponse.cs index 6cfb772b39..3256ccfd42 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer/IHttpResponse.cs @@ -31,7 +31,7 @@ namespace OSHttpServer /// before sending everything to the client. It's the simplest /// way to serve documents. /// - Stream Body { get; set; } + Stream Body { get; } byte[] RawBuffer { get; set; } int RawBufferStart { get; set; } int RawBufferLen { get; set; }