diff options
Diffstat (limited to 'OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs')
-rw-r--r-- | OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs index 00fe0d2..e6131f1 100644 --- a/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs +++ b/OpenSim/ApplicationPlugins/Rest/Regions/POSTHandler.cs | |||
@@ -1,30 +1,29 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
5 | * Redistribution and use in source and binary forms, with or without | 5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions are met: | 6 | * modification, are permitted provided that the following conditions are met: |
7 | * * Redistributions of source code must retain the above copyright | 7 | * * Redistributions of source code must retain the above copyright |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. |
9 | * * Redistributions in binary form must reproduce the above copyright | 9 | * * Redistributions in binary form must reproduce the above copyright |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. |
12 | * * Neither the name of the OpenSim Project nor the | 12 | * * Neither the name of the OpenSim Project nor the |
13 | * names of its contributors may be used to endorse or promote products | 13 | * names of its contributors may be used to endorse or promote products |
14 | * derived from this software without specific prior written permission. | 14 | * derived from this software without specific prior written permission. |
15 | * | 15 | * |
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | 16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY |
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | 19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY |
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 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 | 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 | 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 | 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. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | * | 26 | */ |
27 | */ | ||
28 | 27 | ||
29 | using System; | 28 | using System; |
30 | using System.Threading; | 29 | using System.Threading; |
@@ -54,10 +53,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
54 | public partial class RestRegionPlugin : RestPlugin | 53 | public partial class RestRegionPlugin : RestPlugin |
55 | { | 54 | { |
56 | #region POST methods | 55 | #region POST methods |
57 | public string PostHandler(string request, string path, string param, | 56 | public string PostHandler(string request, string path, string param, |
58 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) | 57 | OSHttpRequest httpRequest, OSHttpResponse httpResponse) |
59 | { | 58 | { |
60 | // foreach (string h in httpRequest.Headers.AllKeys) | 59 | // foreach (string h in httpRequest.Headers.AllKeys) |
61 | // foreach (string v in httpRequest.Headers.GetValues(h)) | 60 | // foreach (string v in httpRequest.Headers.GetValues(h)) |
62 | // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v); | 61 | // m_log.DebugFormat("{0} IsGod: {1} -> {2}", MsgID, h, v); |
63 | 62 | ||
@@ -67,17 +66,17 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
67 | try | 66 | try |
68 | { | 67 | { |
69 | // param empty: new region post | 68 | // param empty: new region post |
70 | if (!IsGod(httpRequest)) | 69 | if (!IsGod(httpRequest)) |
71 | // XXX: this needs to be turned into a FailureUnauthorized(...) | 70 | // XXX: this needs to be turned into a FailureUnauthorized(...) |
72 | return Failure(httpResponse, OSHttpStatusCode.ClientErrorUnauthorized, | 71 | return Failure(httpResponse, OSHttpStatusCode.ClientErrorUnauthorized, |
73 | "GET", "you are not god"); | 72 | "GET", "you are not god"); |
74 | 73 | ||
75 | if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse); | 74 | if (String.IsNullOrEmpty(param)) return CreateRegion(httpRequest, httpResponse); |
76 | 75 | ||
77 | return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound, | 76 | return Failure(httpResponse, OSHttpStatusCode.ClientErrorNotFound, |
78 | "POST", "url {0} not supported", param); | 77 | "POST", "url {0} not supported", param); |
79 | } | 78 | } |
80 | catch (Exception e) | 79 | catch (Exception e) |
81 | { | 80 | { |
82 | return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "POST", e); | 81 | return Failure(httpResponse, OSHttpStatusCode.ServerErrorInternalError, "POST", e); |
83 | } | 82 | } |
@@ -93,7 +92,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions | |||
93 | XmlWriter.WriteEndElement(); | 92 | XmlWriter.WriteEndElement(); |
94 | } | 93 | } |
95 | XmlWriter.WriteEndElement(); | 94 | XmlWriter.WriteEndElement(); |
96 | 95 | ||
97 | return XmlWriterResult; | 96 | return XmlWriterResult; |
98 | } | 97 | } |
99 | #endregion POST methods | 98 | #endregion POST methods |