diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/BaseHttpServer.cs | 24 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BaseStreamHandler.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/BinaryStreamHandler.cs | 3 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/IStreamHandler.cs | 5 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpRequest.cs | 145 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/OSHttpResponse.cs | 165 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestDeserialiseHandler.cs | 4 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/RestStreamHandler.cs | 3 |
8 files changed, 335 insertions, 18 deletions
diff --git a/OpenSim/Framework/Servers/BaseHttpServer.cs b/OpenSim/Framework/Servers/BaseHttpServer.cs index 1eb1da9..eeb63e1 100644 --- a/OpenSim/Framework/Servers/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/BaseHttpServer.cs | |||
@@ -136,8 +136,8 @@ namespace OpenSim.Framework.Servers | |||
136 | { | 136 | { |
137 | HttpListenerContext context = (HttpListenerContext) stateinfo; | 137 | HttpListenerContext context = (HttpListenerContext) stateinfo; |
138 | 138 | ||
139 | HttpListenerRequest request = context.Request; | 139 | OSHttpRequest request = new OSHttpRequest(context.Request); |
140 | HttpListenerResponse response = context.Response; | 140 | OSHttpResponse response = new OSHttpResponse(context.Response); |
141 | 141 | ||
142 | response.KeepAlive = false; | 142 | response.KeepAlive = false; |
143 | response.SendChunked = false; | 143 | response.SendChunked = false; |
@@ -157,7 +157,7 @@ namespace OpenSim.Framework.Servers | |||
157 | { | 157 | { |
158 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; | 158 | IStreamedRequestHandler streamedRequestHandler = requestHandler as IStreamedRequestHandler; |
159 | 159 | ||
160 | buffer = streamedRequestHandler.Handle(path, request.InputStream); | 160 | buffer = streamedRequestHandler.Handle(path, request.InputStream, request, response); |
161 | } | 161 | } |
162 | else | 162 | else |
163 | { | 163 | { |
@@ -165,14 +165,14 @@ namespace OpenSim.Framework.Servers | |||
165 | 165 | ||
166 | using (MemoryStream memoryStream = new MemoryStream()) | 166 | using (MemoryStream memoryStream = new MemoryStream()) |
167 | { | 167 | { |
168 | streamHandler.Handle(path, request.InputStream, memoryStream); | 168 | streamHandler.Handle(path, request.InputStream, memoryStream, request, response); |
169 | memoryStream.Flush(); | 169 | memoryStream.Flush(); |
170 | buffer = memoryStream.ToArray(); | 170 | buffer = memoryStream.ToArray(); |
171 | } | 171 | } |
172 | } | 172 | } |
173 | 173 | ||
174 | request.InputStream.Close(); | 174 | request.InputStream.Close(); |
175 | response.ContentType = requestHandler.ContentType; | 175 | if (!response.IsContentTypeSet) response.ContentType = requestHandler.ContentType; |
176 | response.ContentLength64 = buffer.LongLength; | 176 | response.ContentLength64 = buffer.LongLength; |
177 | 177 | ||
178 | try | 178 | try |
@@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers | |||
280 | /// </summary> | 280 | /// </summary> |
281 | /// <param name="request"></param> | 281 | /// <param name="request"></param> |
282 | /// <param name="response"></param> | 282 | /// <param name="response"></param> |
283 | private void HandleXmlRpcRequests(HttpListenerRequest request, HttpListenerResponse response) | 283 | private void HandleXmlRpcRequests(OSHttpRequest request, OSHttpResponse response) |
284 | { | 284 | { |
285 | Stream requestStream = request.InputStream; | 285 | Stream requestStream = request.InputStream; |
286 | 286 | ||
@@ -358,7 +358,7 @@ namespace OpenSim.Framework.Servers | |||
358 | } | 358 | } |
359 | } | 359 | } |
360 | 360 | ||
361 | private void HandleLLSDRequests(HttpListenerRequest request, HttpListenerResponse response) | 361 | private void HandleLLSDRequests(OSHttpRequest request, OSHttpResponse response) |
362 | { | 362 | { |
363 | Stream requestStream = request.InputStream; | 363 | Stream requestStream = request.InputStream; |
364 | 364 | ||
@@ -416,7 +416,7 @@ namespace OpenSim.Framework.Servers | |||
416 | } | 416 | } |
417 | } | 417 | } |
418 | 418 | ||
419 | public void HandleHTTPRequest(HttpListenerRequest request, HttpListenerResponse response) | 419 | public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) |
420 | { | 420 | { |
421 | switch (request.HttpMethod) | 421 | switch (request.HttpMethod) |
422 | { | 422 | { |
@@ -430,7 +430,7 @@ namespace OpenSim.Framework.Servers | |||
430 | } | 430 | } |
431 | } | 431 | } |
432 | 432 | ||
433 | private void HandleContentVerbs(HttpListenerRequest request, HttpListenerResponse response) | 433 | private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) |
434 | { | 434 | { |
435 | // This is a test. There's a workable alternative.. as this way sucks. | 435 | // This is a test. There's a workable alternative.. as this way sucks. |
436 | // We'd like to put this into a text file parhaps that's easily editable. | 436 | // We'd like to put this into a text file parhaps that's easily editable. |
@@ -505,7 +505,7 @@ namespace OpenSim.Framework.Servers | |||
505 | } | 505 | } |
506 | } | 506 | } |
507 | 507 | ||
508 | private static void DoHTTPGruntWork(Hashtable responsedata, HttpListenerResponse response) | 508 | private static void DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
509 | { | 509 | { |
510 | int responsecode = (int)responsedata["int_response_code"]; | 510 | int responsecode = (int)responsedata["int_response_code"]; |
511 | string responseString = (string)responsedata["str_response_string"]; | 511 | string responseString = (string)responsedata["str_response_string"]; |
@@ -552,7 +552,7 @@ namespace OpenSim.Framework.Servers | |||
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | public void SendHTML404(HttpListenerResponse response, string host) | 555 | public void SendHTML404(OSHttpResponse response, string host) |
556 | { | 556 | { |
557 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s | 557 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s |
558 | response.StatusCode = 200; | 558 | response.StatusCode = 200; |
@@ -579,7 +579,7 @@ namespace OpenSim.Framework.Servers | |||
579 | } | 579 | } |
580 | } | 580 | } |
581 | 581 | ||
582 | public void SendHTML500(HttpListenerResponse response) | 582 | public void SendHTML500(OSHttpResponse response) |
583 | { | 583 | { |
584 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s | 584 | // I know this statuscode is dumb, but the client doesn't respond to 404s and 500s |
585 | response.StatusCode = 200; | 585 | response.StatusCode = 200; |
diff --git a/OpenSim/Framework/Servers/BaseStreamHandler.cs b/OpenSim/Framework/Servers/BaseStreamHandler.cs index 91ebc2c..a81a1b7 100644 --- a/OpenSim/Framework/Servers/BaseStreamHandler.cs +++ b/OpenSim/Framework/Servers/BaseStreamHandler.cs | |||
@@ -26,12 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Net; | ||
29 | 30 | ||
30 | namespace OpenSim.Framework.Servers | 31 | namespace OpenSim.Framework.Servers |
31 | { | 32 | { |
32 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler | 33 | public abstract class BaseStreamHandler : BaseRequestHandler, IStreamedRequestHandler |
33 | { | 34 | { |
34 | public abstract byte[] Handle(string path, Stream request); | 35 | public abstract byte[] Handle(string path, Stream request, |
36 | OSHttpRequest httpRequest, OSHttpResponse httpResponse); | ||
35 | 37 | ||
36 | protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path) | 38 | protected BaseStreamHandler(string httpMethod, string path) : base(httpMethod, path) |
37 | { | 39 | { |
diff --git a/OpenSim/Framework/Servers/BinaryStreamHandler.cs b/OpenSim/Framework/Servers/BinaryStreamHandler.cs index dcd1cba..26a6f10 100644 --- a/OpenSim/Framework/Servers/BinaryStreamHandler.cs +++ b/OpenSim/Framework/Servers/BinaryStreamHandler.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Text; | 29 | using System.Text; |
30 | using System.Net; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Framework.Servers |
32 | { | 33 | { |
@@ -36,7 +37,7 @@ namespace OpenSim.Framework.Servers | |||
36 | { | 37 | { |
37 | private BinaryMethod m_method; | 38 | private BinaryMethod m_method; |
38 | 39 | ||
39 | public override byte[] Handle(string path, Stream request) | 40 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
40 | { | 41 | { |
41 | byte[] data = ReadFully(request); | 42 | byte[] data = ReadFully(request); |
42 | string param = GetParam(path); | 43 | string param = GetParam(path); |
diff --git a/OpenSim/Framework/Servers/IStreamHandler.cs b/OpenSim/Framework/Servers/IStreamHandler.cs index de6fdf5..b3ce34d 100644 --- a/OpenSim/Framework/Servers/IStreamHandler.cs +++ b/OpenSim/Framework/Servers/IStreamHandler.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.Collections; | 28 | using System.Collections; |
29 | using System.IO; | 29 | using System.IO; |
30 | using System.Net; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Framework.Servers |
32 | { | 33 | { |
@@ -45,13 +46,13 @@ namespace OpenSim.Framework.Servers | |||
45 | public interface IStreamedRequestHandler : IRequestHandler | 46 | public interface IStreamedRequestHandler : IRequestHandler |
46 | { | 47 | { |
47 | // Handle request stream, return byte array | 48 | // Handle request stream, return byte array |
48 | byte[] Handle(string path, Stream request); | 49 | byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse); |
49 | } | 50 | } |
50 | 51 | ||
51 | public interface IStreamHandler : IRequestHandler | 52 | public interface IStreamHandler : IRequestHandler |
52 | { | 53 | { |
53 | // Handle request stream, return byte array | 54 | // Handle request stream, return byte array |
54 | void Handle(string path, Stream request, Stream response); | 55 | void Handle(string path, Stream request, Stream response, OSHttpRequest httpReqbuest, OSHttpResponse httpResponse); |
55 | } | 56 | } |
56 | public interface IGenericHTTPHandler : IRequestHandler | 57 | public interface IGenericHTTPHandler : IRequestHandler |
57 | { | 58 | { |
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 | |||
28 | using System; | ||
29 | using System.Collections.Specialized; | ||
30 | using System.Net; | ||
31 | using System.IO; | ||
32 | using System.Text; | ||
33 | |||
34 | namespace 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 | } | ||
diff --git a/OpenSim/Framework/Servers/OSHttpResponse.cs b/OpenSim/Framework/Servers/OSHttpResponse.cs new file mode 100644 index 0000000..28d513a --- /dev/null +++ b/OpenSim/Framework/Servers/OSHttpResponse.cs | |||
@@ -0,0 +1,165 @@ | |||
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 | |||
28 | using System.Collections; | ||
29 | using System.IO; | ||
30 | using System.Net; | ||
31 | using System.Text; | ||
32 | |||
33 | namespace OpenSim.Framework.Servers | ||
34 | { | ||
35 | public class OSHttpResponse | ||
36 | { | ||
37 | private string _contentType; | ||
38 | private bool _contentTypeSet; | ||
39 | public string ContentType | ||
40 | { | ||
41 | get { return _contentType; } | ||
42 | set | ||
43 | { | ||
44 | _contentType = value; | ||
45 | _contentTypeSet = true; | ||
46 | } | ||
47 | } | ||
48 | public bool IsContentTypeSet | ||
49 | { | ||
50 | get { return _contentTypeSet; } | ||
51 | } | ||
52 | |||
53 | private long _contentLength64; | ||
54 | public long ContentLength64 | ||
55 | { | ||
56 | get { return _contentLength64; } | ||
57 | set | ||
58 | { | ||
59 | _contentLength64 = value; | ||
60 | if (null != _resp) _resp.ContentLength64 = value; | ||
61 | } | ||
62 | } | ||
63 | |||
64 | private Encoding _contentEncoding; | ||
65 | public Encoding ContentEncoding | ||
66 | { | ||
67 | get { return _contentEncoding; } | ||
68 | set | ||
69 | { | ||
70 | _contentEncoding = value; | ||
71 | if (null != _resp) _resp.ContentEncoding = value; | ||
72 | } | ||
73 | } | ||
74 | |||
75 | public WebHeaderCollection Headers; | ||
76 | public CookieCollection Cookies; | ||
77 | |||
78 | private bool _keepAlive; | ||
79 | public bool KeepAlive | ||
80 | { | ||
81 | get { return _keepAlive; } | ||
82 | set | ||
83 | { | ||
84 | _keepAlive = value; | ||
85 | if (null != _resp) _resp.KeepAlive = value; | ||
86 | } | ||
87 | } | ||
88 | |||
89 | public Stream OutputStream; | ||
90 | |||
91 | private string _redirectLocation; | ||
92 | public string RedirectLocation | ||
93 | { | ||
94 | get { return _redirectLocation; } | ||
95 | set | ||
96 | { | ||
97 | _redirectLocation = value; | ||
98 | if (null != _resp) _resp.RedirectLocation = value; | ||
99 | } | ||
100 | } | ||
101 | |||
102 | private bool _sendChunked; | ||
103 | public bool SendChunked | ||
104 | { | ||
105 | get { return _sendChunked; } | ||
106 | set | ||
107 | { | ||
108 | _sendChunked = value; | ||
109 | if (null != _resp) _resp.SendChunked = value; | ||
110 | } | ||
111 | } | ||
112 | |||
113 | private int _statusCode; | ||
114 | public int StatusCode | ||
115 | { | ||
116 | get { return _statusCode; } | ||
117 | set | ||
118 | { | ||
119 | _statusCode = value; | ||
120 | if (null != _resp) _resp.StatusCode = value; | ||
121 | } | ||
122 | } | ||
123 | |||
124 | private string _statusDescription; | ||
125 | public string StatusDescription | ||
126 | { | ||
127 | get { return _statusDescription; } | ||
128 | set | ||
129 | { | ||
130 | _statusDescription = value; | ||
131 | if (null != _resp) _resp.StatusDescription = value; | ||
132 | } | ||
133 | } | ||
134 | |||
135 | private HttpListenerResponse _resp; | ||
136 | |||
137 | public OSHttpResponse() | ||
138 | { | ||
139 | } | ||
140 | |||
141 | public OSHttpResponse(HttpListenerResponse resp) | ||
142 | { | ||
143 | ContentEncoding = resp.ContentEncoding; | ||
144 | ContentLength64 = resp.ContentLength64; | ||
145 | _contentType = resp.ContentType; | ||
146 | Headers = resp.Headers; | ||
147 | Cookies = resp.Cookies; | ||
148 | KeepAlive = resp.KeepAlive; | ||
149 | OutputStream = resp.OutputStream; | ||
150 | RedirectLocation = resp.RedirectLocation; | ||
151 | SendChunked = resp.SendChunked; | ||
152 | StatusCode = resp.StatusCode; | ||
153 | StatusDescription = resp.StatusDescription; | ||
154 | |||
155 | _contentTypeSet = false; | ||
156 | |||
157 | _resp = resp; | ||
158 | } | ||
159 | |||
160 | public void AddHeader(string key, string value) | ||
161 | { | ||
162 | Headers.Add(key, value); | ||
163 | } | ||
164 | } | ||
165 | } | ||
diff --git a/OpenSim/Framework/Servers/RestDeserialiseHandler.cs b/OpenSim/Framework/Servers/RestDeserialiseHandler.cs index 39f440f..fcc8839 100644 --- a/OpenSim/Framework/Servers/RestDeserialiseHandler.cs +++ b/OpenSim/Framework/Servers/RestDeserialiseHandler.cs | |||
@@ -26,6 +26,7 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Net; | ||
29 | using System.Xml; | 30 | using System.Xml; |
30 | using System.Xml.Serialization; | 31 | using System.Xml.Serialization; |
31 | 32 | ||
@@ -44,7 +45,8 @@ namespace OpenSim.Framework.Servers | |||
44 | m_method = method; | 45 | m_method = method; |
45 | } | 46 | } |
46 | 47 | ||
47 | public void Handle(string path, Stream request, Stream responseStream) | 48 | public void Handle(string path, Stream request, Stream responseStream, |
49 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
48 | { | 50 | { |
49 | TRequest deserial; | 51 | TRequest deserial; |
50 | using (XmlTextReader xmlReader = new XmlTextReader(request)) | 52 | using (XmlTextReader xmlReader = new XmlTextReader(request)) |
diff --git a/OpenSim/Framework/Servers/RestStreamHandler.cs b/OpenSim/Framework/Servers/RestStreamHandler.cs index 76dbd73..301b0a9 100644 --- a/OpenSim/Framework/Servers/RestStreamHandler.cs +++ b/OpenSim/Framework/Servers/RestStreamHandler.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System.IO; | 28 | using System.IO; |
29 | using System.Text; | 29 | using System.Text; |
30 | using System.Net; | ||
30 | 31 | ||
31 | namespace OpenSim.Framework.Servers | 32 | namespace OpenSim.Framework.Servers |
32 | { | 33 | { |
@@ -39,7 +40,7 @@ namespace OpenSim.Framework.Servers | |||
39 | get { return m_restMethod; } | 40 | get { return m_restMethod; } |
40 | } | 41 | } |
41 | 42 | ||
42 | public override byte[] Handle(string path, Stream request) | 43 | public override byte[] Handle(string path, Stream request, OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
43 | { | 44 | { |
44 | Encoding encoding = Encoding.UTF8; | 45 | Encoding encoding = Encoding.UTF8; |
45 | StreamReader streamReader = new StreamReader(request, encoding); | 46 | StreamReader streamReader = new StreamReader(request, encoding); |