diff options
author | Oren Hurvitz | 2014-04-24 08:19:05 +0300 |
---|---|---|
committer | Oren Hurvitz | 2014-04-24 06:19:57 +0100 |
commit | 6efc203ce88566a1288eb1f7225f93db1c0af541 (patch) | |
tree | 3fec07bc5493d00336e31b8cd81b780dcf2eaa24 /OpenSim/Services/GridService | |
parent | Removed unused CsharpSqlite DLLs (diff) | |
download | opensim-SC_OLD-6efc203ce88566a1288eb1f7225f93db1c0af541.zip opensim-SC_OLD-6efc203ce88566a1288eb1f7225f93db1c0af541.tar.gz opensim-SC_OLD-6efc203ce88566a1288eb1f7225f93db1c0af541.tar.bz2 opensim-SC_OLD-6efc203ce88566a1288eb1f7225f93db1c0af541.tar.xz |
Fixed: hypergrid-linking stopped accepting the following format: "http://grid.example.com" (without a region name)
Fixes http://opensimulator.org/mantis/view.php?id=7128
Diffstat (limited to 'OpenSim/Services/GridService')
-rw-r--r-- | OpenSim/Services/GridService/HypergridLinker.cs | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/OpenSim/Services/GridService/HypergridLinker.cs b/OpenSim/Services/GridService/HypergridLinker.cs index 1cc75c1..bf52660 100644 --- a/OpenSim/Services/GridService/HypergridLinker.cs +++ b/OpenSim/Services/GridService/HypergridLinker.cs | |||
@@ -200,10 +200,13 @@ namespace OpenSim.Services.GridService | |||
200 | reason = string.Empty; | 200 | reason = string.Empty; |
201 | GridRegion regInfo = null; | 201 | GridRegion regInfo = null; |
202 | 202 | ||
203 | mapName = mapName.Trim(); | ||
204 | |||
203 | if (!mapName.StartsWith("http")) | 205 | if (!mapName.StartsWith("http")) |
204 | { | 206 | { |
205 | // Formats: grid.example.com:8002:region name | 207 | // Formats: grid.example.com:8002:region name |
206 | // grid.example.com:region name | 208 | // grid.example.com:region name |
209 | // grid.example.com:8002 | ||
207 | // grid.example.com | 210 | // grid.example.com |
208 | 211 | ||
209 | string host; | 212 | string host; |
@@ -222,11 +225,11 @@ namespace OpenSim.Services.GridService | |||
222 | 225 | ||
223 | if (parts.Length >= 2) | 226 | if (parts.Length >= 2) |
224 | { | 227 | { |
225 | string portstr = parts[1]; | 228 | // If it's a number then assume it's a port. Otherwise, it's a region name. |
226 | //m_log.Debug("-- port = " + portstr); | 229 | if (!UInt32.TryParse(parts[1], out port)) |
227 | if (!UInt32.TryParse(portstr, out port)) | ||
228 | regionName = parts[1]; | 230 | regionName = parts[1]; |
229 | } | 231 | } |
232 | |||
230 | // always take the last one | 233 | // always take the last one |
231 | if (parts.Length >= 3) | 234 | if (parts.Length >= 3) |
232 | { | 235 | { |
@@ -245,21 +248,28 @@ namespace OpenSim.Services.GridService | |||
245 | { | 248 | { |
246 | // Formats: http://grid.example.com region name | 249 | // Formats: http://grid.example.com region name |
247 | // http://grid.example.com "region name" | 250 | // http://grid.example.com "region name" |
248 | 251 | // http://grid.example.com | |
249 | string regionName; | 252 | |
253 | string serverURI; | ||
254 | string regionName = ""; | ||
250 | 255 | ||
251 | string[] parts = mapName.Split(new char[] { ' ' }); | 256 | string[] parts = mapName.Split(new char[] { ' ' }); |
252 | 257 | ||
253 | if (parts.Length < 2) | 258 | if (parts.Length == 0) |
254 | { | 259 | { |
255 | reason = "Wrong format for link-region"; | 260 | reason = "Wrong format for link-region"; |
256 | return null; | 261 | return null; |
257 | } | 262 | } |
258 | 263 | ||
259 | regionName = mapName.Substring(parts[0].Length + 1); | 264 | serverURI = parts[0]; |
260 | regionName = regionName.Trim(new char[] {'"'}); | 265 | |
261 | 266 | if (parts.Length >= 2) | |
262 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, parts[0], ownerID, out regInfo, out reason)) | 267 | { |
268 | regionName = mapName.Substring(serverURI.Length); | ||
269 | regionName = regionName.Trim(new char[] { '"', ' ' }); | ||
270 | } | ||
271 | |||
272 | if (TryCreateLink(scopeID, xloc, yloc, regionName, 0, null, serverURI, ownerID, out regInfo, out reason)) | ||
263 | { | 273 | { |
264 | regInfo.RegionName = mapName; | 274 | regInfo.RegionName = mapName; |
265 | return regInfo; | 275 | return regInfo; |