aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Servers/OSHttpRequestPump.cs2
-rw-r--r--OpenSim/Framework/Servers/OSHttpResponse.cs109
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
151 body.Flush(); 151 body.Flush();
152 152
153 // and ship it back 153 // and ship it back
154 resp.HttpResponse.Send(); 154 resp.Send();
155 } 155 }
156 } 156 }
157 catch (Exception e) 157 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
62 { 62 {
63 get 63 get
64 { 64 {
65 return HttpServer ? _httpResponse.ContentType : _contentType; 65 if (HttpServer)
66 return _httpResponse.ContentType;
67 else
68 return _httpListenerResponse.ContentType;
66 } 69 }
67 set 70 set
68 { 71 {
@@ -72,12 +75,11 @@ namespace OpenSim.Framework.Servers
72 } 75 }
73 else 76 else
74 { 77 {
75 _contentType = value; 78 _httpListenerResponse.ContentType = value;
76 _contentTypeSet = true; 79 _contentTypeSet = true;
77 } 80 }
78 } 81 }
79 } 82 }
80 private string _contentType;
81 83
82 /// <summary> 84 /// <summary>
83 /// Boolean property indicating whether the content type 85 /// Boolean property indicating whether the content type
@@ -100,20 +102,22 @@ namespace OpenSim.Framework.Servers
100 { 102 {
101 get 103 get
102 { 104 {
103 return HttpServer ? _httpResponse.ContentLength : _contentLength; 105 if (HttpServer)
106 return _httpResponse.ContentLength;
107 else
108 return _httpListenerResponse.ContentLength64;
104 } 109 }
105 set 110 set
106 { 111 {
107 if (HttpServer) 112 if (HttpServer)
108 _httpResponse.ContentLength = value; 113 _httpResponse.ContentLength = value;
109 else 114 else
110 _contentLength = value; 115 _httpListenerResponse.ContentLength64 = value;
111 } 116 }
112 } 117 }
113 private long _contentLength;
114 118
115 /// <summary> 119 /// <summary>
116 /// Aliases for ContentLength. 120 /// Alias for ContentLength.
117 /// </summary> 121 /// </summary>
118 public long ContentLength64 122 public long ContentLength64
119 { 123 {
@@ -126,18 +130,22 @@ namespace OpenSim.Framework.Servers
126 /// </summary> 130 /// </summary>
127 public Encoding ContentEncoding 131 public Encoding ContentEncoding
128 { 132 {
129 get { 133 get
130 return HttpServer ? _httpResponse.Encoding : _contentEncoding; 134 {
135 if (HttpServer)
136 return _httpResponse.Encoding;
137 else
138 return _httpListenerResponse.ContentEncoding;
131 } 139 }
140
132 set 141 set
133 { 142 {
134 if (HttpServer) 143 if (HttpServer)
135 _httpResponse.Encoding = value; 144 _httpResponse.Encoding = value;
136 else 145 else
137 _contentEncoding = value; 146 _httpListenerResponse.ContentEncoding = value;
138 } 147 }
139 } 148 }
140 private Encoding _contentEncoding;
141 149
142 /// <summary> 150 /// <summary>
143 /// Headers of the response. 151 /// Headers of the response.
@@ -146,10 +154,12 @@ namespace OpenSim.Framework.Servers
146 { 154 {
147 get 155 get
148 { 156 {
149 return HttpServer ? null : _headers; 157 if (HttpServer)
158 return null;
159 else
160 return _httpListenerResponse.Headers;
150 } 161 }
151 } 162 }
152 private WebHeaderCollection _headers;
153 163
154 /// <summary> 164 /// <summary>
155 /// Get or set the keep alive property. 165 /// Get or set the keep alive property.
@@ -161,17 +171,17 @@ namespace OpenSim.Framework.Servers
161 if (HttpServer) 171 if (HttpServer)
162 return _httpResponse.Connection == ConnectionType.KeepAlive; 172 return _httpResponse.Connection == ConnectionType.KeepAlive;
163 else 173 else
164 return _keepAlive; 174 return _httpListenerResponse.KeepAlive;
165 } 175 }
176
166 set 177 set
167 { 178 {
168 if (HttpServer) 179 if (HttpServer)
169 _httpResponse.Connection = ConnectionType.KeepAlive; 180 _httpResponse.Connection = ConnectionType.KeepAlive;
170 else 181 else
171 _keepAlive = value; 182 _httpListenerResponse.KeepAlive = value;
172 } 183 }
173 } 184 }
174 private bool _keepAlive;
175 185
176 /// <summary> 186 /// <summary>
177 /// Return the output stream feeding the body. 187 /// Return the output stream feeding the body.
@@ -183,11 +193,12 @@ namespace OpenSim.Framework.Servers
183 { 193 {
184 get 194 get
185 { 195 {
186 return HttpServer ? _httpResponse.Body : _outputStream; 196 if (HttpServer)
197 return _httpResponse.Body;
198 else
199 return _httpListenerResponse.OutputStream;
187 } 200 }
188 } 201 }
189 private Stream _outputStream;
190
191 202
192 /// <summary> 203 /// <summary>
193 /// Return the output stream feeding the body. 204 /// Return the output stream feeding the body.
@@ -212,12 +223,10 @@ namespace OpenSim.Framework.Servers
212 { 223 {
213 if (HttpServer) 224 if (HttpServer)
214 _httpResponse.Redirect(value); 225 _httpResponse.Redirect(value);
215 // else 226 else
216 // _redirectLocation = value; 227 _httpListenerResponse.RedirectLocation = value;
217 } 228 }
218 } 229 }
219 // private string _redirectLocation;
220
221 230
222 231
223 /// <summary> 232 /// <summary>
@@ -227,7 +236,10 @@ namespace OpenSim.Framework.Servers
227 { 236 {
228 get 237 get
229 { 238 {
230 return HttpServer ? _httpResponse.Chunked :_sendChunked; 239 if (HttpServer)
240 return _httpResponse.Chunked;
241 else
242 return _httpListenerResponse.SendChunked;
231 } 243 }
232 244
233 set 245 set
@@ -235,11 +247,9 @@ namespace OpenSim.Framework.Servers
235 if (HttpServer) 247 if (HttpServer)
236 _httpResponse.Chunked = value; 248 _httpResponse.Chunked = value;
237 else 249 else
238 _sendChunked = value; 250 _httpListenerResponse.SendChunked = value;
239 } 251 }
240 } 252 }
241 private bool _sendChunked;
242
243 253
244 /// <summary> 254 /// <summary>
245 /// HTTP status code. 255 /// HTTP status code.
@@ -248,7 +258,10 @@ namespace OpenSim.Framework.Servers
248 { 258 {
249 get 259 get
250 { 260 {
251 return HttpServer ? (int)_httpResponse.Status : _statusCode; 261 if (HttpServer)
262 return (int)_httpResponse.Status;
263 else
264 return _httpListenerResponse.StatusCode;
252 } 265 }
253 266
254 set 267 set
@@ -256,10 +269,9 @@ namespace OpenSim.Framework.Servers
256 if (HttpServer) 269 if (HttpServer)
257 _httpResponse.Status = (HttpStatusCode)value; 270 _httpResponse.Status = (HttpStatusCode)value;
258 else 271 else
259 _statusCode = value; 272 _httpListenerResponse.StatusCode = value;
260 } 273 }
261 } 274 }
262 private int _statusCode;
263 275
264 276
265 /// <summary> 277 /// <summary>
@@ -269,7 +281,10 @@ namespace OpenSim.Framework.Servers
269 { 281 {
270 get 282 get
271 { 283 {
272 return HttpServer ? _httpResponse.Reason : _statusDescription; 284 if (HttpServer)
285 return _httpResponse.Reason;
286 else
287 return _httpListenerResponse.StatusDescription;
273 } 288 }
274 289
275 set 290 set
@@ -277,22 +292,22 @@ namespace OpenSim.Framework.Servers
277 if (HttpServer) 292 if (HttpServer)
278 _httpResponse.Reason = value; 293 _httpResponse.Reason = value;
279 else 294 else
280 _statusDescription = value; 295 _httpListenerResponse.StatusDescription = value;
281 } 296 }
282 } 297 }
283 private string _statusDescription;
284 298
285 private HttpResponse _httpResponse;
286 299
287 internal bool HttpServer 300 internal bool HttpServer
288 { 301 {
289 get { return null != _httpResponse; } 302 get { return null != _httpResponse; }
290 } 303 }
304 private HttpResponse _httpResponse;
305 private HttpListenerResponse _httpListenerResponse;
291 306
292 internal HttpResponse HttpResponse 307 // internal HttpResponse HttpResponse
293 { 308 // {
294 get { return _httpResponse; } 309 // get { return _httpResponse; }
295 } 310 // }
296 311
297 public OSHttpResponse() 312 public OSHttpResponse()
298 { 313 {
@@ -308,21 +323,7 @@ namespace OpenSim.Framework.Servers
308 /// </remarks> 323 /// </remarks>
309 public OSHttpResponse(HttpListenerResponse resp) 324 public OSHttpResponse(HttpListenerResponse resp)
310 { 325 {
311 _contentEncoding = resp.ContentEncoding; 326 _httpListenerResponse = resp;
312 _contentLength = resp.ContentLength64;
313 _contentType = resp.ContentType;
314 _headers = resp.Headers;
315 // _cookies = resp.Cookies;
316 _keepAlive = resp.KeepAlive;
317 _outputStream = resp.OutputStream;
318 // _redirectLocation = resp.RedirectLocation;
319 _sendChunked = resp.SendChunked;
320 _statusCode = resp.StatusCode;
321 _statusDescription = resp.StatusDescription;
322
323 _contentTypeSet = false;
324
325 // _resp = resp;
326 } 327 }
327 328
328 /// <summary> 329 /// <summary>
@@ -348,7 +349,7 @@ namespace OpenSim.Framework.Servers
348 if (HttpServer) 349 if (HttpServer)
349 _httpResponse.AddHeader(key, value); 350 _httpResponse.AddHeader(key, value);
350 else 351 else
351 _headers.Add(key, value); 352 _httpListenerResponse.Headers.Add(key, value);
352 } 353 }
353 354
354 /// <summary> 355 /// <summary>