aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/OSHttpRequest.cs
diff options
context:
space:
mode:
authorDr Scofield2008-05-19 11:38:35 +0000
committerDr Scofield2008-05-19 11:38:35 +0000
commitd725d1208bfbeae02f181cc6731f5a98dc7fce6d (patch)
treefd27fe08b43c7ef5d15ee0e829947f06d97e8375 /OpenSim/Framework/Servers/OSHttpRequest.cs
parentRework some of the animation logic in an attempt to resolve #1318 (diff)
downloadopensim-SC-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.zip
opensim-SC-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.gz
opensim-SC-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.bz2
opensim-SC-d725d1208bfbeae02f181cc6731f5a98dc7fce6d.tar.xz
adding OSHttpRequest and OSHttpResponse which wrap HttpListenerRequest and HttpListenerResponse respectively.
enhancing IStreamHandler and IStreamedHandler interfaces so that OSHttp{Request,Response} get passed in, allowing RestHandlers to set response status code, redirections, etc.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Servers/OSHttpRequest.cs145
1 files changed, 145 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/OSHttpRequest.cs b/OpenSim/Framework/Servers/OSHttpRequest.cs
new file mode 100644
index 0000000..212e224
--- /dev/null
+++ b/OpenSim/Framework/Servers/OSHttpRequest.cs
@@ -0,0 +1,145 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSim Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Specialized;
30using System.Net;
31using System.IO;
32using System.Text;
33
34namespace OpenSim.Framework.Servers
35{
36 public class OSHttpRequest
37 {
38 private string[] _acceptTypes;
39 private Encoding _contentEncoding;
40 private long _contentLength64;
41 private string _contentType;
42 private CookieCollection _cookies;
43 private NameValueCollection _headers;
44 private string _httpMethod;
45 private Stream _inputStream;
46 private bool _isSecureConnection;
47 private bool _keepAlive;
48 private string _rawUrl;
49 private Uri _url;
50 private NameValueCollection _queryString;
51 private string _userAgent;
52
53 public string[] AcceptTypes
54 {
55 get { return _acceptTypes; }
56 }
57
58 public Encoding ContentEncoding
59 {
60 get { return _contentEncoding; }
61 }
62
63 public long ContentLength
64 {
65 get { return _contentLength64; }
66 }
67
68 public string ContentType
69 {
70 get { return _contentType; }
71 }
72
73 public CookieCollection Cookies
74 {
75 get { return _cookies; }
76 }
77
78 public NameValueCollection Headers
79 {
80 get { return _headers; }
81 }
82
83 public string HttpMethod
84 {
85 get { return _httpMethod; }
86 }
87
88 public Stream InputStream
89 {
90 get { return _inputStream; }
91 }
92
93 public bool IsSecureConnection
94 {
95 get { return _isSecureConnection; }
96 }
97
98 public bool KeepAlive
99 {
100 get { return _keepAlive; }
101 }
102
103 public string RawUrl
104 {
105 get { return _rawUrl; }
106 }
107
108 public Uri Url
109 {
110 get { return _url; }
111 }
112
113 public string UserAgent
114 {
115 get { return _userAgent; }
116 }
117
118 public NameValueCollection QueryString
119 {
120 get { return _queryString; }
121 }
122
123 public OSHttpRequest()
124 {
125 }
126
127 public OSHttpRequest(HttpListenerRequest req)
128 {
129 _acceptTypes = req.AcceptTypes;
130 _contentEncoding = req.ContentEncoding;
131 _contentLength64 = req.ContentLength64;
132 _contentType = req.ContentType;
133 _cookies = req.Cookies;
134 _headers = req.Headers;
135 _httpMethod = req.HttpMethod;
136 _inputStream = req.InputStream;
137 _isSecureConnection = req.IsSecureConnection;
138 _keepAlive = req.KeepAlive;
139 _rawUrl = req.RawUrl;
140 _url = req.Url;
141 _queryString = req.QueryString;
142 _userAgent = req.UserAgent;
143 }
144 }
145}