diff options
author | Dr Scofield | 2008-10-06 21:59:43 +0000 |
---|---|---|
committer | Dr Scofield | 2008-10-06 21:59:43 +0000 |
commit | ad04626737c164138d6d15d5e06eb20ff5b5f859 (patch) | |
tree | 6bc3aeb5dbb645503fcedb4012e68f069f8ada72 /OpenSim/ApplicationPlugins/Rest | |
parent | oops. forgot testcase (diff) | |
download | opensim-SC_OLD-ad04626737c164138d6d15d5e06eb20ff5b5f859.zip opensim-SC_OLD-ad04626737c164138d6d15d5e06eb20ff5b5f859.tar.gz opensim-SC_OLD-ad04626737c164138d6d15d5e06eb20ff5b5f859.tar.bz2 opensim-SC_OLD-ad04626737c164138d6d15d5e06eb20ff5b5f859.tar.xz |
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.
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Inventory/RequestData.cs | 72 |
1 files changed, 32 insertions, 40 deletions
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 | |||
1213 | 1213 | ||
1214 | response.ContentLength64 = buffer.Length; | 1214 | response.ContentLength64 = buffer.Length; |
1215 | 1215 | ||
1216 | if (response.Headers.Get("Content-Encoding") == null) | 1216 | if (response.ContentEncoding == null) |
1217 | response.ContentEncoding = encoding; | 1217 | response.ContentEncoding = encoding; |
1218 | 1218 | ||
1219 | response.SendChunked = chunked; | 1219 | response.SendChunked = chunked; |
@@ -1256,7 +1256,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1256 | 1256 | ||
1257 | handled = true; | 1257 | handled = true; |
1258 | 1258 | ||
1259 | DumpHeaders(); | 1259 | // DumpHeaders(); |
1260 | 1260 | ||
1261 | // if (request.InputStream != null) | 1261 | // if (request.InputStream != null) |
1262 | // { | 1262 | // { |
@@ -1273,8 +1273,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1273 | 1273 | ||
1274 | // Closing the outputstream should complete the transmission process | 1274 | // Closing the outputstream should complete the transmission process |
1275 | 1275 | ||
1276 | Rest.Log.DebugFormat("{0} Closing output stream", MsgId); | 1276 | Rest.Log.DebugFormat("{0} Sending response", MsgId); |
1277 | response.OutputStream.Close(); | 1277 | // response.OutputStream.Close(); |
1278 | response.Send(); | ||
1278 | 1279 | ||
1279 | } | 1280 | } |
1280 | 1281 | ||
@@ -1292,44 +1293,35 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory | |||
1292 | 1293 | ||
1293 | internal void AddHeader(string hdr, string data) | 1294 | internal void AddHeader(string hdr, string data) |
1294 | { | 1295 | { |
1295 | if (Rest.DEBUG) | 1296 | if (Rest.DEBUG) Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", MsgId, hdr, data); |
1296 | { | 1297 | response.AddHeader(hdr, data); |
1297 | Rest.Log.DebugFormat("{0} Adding header: <{1}: {2}>", | ||
1298 | MsgId, hdr, data); | ||
1299 | if (response.Headers.Get(hdr) != null) | ||
1300 | { | ||
1301 | Rest.Log.DebugFormat("{0} Multipe {1} headers will be generated>", | ||
1302 | MsgId, hdr); | ||
1303 | } | ||
1304 | } | ||
1305 | response.Headers.Add(hdr, data); | ||
1306 | } | ||
1307 | |||
1308 | internal void RemoveHeader(string hdr) | ||
1309 | { | ||
1310 | if (Rest.DEBUG) | ||
1311 | { | ||
1312 | Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); | ||
1313 | if (response.Headers.Get(hdr) == null) | ||
1314 | { | ||
1315 | Rest.Log.DebugFormat("{0} No such header existed", | ||
1316 | MsgId, hdr); | ||
1317 | } | ||
1318 | } | ||
1319 | response.Headers.Remove(hdr); | ||
1320 | } | 1298 | } |
1321 | 1299 | ||
1322 | internal void DumpHeaders() | 1300 | // internal void RemoveHeader(string hdr) |
1323 | { | 1301 | // { |
1324 | if (Rest.DEBUG) | 1302 | // if (Rest.DEBUG) |
1325 | { | 1303 | // { |
1326 | for (int i=0;i<response.Headers.Count;i++) | 1304 | // Rest.Log.DebugFormat("{0} Removing header: <{1}>", MsgId, hdr); |
1327 | { | 1305 | // if (response.Headers.Get(hdr) == null) |
1328 | Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, | 1306 | // { |
1329 | response.Headers.Get(i)); | 1307 | // Rest.Log.DebugFormat("{0} No such header existed", |
1330 | } | 1308 | // MsgId, hdr); |
1331 | } | 1309 | // } |
1332 | } | 1310 | // } |
1311 | // response.Headers.Remove(hdr); | ||
1312 | // } | ||
1313 | |||
1314 | // internal void DumpHeaders() | ||
1315 | // { | ||
1316 | // if (Rest.DEBUG) | ||
1317 | // { | ||
1318 | // for (int i=0;i<response.Headers.Count;i++) | ||
1319 | // { | ||
1320 | // Rest.Log.DebugFormat("{0} Header[{1}] : {2}", MsgId, i, | ||
1321 | // response.Headers.Get(i)); | ||
1322 | // } | ||
1323 | // } | ||
1324 | // } | ||
1333 | 1325 | ||
1334 | // Setup the XML writer for output | 1326 | // Setup the XML writer for output |
1335 | 1327 | ||