aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Servers/Tests/OSHttpTests.cs')
-rw-r--r--OpenSim/Framework/Servers/Tests/OSHttpTests.cs136
1 files changed, 68 insertions, 68 deletions
diff --git a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
index 60533cd..e5f7043 100644
--- a/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
+++ b/OpenSim/Framework/Servers/Tests/OSHttpTests.cs
@@ -92,87 +92,87 @@ namespace OpenSim.Framework.Servers.Tests
92 public class TestHttpRequest: IHttpRequest 92 public class TestHttpRequest: IHttpRequest
93 { 93 {
94 private string _uriPath; 94 private string _uriPath;
95 public bool BodyIsComplete 95 public bool BodyIsComplete
96 { 96 {
97 get { return true; } 97 get { return true; }
98 } 98 }
99 public string[] AcceptTypes 99 public string[] AcceptTypes
100 { 100 {
101 get {return _acceptTypes; } 101 get {return _acceptTypes; }
102 } 102 }
103 private string[] _acceptTypes; 103 private string[] _acceptTypes;
104 public Stream Body 104 public Stream Body
105 { 105 {
106 get { return _body; } 106 get { return _body; }
107 set { _body = value;} 107 set { _body = value;}
108 } 108 }
109 private Stream _body; 109 private Stream _body;
110 public ConnectionType Connection 110 public ConnectionType Connection
111 { 111 {
112 get { return _connection; } 112 get { return _connection; }
113 set { _connection = value; } 113 set { _connection = value; }
114 } 114 }
115 private ConnectionType _connection; 115 private ConnectionType _connection;
116 public int ContentLength 116 public int ContentLength
117 { 117 {
118 get { return _contentLength; } 118 get { return _contentLength; }
119 set { _contentLength = value; } 119 set { _contentLength = value; }
120 } 120 }
121 private int _contentLength; 121 private int _contentLength;
122 public NameValueCollection Headers 122 public NameValueCollection Headers
123 { 123 {
124 get { return _headers; } 124 get { return _headers; }
125 } 125 }
126 private NameValueCollection _headers = new NameValueCollection(); 126 private NameValueCollection _headers = new NameValueCollection();
127 public string HttpVersion 127 public string HttpVersion
128 { 128 {
129 get { return _httpVersion; } 129 get { return _httpVersion; }
130 set { _httpVersion = value; } 130 set { _httpVersion = value; }
131 } 131 }
132 private string _httpVersion = null; 132 private string _httpVersion = null;
133 public string Method 133 public string Method
134 { 134 {
135 get { return _method; } 135 get { return _method; }
136 set { _method = value; } 136 set { _method = value; }
137 } 137 }
138 private string _method = null; 138 private string _method = null;
139 public HttpInput QueryString 139 public HttpInput QueryString
140 { 140 {
141 get { return _queryString; } 141 get { return _queryString; }
142 } 142 }
143 private HttpInput _queryString = null; 143 private HttpInput _queryString = null;
144 public Uri Uri 144 public Uri Uri
145 { 145 {
146 get { return _uri; } 146 get { return _uri; }
147 set { _uri = value; } 147 set { _uri = value; }
148 } 148 }
149 private Uri _uri = null; 149 private Uri _uri = null;
150 public string[] UriParts 150 public string[] UriParts
151 { 151 {
152 get { return _uri.Segments; } 152 get { return _uri.Segments; }
153 } 153 }
154 public HttpParam Param 154 public HttpParam Param
155 { 155 {
156 get { return null; } 156 get { return null; }
157 } 157 }
158 public HttpForm Form 158 public HttpForm Form
159 { 159 {
160 get { return null; } 160 get { return null; }
161 } 161 }
162 public bool IsAjax 162 public bool IsAjax
163 { 163 {
164 get { return false; } 164 get { return false; }
165 } 165 }
166 public RequestCookies Cookies 166 public RequestCookies Cookies
167 { 167 {
168 get { return null; } 168 get { return null; }
169 } 169 }
170 170
171 public TestHttpRequest() {} 171 public TestHttpRequest() {}
172 172
173 public TestHttpRequest(string contentEncoding, string contentType, string userAgent, 173 public TestHttpRequest(string contentEncoding, string contentType, string userAgent,
174 string remoteAddr, string remotePort, string[] acceptTypes, 174 string remoteAddr, string remotePort, string[] acceptTypes,
175 ConnectionType connectionType, int contentLength, Uri uri) 175 ConnectionType connectionType, int contentLength, Uri uri)
176 { 176 {
177 _headers["content-encoding"] = contentEncoding; 177 _headers["content-encoding"] = contentEncoding;
178 _headers["content-type"] = contentType; 178 _headers["content-type"] = contentType;
@@ -192,7 +192,7 @@ namespace OpenSim.Framework.Servers.Tests
192 { 192 {
193 _headers.Add(name, value); 193 _headers.Add(name, value);
194 } 194 }
195 public int AddToBody(byte[] bytes, int offset, int length) 195 public int AddToBody(byte[] bytes, int offset, int length)
196 { 196 {
197 return 0; 197 return 0;
198 } 198 }
@@ -223,7 +223,7 @@ namespace OpenSim.Framework.Servers.Tests
223 set 223 set
224 { 224 {
225 _uriPath = value; 225 _uriPath = value;
226 226
227 } 227 }
228 } 228 }
229 229
@@ -231,7 +231,7 @@ namespace OpenSim.Framework.Servers.Tests
231 231
232 public class TestHttpResponse: IHttpResponse 232 public class TestHttpResponse: IHttpResponse
233 { 233 {
234 public Stream Body 234 public Stream Body
235 { 235 {
236 get { return _body; } 236 get { return _body; }
237 237
@@ -239,14 +239,14 @@ namespace OpenSim.Framework.Servers.Tests
239 } 239 }
240 private Stream _body; 240 private Stream _body;
241 241
242 public string ProtocolVersion 242 public string ProtocolVersion
243 { 243 {
244 get { return _protocolVersion; } 244 get { return _protocolVersion; }
245 set { _protocolVersion = value; } 245 set { _protocolVersion = value; }
246 } 246 }
247 private string _protocolVersion; 247 private string _protocolVersion;
248 248
249 public bool Chunked 249 public bool Chunked
250 { 250 {
251 get { return _chunked; } 251 get { return _chunked; }
252 252
@@ -254,7 +254,7 @@ namespace OpenSim.Framework.Servers.Tests
254 } 254 }
255 private bool _chunked; 255 private bool _chunked;
256 256
257 public ConnectionType Connection 257 public ConnectionType Connection
258 { 258 {
259 get { return _connection; } 259 get { return _connection; }
260 260
@@ -262,7 +262,7 @@ namespace OpenSim.Framework.Servers.Tests
262 } 262 }
263 private ConnectionType _connection; 263 private ConnectionType _connection;
264 264
265 public Encoding Encoding 265 public Encoding Encoding
266 { 266 {
267 get { return _encoding; } 267 get { return _encoding; }
268 268
@@ -270,7 +270,7 @@ namespace OpenSim.Framework.Servers.Tests
270 } 270 }
271 private Encoding _encoding; 271 private Encoding _encoding;
272 272
273 public int KeepAlive 273 public int KeepAlive
274 { 274 {
275 get { return _keepAlive; } 275 get { return _keepAlive; }
276 276
@@ -278,7 +278,7 @@ namespace OpenSim.Framework.Servers.Tests
278 } 278 }
279 private int _keepAlive; 279 private int _keepAlive;
280 280
281 public HttpStatusCode Status 281 public HttpStatusCode Status
282 { 282 {
283 get { return _status; } 283 get { return _status; }
284 284
@@ -286,7 +286,7 @@ namespace OpenSim.Framework.Servers.Tests
286 } 286 }
287 private HttpStatusCode _status; 287 private HttpStatusCode _status;
288 288
289 public string Reason 289 public string Reason
290 { 290 {
291 get { return _reason; } 291 get { return _reason; }
292 292
@@ -294,7 +294,7 @@ namespace OpenSim.Framework.Servers.Tests
294 } 294 }
295 private string _reason; 295 private string _reason;
296 296
297 public long ContentLength 297 public long ContentLength
298 { 298 {
299 get { return _contentLength; } 299 get { return _contentLength; }
300 300
@@ -302,7 +302,7 @@ namespace OpenSim.Framework.Servers.Tests
302 } 302 }
303 private long _contentLength; 303 private long _contentLength;
304 304
305 public string ContentType 305 public string ContentType
306 { 306 {
307 get { return _contentType; } 307 get { return _contentType; }
308 308
@@ -310,19 +310,19 @@ namespace OpenSim.Framework.Servers.Tests
310 } 310 }
311 private string _contentType; 311 private string _contentType;
312 312
313 public bool HeadersSent 313 public bool HeadersSent
314 { 314 {
315 get { return _headersSent; } 315 get { return _headersSent; }
316 } 316 }
317 private bool _headersSent; 317 private bool _headersSent;
318 318
319 public bool Sent 319 public bool Sent
320 { 320 {
321 get { return _sent; } 321 get { return _sent; }
322 } 322 }
323 private bool _sent; 323 private bool _sent;
324 324
325 public ResponseCookies Cookies 325 public ResponseCookies Cookies
326 { 326 {
327 get { return _cookies; } 327 get { return _cookies; }
328 } 328 }
@@ -335,25 +335,25 @@ namespace OpenSim.Framework.Servers.Tests
335 } 335 }
336 336
337 public void AddHeader(string name, string value) {} 337 public void AddHeader(string name, string value) {}
338 public void Send() 338 public void Send()
339 { 339 {
340 if (!_headersSent) SendHeaders(); 340 if (!_headersSent) SendHeaders();
341 if (_sent) throw new InvalidOperationException("stuff already sent"); 341 if (_sent) throw new InvalidOperationException("stuff already sent");
342 _sent = true; 342 _sent = true;
343 } 343 }
344 344
345 public void SendBody(byte[] buffer, int offset, int count) 345 public void SendBody(byte[] buffer, int offset, int count)
346 { 346 {
347 if (!_headersSent) SendHeaders(); 347 if (!_headersSent) SendHeaders();
348 _sent = true; 348 _sent = true;
349 } 349 }
350 public void SendBody(byte[] buffer) 350 public void SendBody(byte[] buffer)
351 { 351 {
352 if (!_headersSent) SendHeaders(); 352 if (!_headersSent) SendHeaders();
353 _sent = true; 353 _sent = true;
354 } 354 }
355 355
356 public void SendHeaders() 356 public void SendHeaders()
357 { 357 {
358 if (_headersSent) throw new InvalidOperationException("headers already sent"); 358 if (_headersSent) throw new InvalidOperationException("headers already sent");
359 _headersSent = true; 359 _headersSent = true;
@@ -362,7 +362,7 @@ namespace OpenSim.Framework.Servers.Tests
362 public void Redirect(Uri uri) {} 362 public void Redirect(Uri uri) {}
363 public void Redirect(string url) {} 363 public void Redirect(string url) {}
364 } 364 }
365 365
366 366
367 public OSHttpRequest req0; 367 public OSHttpRequest req0;
368 public OSHttpRequest req1; 368 public OSHttpRequest req1;
@@ -374,22 +374,22 @@ namespace OpenSim.Framework.Servers.Tests
374 [TestFixtureSetUp] 374 [TestFixtureSetUp]
375 public void Init() 375 public void Init()
376 { 376 {
377 TestHttpRequest threq0 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", 377 TestHttpRequest threq0 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711",
378 new string[] {"text/xml"}, 378 new string[] {"text/xml"},
379 ConnectionType.KeepAlive, 4711, 379 ConnectionType.KeepAlive, 4711,
380 new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis")); 380 new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis"));
381 threq0.Method = "GET"; 381 threq0.Method = "GET";
382 threq0.HttpVersion = HttpHelper.HTTP10; 382 threq0.HttpVersion = HttpHelper.HTTP10;
383 383
384 TestHttpRequest threq1 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711", 384 TestHttpRequest threq1 = new TestHttpRequest("utf-8", "text/xml", "OpenSim Test Agent", "192.168.0.1", "4711",
385 new string[] {"text/xml"}, 385 new string[] {"text/xml"},
386 ConnectionType.KeepAlive, 4711, 386 ConnectionType.KeepAlive, 4711,
387 new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2")); 387 new Uri("http://127.0.0.1/admin/inventory/Dr+Who/Tardis?a=0&b=1&c=2"));
388 threq1.Method = "POST"; 388 threq1.Method = "POST";
389 threq1.HttpVersion = HttpHelper.HTTP11; 389 threq1.HttpVersion = HttpHelper.HTTP11;
390 threq1.Headers["x-wuff"] = "wuffwuff"; 390 threq1.Headers["x-wuff"] = "wuffwuff";
391 threq1.Headers["www-authenticate"] = "go away"; 391 threq1.Headers["www-authenticate"] = "go away";
392 392
393 req0 = new OSHttpRequest(new TestHttpClientContext(false), threq0); 393 req0 = new OSHttpRequest(new TestHttpClientContext(false), threq0);
394 req1 = new OSHttpRequest(new TestHttpClientContext(false), threq1); 394 req1 = new OSHttpRequest(new TestHttpClientContext(false), threq1);
395 395