diff options
author | Justin Clark-Casey (justincc) | 2011-12-05 20:44:20 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-12-05 20:44:20 +0000 |
commit | 4567555c49cb560dd6f109bbfec42086af3de56f (patch) | |
tree | bfb0a6fd21d2070940399c0e36dc7d0de1e7eb0d /OpenSim/ApplicationPlugins/Rest | |
parent | For the GetTexture capability, if a data range is requested that covers the w... (diff) | |
download | opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.zip opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.gz opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.bz2 opensim-SC-4567555c49cb560dd6f109bbfec42086af3de56f.tar.xz |
Implement IOSHttpRequest and IOSHttpResponse http interfaces and use instead of OSHttpRequest/OSHttpResponse.
This is required for the substitution of different HTTP servers or the newer HttpServer.dll without having to commit to a particular implementation.
This is also required to write regression tests that involve the HTTP layer.
If you need to recompile, all you need to do is replace OSHttpRequest/OSHttpResponse references with IOSHttpRequest/IOSHttpResponse.
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest')
4 files changed, 15 insertions, 15 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs index dea166d..d99ba57 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETHandler.cs | |||
@@ -41,7 +41,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
41 | { | 41 | { |
42 | #region GET methods | 42 | #region GET methods |
43 | public string GetHandler(string request, string path, string param, | 43 | public string GetHandler(string request, string path, string param, |
44 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 44 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
45 | { | 45 | { |
46 | // foreach (string h in httpRequest.Headers.AllKeys) | 46 | // foreach (string h in httpRequest.Headers.AllKeys) |
47 | // foreach (string v in httpRequest.Headers.GetValues(h)) | 47 | // foreach (string v in httpRequest.Headers.GetValues(h)) |
@@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | public string GetHandlerRegions(OSHttpResponse httpResponse) | 67 | public string GetHandlerRegions(IOSHttpResponse httpResponse) |
68 | { | 68 | { |
69 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); | 69 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); |
70 | 70 | ||
@@ -95,7 +95,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
95 | return rxw.ToString(); | 95 | return rxw.ToString(); |
96 | } | 96 | } |
97 | 97 | ||
98 | public string GetHandlerRegion(OSHttpResponse httpResponse, string param) | 98 | public string GetHandlerRegion(IOSHttpResponse httpResponse, string param) |
99 | { | 99 | { |
100 | // be resilient and don't get confused by a terminating '/' | 100 | // be resilient and don't get confused by a terminating '/' |
101 | param = param.TrimEnd(new char[]{'/'}); | 101 | param = param.TrimEnd(new char[]{'/'}); |
@@ -180,7 +180,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
180 | } | 180 | } |
181 | #endregion GET methods | 181 | #endregion GET methods |
182 | 182 | ||
183 | protected string RegionTerrain(OSHttpResponse httpResponse, Scene scene) | 183 | protected string RegionTerrain(IOSHttpResponse httpResponse, Scene scene) |
184 | { | 184 | { |
185 | httpResponse.SendChunked = true; | 185 | httpResponse.SendChunked = true; |
186 | httpResponse.ContentType = "text/xml"; | 186 | httpResponse.ContentType = "text/xml"; |
@@ -190,7 +190,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
190 | // "GET", "terrain not implemented"); | 190 | // "GET", "terrain not implemented"); |
191 | } | 191 | } |
192 | 192 | ||
193 | protected string RegionStats(OSHttpResponse httpResponse, Scene scene) | 193 | protected string RegionStats(IOSHttpResponse httpResponse, Scene scene) |
194 | { | 194 | { |
195 | int users = scene.GetRootAgentCount(); | 195 | int users = scene.GetRootAgentCount(); |
196 | int objects = scene.Entities.Count - users; | 196 | int objects = scene.Entities.Count - users; |
@@ -213,7 +213,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
213 | return rxw.ToString(); | 213 | return rxw.ToString(); |
214 | } | 214 | } |
215 | 215 | ||
216 | protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max) | 216 | protected string RegionPrims(IOSHttpResponse httpResponse, Scene scene, Vector3 min, Vector3 max) |
217 | { | 217 | { |
218 | httpResponse.SendChunked = true; | 218 | httpResponse.SendChunked = true; |
219 | httpResponse.ContentType = "text/xml"; | 219 | httpResponse.ContentType = "text/xml"; |
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs index 279db4c..468faea 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/GETRegionInfoHandler.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
40 | { | 40 | { |
41 | #region GET methods | 41 | #region GET methods |
42 | public string GetRegionInfoHandler(string request, string path, string param, | 42 | public string GetRegionInfoHandler(string request, string path, string param, |
43 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 43 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
44 | { | 44 | { |
45 | // foreach (string h in httpRequest.Headers.AllKeys) | 45 | // foreach (string h in httpRequest.Headers.AllKeys) |
46 | // foreach (string v in httpRequest.Headers.GetValues(h)) | 46 | // foreach (string v in httpRequest.Headers.GetValues(h)) |
@@ -64,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
64 | } | 64 | } |
65 | } | 65 | } |
66 | 66 | ||
67 | public string GetRegionInfoHandlerRegions(OSHttpResponse httpResponse) | 67 | public string GetRegionInfoHandlerRegions(IOSHttpResponse httpResponse) |
68 | { | 68 | { |
69 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); | 69 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); |
70 | 70 | ||
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index e0318e5..f666f45 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs | |||
@@ -40,7 +40,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
40 | #region POST methods | 40 | #region POST methods |
41 | 41 | ||
42 | public string PostHandler(string request, string path, string param, | 42 | public string PostHandler(string request, string path, string param, |
43 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 43 | IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
44 | { | 44 | { |
45 | // foreach (string h in httpRequest.Headers.AllKeys) | 45 | // foreach (string h in httpRequest.Headers.AllKeys) |
46 | // foreach (string v in httpRequest.Headers.GetValues(h)) | 46 | // foreach (string v in httpRequest.Headers.GetValues(h)) |
@@ -92,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
92 | } | 92 | } |
93 | } | 93 | } |
94 | 94 | ||
95 | public string CreateRegion(OSHttpRequest request, OSHttpResponse response) | 95 | public string CreateRegion(IOSHttpRequest request, IOSHttpResponse response) |
96 | { | 96 | { |
97 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); | 97 | RestXmlWriter rxw = new RestXmlWriter(new StringWriter()); |
98 | 98 | ||
@@ -108,7 +108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
108 | return rxw.ToString(); | 108 | return rxw.ToString(); |
109 | } | 109 | } |
110 | 110 | ||
111 | public string LoadPrims(string requestBody, OSHttpRequest request, OSHttpResponse response, Scene scene) | 111 | public string LoadPrims(string requestBody, IOSHttpRequest request, IOSHttpResponse response, Scene scene) |
112 | { | 112 | { |
113 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); | 113 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); |
114 | if (serialiser != null) | 114 | if (serialiser != null) |
diff --git a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs index ff1502a..eb16750 100644 --- a/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs +++ b/OpenSim/ApplicationPlugins/Rest/RestPlugin.cs | |||
@@ -328,7 +328,7 @@ namespace OpenSim.ApplicationPlugins.Rest | |||
328 | /// </summary> | 328 | /// </summary> |
329 | /// <param name="request">HTTP request header</param> | 329 | /// <param name="request">HTTP request header</param> |
330 | /// <returns>true when the HTTP request came from god.</returns> | 330 | /// <returns>true when the HTTP request came from god.</returns> |
331 | protected bool IsGod(OSHttpRequest request) | 331 | protected bool IsGod(IOSHttpRequest request) |
332 | { | 332 | { |
333 | string[] keys = request.Headers.GetValues("X-OpenSim-Godkey"); | 333 | string[] keys = request.Headers.GetValues("X-OpenSim-Godkey"); |
334 | if (null == keys) return false; | 334 | if (null == keys) return false; |
@@ -342,7 +342,7 @@ namespace OpenSim.ApplicationPlugins.Rest | |||
342 | /// HTTP header is indeed the password on file for the avatar | 342 | /// HTTP header is indeed the password on file for the avatar |
343 | /// specified by the UUID | 343 | /// specified by the UUID |
344 | /// </summary> | 344 | /// </summary> |
345 | protected bool IsVerifiedUser(OSHttpRequest request, UUID uuid) | 345 | protected bool IsVerifiedUser(IOSHttpRequest request, UUID uuid) |
346 | { | 346 | { |
347 | // XXX under construction | 347 | // XXX under construction |
348 | return false; | 348 | return false; |
@@ -377,7 +377,7 @@ namespace OpenSim.ApplicationPlugins.Rest | |||
377 | /// <param name="message">failure message</param> | 377 | /// <param name="message">failure message</param> |
378 | /// <remarks>This should probably set a return code as | 378 | /// <remarks>This should probably set a return code as |
379 | /// well. (?)</remarks> | 379 | /// well. (?)</remarks> |
380 | protected string Failure(OSHttpResponse response, OSHttpStatusCode status, | 380 | protected string Failure(IOSHttpResponse response, OSHttpStatusCode status, |
381 | string method, string format, params string[] msg) | 381 | string method, string format, params string[] msg) |
382 | { | 382 | { |
383 | string m = String.Format(format, msg); | 383 | string m = String.Format(format, msg); |
@@ -396,7 +396,7 @@ namespace OpenSim.ApplicationPlugins.Rest | |||
396 | /// <param name="e">exception causing the failure message</param> | 396 | /// <param name="e">exception causing the failure message</param> |
397 | /// <remarks>This should probably set a return code as | 397 | /// <remarks>This should probably set a return code as |
398 | /// well. (?)</remarks> | 398 | /// well. (?)</remarks> |
399 | public string Failure(OSHttpResponse response, OSHttpStatusCode status, | 399 | public string Failure(IOSHttpResponse response, OSHttpStatusCode status, |
400 | string method, Exception e) | 400 | string method, Exception e) |
401 | { | 401 | { |
402 | string m = String.Format("exception occurred: {0}", e.Message); | 402 | string m = String.Format("exception occurred: {0}", e.Message); |