From ad04626737c164138d6d15d5e06eb20ff5b5f859 Mon Sep 17 00:00:00 2001 From: Dr Scofield Date: Mon, 6 Oct 2008 21:59:43 +0000 Subject: cleaning up OSHttpResponse: note that read access to extra header fields is GONE (HttpServer does not support that), you can read the "normal" HTTP headers available via properties, and you can add headers. also, it is now possible to set a timeout for KeepAlive (for those clients that pay attention to it). this also fixes the broken REST inventory/assets/appearance services, they should be working again. testcase for OSHttpResponse will follow. --- .../Rest/Inventory/RequestData.cs | 72 ++++++++++------------ 1 file changed, 32 insertions(+), 40 deletions(-) (limited to 'OpenSim/ApplicationPlugins/Rest') diff --git a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs index 12caf81..081327e 100644 --- a/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs +++ b/OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs @@ -1213,7 +1213,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory response.ContentLength64 = buffer.Length; - if (response.Headers.Get("Content-Encoding") == null) + if (response.ContentEncoding == null) response.ContentEncoding = encoding; response.SendChunked = chunked; @@ -1256,7 +1256,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory handled = true; - DumpHeaders(); + // DumpHeaders(); // if (request.InputStream != null) // { @@ -1273,8 +1273,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory // Closing the outputstream should complete the transmission process - Rest.Log.DebugFormat("{0} Closing output stream", MsgId); - response.OutputStream.Close(); + Rest.Log.DebugFormat("{0} Sending response", MsgId); + // response.OutputStream.Close(); + response.Send(); } @@ -1292,44 +1293,35 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory internal void AddHeader(string hdr, string data) { - if (Rest.DEBUG) - { - Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", - MsgId, hdr, data); - if (response.Headers.Get(hdr) != null) - { - Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", - MsgId, hdr); - } - } - response.Headers.Add(hdr, data); - } - - internal void RemoveHeader(string hdr) - { - if (Rest.DEBUG) - { - Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); - if (response.Headers.Get(hdr) == null) - { - Rest.Log.DebugFormat("{0} No such header existed", - MsgId, hdr); - } - } - response.Headers.Remove(hdr); + if (Rest.DEBUG) Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", MsgId, hdr, data); + response.AddHeader(hdr, data); } - internal void DumpHeaders() - { - if (Rest.DEBUG) - { - for (int i=0;i", MsgId, hdr); + // if (response.Headers.Get(hdr) == null) + // { + // Rest.Log.DebugFormat("{0} No such header existed", + // MsgId, hdr); + // } + // } + // response.Headers.Remove(hdr); + // } + + // internal void DumpHeaders() + // { + // if (Rest.DEBUG) + // { + // for (int i=0;i