diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs index 649a27e..331dabf 100644 --- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs +++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs | |||
@@ -104,9 +104,9 @@ namespace OpenSim.Server.Handlers.MapImage | |||
104 | protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) | 104 | protected override byte[] ProcessRequest(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) |
105 | { | 105 | { |
106 | // m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); | 106 | // m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path); |
107 | StreamReader sr = new StreamReader(requestData); | 107 | string body; |
108 | string body = sr.ReadToEnd(); | 108 | using(StreamReader sr = new StreamReader(requestData)) |
109 | sr.Close(); | 109 | body = sr.ReadToEnd(); |
110 | body = body.Trim(); | 110 | body = body.Trim(); |
111 | 111 | ||
112 | try | 112 | try |
@@ -118,9 +118,13 @@ namespace OpenSim.Server.Handlers.MapImage | |||
118 | httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; | 118 | httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest; |
119 | return FailureResult("Bad request."); | 119 | return FailureResult("Bad request."); |
120 | } | 120 | } |
121 | uint x = 0, y = 0; | 121 | int x = 0, y = 0; |
122 | UInt32.TryParse(request["X"].ToString(), out x); | 122 | // UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992"); |
123 | UInt32.TryParse(request["Y"].ToString(), out y); | 123 | UUID scopeID = UUID.Zero; |
124 | Int32.TryParse(request["X"].ToString(), out x); | ||
125 | Int32.TryParse(request["Y"].ToString(), out y); | ||
126 | if (request.ContainsKey("SCOPE")) | ||
127 | UUID.TryParse(request["SCOPE"].ToString(), out scopeID); | ||
124 | 128 | ||
125 | m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); | 129 | m_log.DebugFormat("[MAP ADD SERVER CONNECTOR]: Received map data for region at {0}-{1}", x, y); |
126 | 130 | ||
@@ -132,7 +136,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
132 | if (m_GridService != null) | 136 | if (m_GridService != null) |
133 | { | 137 | { |
134 | System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); | 138 | System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); |
135 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); | 139 | GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y)); |
136 | if (r != null) | 140 | if (r != null) |
137 | { | 141 | { |
138 | if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) | 142 | if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) |
@@ -144,7 +148,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
144 | } | 148 | } |
145 | else | 149 | else |
146 | { | 150 | { |
147 | m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", | 151 | m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}", |
148 | ipAddr, x, y); | 152 | ipAddr, x, y); |
149 | return FailureResult("Region not found at given coordinates"); | 153 | return FailureResult("Region not found at given coordinates"); |
150 | } | 154 | } |
@@ -153,7 +157,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
153 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); | 157 | byte[] data = Convert.FromBase64String(request["DATA"].ToString()); |
154 | 158 | ||
155 | string reason = string.Empty; | 159 | string reason = string.Empty; |
156 | bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); | 160 | |
161 | bool result = m_MapService.AddMapTile((int)x, (int)y, data, scopeID, out reason); | ||
157 | 162 | ||
158 | if (result) | 163 | if (result) |
159 | return SuccessResult(); | 164 | return SuccessResult(); |
@@ -220,8 +225,8 @@ namespace OpenSim.Server.Handlers.MapImage | |||
220 | 225 | ||
221 | private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) | 226 | private System.Net.IPAddress GetCallerIP(IOSHttpRequest request) |
222 | { | 227 | { |
223 | if (!m_Proxy) | 228 | // if (!m_Proxy) |
224 | return request.RemoteIPEndPoint.Address; | 229 | // return request.RemoteIPEndPoint.Address; |
225 | 230 | ||
226 | // We're behind a proxy | 231 | // We're behind a proxy |
227 | string xff = "X-Forwarded-For"; | 232 | string xff = "X-Forwarded-For"; |
@@ -231,7 +236,7 @@ namespace OpenSim.Server.Handlers.MapImage | |||
231 | 236 | ||
232 | if (xffValue == null || (xffValue != null && xffValue == string.Empty)) | 237 | if (xffValue == null || (xffValue != null && xffValue == string.Empty)) |
233 | { | 238 | { |
234 | m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); | 239 | // m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header"); |
235 | return request.RemoteIPEndPoint.Address; | 240 | return request.RemoteIPEndPoint.Address; |
236 | } | 241 | } |
237 | 242 | ||