diff options
Diffstat (limited to 'OpenSim/Server/Handlers/Map')
-rw-r--r-- | OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index ea68114..083a628 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -38,6 +38,7 @@ using OpenMetaverse; | |||
38 | using OpenSim.Framework; | 38 | using OpenSim.Framework; |
39 | using OpenSim.Server.Base; | 39 | using OpenSim.Server.Base; |
40 | using OpenSim.Services.Interfaces; | 40 | using OpenSim.Services.Interfaces; |
41 | using OpenSim.Framework.ServiceAuth; | ||
41 | using OpenSim.Framework.Servers.HttpServer; | 42 | using OpenSim.Framework.Servers.HttpServer; |
42 | using OpenSim.Server.Handlers.Base; | 43 | using OpenSim.Server.Handlers.Base; |
43 | 44 | ||
@@ -79,7 +80,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
79 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); | 80 | m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF"); |
80 | 81 | ||
81 | bool proxy = serverConfig.GetBoolean("HasProxy", false); | 82 | bool proxy = serverConfig.GetBoolean("HasProxy", false); |
82 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy)); | 83 | IServiceAuth auth = ServiceAuth.Create(config, m_ConfigName); |
84 | server.AddStreamHandler(new MapServerPostHandler(m_MapService, m_GridService, proxy, auth)); | ||
83 | 85 | ||
84 | } | 86 | } |
85 | } | 87 | } |
@@ -91,8 +93,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
91 | private IGridService m_GridService; | 93 | private IGridService m_GridService; |
92 | bool m_Proxy; | 94 | bool m_Proxy; |
93 | 95 | ||
94 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy) : | 96 | public MapServerPostHandler(IMapImageService service, IGridService grid, bool proxy, IServiceAuth auth) : |
95 | base("POST", "/map") | 97 | base("POST", "/map", auth) |
96 | { | 98 | { |
97 | m_MapService = service; | 99 | m_MapService = service; |
98 | m_GridService = grid; | 100 | m_GridService = grid; |
@@ -116,6 +118,11 @@ namespace OpenSim.Server.Handlers.MapImage | |||
116 | httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; | 118 | httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; |
117 | return FailureResult("Bad request."); | 119 | return FailureResult("Bad request."); |
118 | } | 120 | } |
121 | <<<<<<< HEAD | ||
122 | uint x = 0, y = 0; | ||
123 | UInt32.TryParse(request["X"].ToString(), out x); | ||
124 | UInt32.TryParse(request["Y"].ToString(), out y); | ||
125 | ======= | ||
119 | int x = 0, y = 0; | 126 | int x = 0, y = 0; |
120 | // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); | 127 | // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); |
121 | UUID scopeID = UUID.Zero; | 128 | UUID scopeID = UUID.Zero; |
@@ -123,6 +130,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
123 | Int32.TryParse(request["Y"].ToString(), out y); | 130 | Int32.TryParse(request["Y"].ToString(), out y); |
124 | if (request.ContainsKey("SCOPE")) | 131 | if (request.ContainsKey("SCOPE")) |
125 | UUID.TryParse(request["SCOPE"].ToString(), out scopeID); | 132 | UUID.TryParse(request["SCOPE"].ToString(), out scopeID); |
133 | >>>>>>> avn/ubitvar | ||
126 | 134 | ||
127 | m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); | 135 | m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); |
128 | 136 | ||
@@ -134,7 +142,11 @@ namespace OpenSim.Server.Handlers.MapImage | |||
134 | if (m_GridService != null) | 142 | if (m_GridService != null) |
135 | { | 143 | { |
136 | System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); | 144 | System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); |
145 | <<<<<<< HEAD | ||
146 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); | ||
147 | ======= | ||
137 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); | 148 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); |
149 | >>>>>>> avn/ubitvar | ||
138 | if (r != null) | 150 | if (r != null) |
139 | { | 151 | { |
140 | if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) | 152 | if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) |
@@ -155,7 +167,11 @@ namespace OpenSim.Server.Handlers.MapImage | |||
155 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); | 167 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); |
156 | 168 | ||
157 | string reason = string.Empty; | 169 | string reason = string.Empty; |
170 | <<<<<<< HEAD | ||
171 | bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); | ||
172 | ======= | ||
158 | bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); | 173 | bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason); |
174 | >>>>>>> avn/ubitvar | ||
159 | 175 | ||
160 | if (result) | 176 | if (result) |
161 | return SuccessResult(); | 177 | return SuccessResult(); |
@@ -190,7 +206,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
190 | 206 | ||
191 | rootElement.AppendChild(result); | 207 | rootElement.AppendChild(result); |
192 | 208 | ||
193 | return DocToBytes(doc); | 209 | return Util.DocToBytes(doc); |
194 | } | 210 | } |
195 | 211 | ||
196 | private byte[] FailureResult(string msg) | 212 | private byte[] FailureResult(string msg) |
@@ -217,18 +233,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
217 | 233 | ||
218 | rootElement.AppendChild(message); | 234 | rootElement.AppendChild(message); |
219 | 235 | ||
220 | return DocToBytes(doc); | 236 | return Util.DocToBytes(doc); |
221 | } | ||
222 | |||
223 | private byte[] DocToBytes(XmlDocument doc) | ||
224 | { | ||
225 | MemoryStream ms = new MemoryStream(); | ||
226 | XmlTextWriter xw = new XmlTextWriter(ms, null); | ||
227 | xw.Formatting = Formatting.Indented; | ||
228 | doc.WriteTo(xw); | ||
229 | xw.Flush(); | ||
230 | |||
231 | return ms.ToArray(); | ||
232 | } | 237 | } |
233 | 238 | ||
234 | private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) | 239 | private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) |