aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Server
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Server
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to 'OpenSim/Server')
-rw-r--r--OpenSim/Server/Base/HttpServerBase.cs30
-rw-r--r--OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs9
-rw-r--r--OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs3
-rw-r--r--OpenSim/Server/Handlers/Login/LLLoginHandlers.cs11
-rw-r--r--OpenSim/Server/Handlers/Map/MapAddServerConnector.cs18
-rw-r--r--OpenSim/Server/Handlers/Map/MapGetServerConnector.cs28
-rw-r--r--OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs253
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs2
-rw-r--r--OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs3
-rw-r--r--OpenSim/Server/Handlers/Simulation/AgentHandlers.cs39
-rw-r--r--OpenSim/Server/ServerMain.cs5
11 files changed, 390 insertions, 11 deletions
diff --git a/OpenSim/Server/Base/HttpServerBase.cs b/OpenSim/Server/Base/HttpServerBase.cs
index 44ef124..a18cdc1 100644
--- a/OpenSim/Server/Base/HttpServerBase.cs
+++ b/OpenSim/Server/Base/HttpServerBase.cs
@@ -40,7 +40,7 @@ namespace OpenSim.Server.Base
40{ 40{
41 public class HttpServerBase : ServicesServerBase 41 public class HttpServerBase : ServicesServerBase
42 { 42 {
43// private static readonly ILog m_Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
44 44
45 private uint m_consolePort; 45 private uint m_consolePort;
46 46
@@ -70,6 +70,7 @@ namespace OpenSim.Server.Base
70 70
71 bool ssl_main = networkConfig.GetBoolean("https_main",false); 71 bool ssl_main = networkConfig.GetBoolean("https_main",false);
72 bool ssl_listener = networkConfig.GetBoolean("https_listener",false); 72 bool ssl_listener = networkConfig.GetBoolean("https_listener",false);
73 bool ssl_external = networkConfig.GetBoolean("https_external",false);
73 74
74 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0); 75 m_consolePort = (uint)networkConfig.GetInt("ConsolePort", 0);
75 76
@@ -115,6 +116,7 @@ namespace OpenSim.Server.Base
115 { 116 {
116 uint https_port = (uint)networkConfig.GetInt("https_port", 0); 117 uint https_port = (uint)networkConfig.GetInt("https_port", 0);
117 118
119<<<<<<< HEAD
118 string cert_path = networkConfig.GetString("cert_path",String.Empty); 120 string cert_path = networkConfig.GetString("cert_path",String.Empty);
119 if (cert_path == String.Empty) 121 if (cert_path == String.Empty)
120 { 122 {
@@ -127,9 +129,31 @@ namespace OpenSim.Server.Base
127 { 129 {
128 System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start."); 130 System.Console.WriteLine("ERROR: Password for X509 certificate is missing, server can't start.");
129 Environment.Exit(1); 131 Environment.Exit(1);
132=======
133 m_log.WarnFormat("[SSL]: External flag is {0}", ssl_external);
134 if (!ssl_external)
135 {
136 string cert_path = networkConfig.GetString("cert_path",String.Empty);
137 if ( cert_path == String.Empty )
138 {
139 System.Console.WriteLine("Path to X509 certificate is missing, server can't start.");
140 Thread.CurrentThread.Abort();
141 }
142 string cert_pass = networkConfig.GetString("cert_pass",String.Empty);
143 if ( cert_pass == String.Empty )
144 {
145 System.Console.WriteLine("Password for X509 certificate is missing, server can't start.");
146 Thread.CurrentThread.Abort();
147 }
148
149 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
150 }
151 else
152 {
153 m_log.WarnFormat("[SSL]: SSL port is active but no SSL is used because external SSL was requested.");
154 MainServer.AddHttpServer(new BaseHttpServer(https_port));
155>>>>>>> avn/ubitvar
130 } 156 }
131
132 MainServer.AddHttpServer(new BaseHttpServer(https_port, ssl_listener, cert_path, cert_pass));
133 } 157 }
134 } 158 }
135 159
diff --git a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
index e38543b..502cecf 100644
--- a/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
+++ b/OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
@@ -45,12 +45,19 @@ namespace OpenSim.Server.Handlers.BakedTextures
45{ 45{
46 public class BakesServerPostHandler : BaseStreamHandler 46 public class BakesServerPostHandler : BaseStreamHandler
47 { 47 {
48<<<<<<< HEAD:OpenSim/Server/Handlers/BakedTextures/XBakesPostHandler.cs
48// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 49// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
49 50
50 private IBakedTextureService m_BakesService; 51 private IBakedTextureService m_BakesService;
51 52
52 public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) : 53 public BakesServerPostHandler(IBakedTextureService service, IServiceAuth auth) :
53 base("POST", "/bakes", auth) 54 base("POST", "/bakes", auth)
55=======
56 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
57
58 public MSSQLAvatarData(string connectionString, string realm) :
59 base(connectionString, realm, "Avatar")
60>>>>>>> avn/ubitvar:OpenSim/Data/MSSQL/MSSQLAvatarData.cs
54 { 61 {
55 m_BakesService = service; 62 m_BakesService = service;
56 } 63 }
@@ -73,4 +80,4 @@ namespace OpenSim.Server.Handlers.BakedTextures
73 return new byte[0]; 80 return new byte[0];
74 } 81 }
75 } 82 }
76} \ No newline at end of file 83}
diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
index 9237c63..b63b594 100644
--- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
+++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs
@@ -185,6 +185,9 @@ namespace OpenSim.Server.Handlers.GridUser
185 185
186 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); 186 GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user);
187 187
188 if (guinfo == null)
189 return FailureResult();
190
188 Dictionary<string, object> result = new Dictionary<string, object>(); 191 Dictionary<string, object> result = new Dictionary<string, object>();
189 if (guinfo != null) 192 if (guinfo != null)
190 result["result"] = guinfo.ToKeyValuePairs(); 193 result["result"] = guinfo.ToKeyValuePairs();
diff --git a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
index f2a5678..5d672c3 100644
--- a/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
+++ b/OpenSim/Server/Handlers/Login/LLLoginHandlers.cs
@@ -132,8 +132,13 @@ namespace OpenSim.Server.Handlers.Login
132 132
133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion); 133 //m_log.InfoFormat("[LOGIN]: XMLRPC Login Requested for {0} {1}, starting in {2}, using {3}", first, last, startLocation, clientVersion);
134 134
135
136 bool LibOMVclient = false;
137 if (request.Params.Count > 4 && (string)request.Params[4] == "gridproxy")
138 LibOMVclient = true;
139
135 LoginResponse reply = null; 140 LoginResponse reply = null;
136 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient); 141 reply = m_LocalService.Login(first, last, passwd, startLocation, scopeID, clientVersion, channel, mac, id0, remoteClient, LibOMVclient);
137 142
138 XmlRpcResponse response = new XmlRpcResponse(); 143 XmlRpcResponse response = new XmlRpcResponse();
139 response.Value = reply.ToHashtable(); 144 response.Value = reply.ToHashtable();
@@ -216,7 +221,7 @@ namespace OpenSim.Server.Handlers.Login
216 221
217 LoginResponse reply = null; 222 LoginResponse reply = null;
218 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID, 223 reply = m_LocalService.Login(map["first"].AsString(), map["last"].AsString(), map["passwd"].AsString(), startLocation, scopeID,
219 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient); 224 map["version"].AsString(), map["channel"].AsString(), map["mac"].AsString(), map["id0"].AsString(), remoteClient,false);
220 return reply.ToOSDMap(); 225 return reply.ToOSDMap();
221 226
222 } 227 }
@@ -259,7 +264,7 @@ namespace OpenSim.Server.Handlers.Login
259 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint(); 264 (sender as WebSocketHttpServerHandler).GetRemoteIPEndpoint();
260 LoginResponse reply = null; 265 LoginResponse reply = null;
261 reply = m_LocalService.Login(first, last, passwd, start, scope, version, 266 reply = m_LocalService.Login(first, last, passwd, start, scope, version,
262 channel, mac, id0, endPoint); 267 channel, mac, id0, endPoint,false);
263 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap())); 268 sock.SendMessage(OSDParser.SerializeJsonString(reply.ToOSDMap()));
264 269
265 } 270 }
diff --git a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
index 649a27e..083a628 100644
--- a/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapAddServerConnector.cs
@@ -118,9 +118,19 @@ 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<<<<<<< HEAD
121 uint x = 0, y = 0; 122 uint x = 0, y = 0;
122 UInt32.TryParse(request["X"].ToString(), out x); 123 UInt32.TryParse(request["X"].ToString(), out x);
123 UInt32.TryParse(request["Y"].ToString(), out y); 124 UInt32.TryParse(request["Y"].ToString(), out y);
125=======
126 int x = 0, y = 0;
127// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
128 UUID scopeID = UUID.Zero;
129 Int32.TryParse(request["X"].ToString(), out x);
130 Int32.TryParse(request["Y"].ToString(), out y);
131 if (request.ContainsKey("SCOPE"))
132 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
133>>>>>>> avn/ubitvar
124 134
125 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);
126 136
@@ -132,7 +142,11 @@ namespace OpenSim.Server.Handlers.MapImage
132 if (m_GridService != null) 142 if (m_GridService != null)
133 { 143 {
134 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest); 144 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
145<<<<<<< HEAD
135 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y)); 146 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc(x), (int)Util.RegionToWorldLoc(y));
147=======
148 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y));
149>>>>>>> avn/ubitvar
136 if (r != null) 150 if (r != null)
137 { 151 {
138 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString()) 152 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
@@ -153,7 +167,11 @@ namespace OpenSim.Server.Handlers.MapImage
153 byte[] data = Convert.FromBase64String(request["DATA"].ToString()); 167 byte[] data = Convert.FromBase64String(request["DATA"].ToString());
154 168
155 string reason = string.Empty; 169 string reason = string.Empty;
170<<<<<<< HEAD
156 bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason); 171 bool result = m_MapService.AddMapTile((int)x, (int)y, data, out reason);
172=======
173 bool result = m_MapService.AddMapTile(x, y, data, scopeID, out reason);
174>>>>>>> avn/ubitvar
157 175
158 if (result) 176 if (result)
159 return SuccessResult(); 177 return SuccessResult();
diff --git a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
index 7bb2f39..1ae669c 100644
--- a/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Map/MapGetServerConnector.cs
@@ -29,6 +29,7 @@ using System;
29using System.IO; 29using System.IO;
30using System.Net; 30using System.Net;
31using System.Reflection; 31using System.Reflection;
32using System.Threading;
32 33
33using Nini.Config; 34using Nini.Config;
34using log4net; 35using log4net;
@@ -37,6 +38,7 @@ using OpenSim.Server.Base;
37using OpenSim.Services.Interfaces; 38using OpenSim.Services.Interfaces;
38using OpenSim.Framework.Servers.HttpServer; 39using OpenSim.Framework.Servers.HttpServer;
39using OpenSim.Server.Handlers.Base; 40using OpenSim.Server.Handlers.Base;
41using OpenMetaverse;
40 42
41namespace OpenSim.Server.Handlers.MapImage 43namespace OpenSim.Server.Handlers.MapImage
42{ 44{
@@ -70,6 +72,8 @@ namespace OpenSim.Server.Handlers.MapImage
70 72
71 class MapServerGetHandler : BaseStreamHandler 73 class MapServerGetHandler : BaseStreamHandler
72 { 74 {
75 public static ManualResetEvent ev = new ManualResetEvent(true);
76
73// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 77// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
74 78
75 private IMapImageService m_MapService; 79 private IMapImageService m_MapService;
@@ -82,10 +86,25 @@ namespace OpenSim.Server.Handlers.MapImage
82 86
83 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse) 87 protected override byte[] ProcessRequest(string path, Stream request, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
84 { 88 {
85 byte[] result = new byte[0]; 89 ev.WaitOne();
90 lock (ev)
91 {
92 ev.Reset();
93 }
86 94
95 byte[] result = new byte[0];
87 string format = string.Empty; 96 string format = string.Empty;
88 result = m_MapService.GetMapTile(path.Trim('/'), out format); 97
98// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
99 UUID scopeID = UUID.Zero;
100
101 string[] bits = path.Trim('/').Split(new char[] {'/'});
102 if (bits.Length > 1)
103 {
104 scopeID = new UUID(bits[0]);
105 path = bits[1];
106 }
107 result = m_MapService.GetMapTile(path.Trim('/'), scopeID, out format);
89 if (result.Length > 0) 108 if (result.Length > 0)
90 { 109 {
91 httpResponse.StatusCode = (int)HttpStatusCode.OK; 110 httpResponse.StatusCode = (int)HttpStatusCode.OK;
@@ -100,6 +119,11 @@ namespace OpenSim.Server.Handlers.MapImage
100 httpResponse.ContentType = "text/plain"; 119 httpResponse.ContentType = "text/plain";
101 } 120 }
102 121
122 lock (ev)
123 {
124 ev.Set();
125 }
126
103 return result; 127 return result;
104 } 128 }
105 129
diff --git a/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
new file mode 100644
index 0000000..4f8f7e1
--- /dev/null
+++ b/OpenSim/Server/Handlers/Map/MapRemoveServerConnector.cs
@@ -0,0 +1,253 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
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
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
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Xml;
33
34using Nini.Config;
35using log4net;
36using OpenMetaverse;
37
38using OpenSim.Framework;
39using OpenSim.Server.Base;
40using OpenSim.Services.Interfaces;
41using OpenSim.Framework.Servers.HttpServer;
42using OpenSim.Server.Handlers.Base;
43
44using GridRegion = OpenSim.Services.Interfaces.GridRegion;
45
46namespace OpenSim.Server.Handlers.MapImage
47{
48 public class MapRemoveServiceConnector : ServiceConnector
49 {
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private IMapImageService m_MapService;
53 private IGridService m_GridService;
54 private string m_ConfigName = "MapImageService";
55
56 public MapRemoveServiceConnector(IConfigSource config, IHttpServer server, string configName) :
57 base(config, server, configName)
58 {
59 IConfig serverConfig = config.Configs[m_ConfigName];
60 if (serverConfig == null)
61 throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
62
63 string mapService = serverConfig.GetString("LocalServiceModule",
64 String.Empty);
65
66 if (mapService == String.Empty)
67 throw new Exception("No LocalServiceModule in config file");
68
69 Object[] args = new Object[] { config };
70 m_MapService = ServerUtils.LoadPlugin<IMapImageService>(mapService, args);
71
72 string gridService = serverConfig.GetString("GridService", String.Empty);
73 if (gridService != string.Empty)
74 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
75
76 if (m_GridService != null)
77 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is ON");
78 else
79 m_log.InfoFormat("[MAP IMAGE HANDLER]: GridService check is OFF");
80
81 bool proxy = serverConfig.GetBoolean("HasProxy", false);
82 server.AddStreamHandler(new MapServerRemoveHandler(m_MapService, m_GridService, proxy));
83
84 }
85 }
86
87 class MapServerRemoveHandler : BaseStreamHandler
88 {
89 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
90 private IMapImageService m_MapService;
91 private IGridService m_GridService;
92 bool m_Proxy;
93
94 public MapServerRemoveHandler(IMapImageService service, IGridService grid, bool proxy) :
95 base("POST", "/removemap")
96 {
97 m_MapService = service;
98 m_GridService = grid;
99 m_Proxy = proxy;
100 }
101
102 public override byte[] Handle(string path, Stream requestData, IOSHttpRequest httpRequest, IOSHttpResponse httpResponse)
103 {
104// m_log.DebugFormat("[MAP SERVICE IMAGE HANDLER]: Received {0}", path);
105 StreamReader sr = new StreamReader(requestData);
106 string body = sr.ReadToEnd();
107 sr.Close();
108 body = body.Trim();
109
110 try
111 {
112 Dictionary<string, object> request = ServerUtils.ParseQueryString(body);
113
114 if (!request.ContainsKey("X") || !request.ContainsKey("Y"))
115 {
116 httpResponse.StatusCode = (int)OSHttpStatusCode.ClientErrorBadRequest;
117 return FailureResult("Bad request.");
118 }
119 int x = 0, y = 0;
120 Int32.TryParse(request["X"].ToString(), out x);
121 Int32.TryParse(request["Y"].ToString(), out y);
122// UUID scopeID = new UUID("07f8d88e-cd5e-4239-a0ed-843f75d09992");
123 UUID scopeID = UUID.Zero;
124 if (request.ContainsKey("SCOPE"))
125 UUID.TryParse(request["SCOPE"].ToString(), out scopeID);
126
127 m_log.DebugFormat("[MAP REMOVE SERVER CONNECTOR]: Received position data for region at {0}-{1}", x, y);
128
129 if (m_GridService != null)
130 {
131 System.Net.IPAddress ipAddr = GetCallerIP(httpRequest);
132 GridRegion r = m_GridService.GetRegionByPosition(UUID.Zero, (int)Util.RegionToWorldLoc((uint)x), (int)Util.RegionToWorldLoc((uint)y));
133 if (r != null)
134 {
135 if (r.ExternalEndPoint.Address.ToString() != ipAddr.ToString())
136 {
137 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be trying to impersonate region in IP {1}", ipAddr, r.ExternalEndPoint.Address);
138 return FailureResult("IP address of caller does not match IP address of registered region");
139 }
140
141 }
142 else
143 {
144 m_log.WarnFormat("[MAP IMAGE HANDLER]: IP address {0} may be rogue. Region not found at coordinates {1}-{2}",
145 ipAddr, x, y);
146 return FailureResult("Region not found at given coordinates");
147 }
148 }
149
150 string reason = string.Empty;
151 bool result = m_MapService.RemoveMapTile(x, y, scopeID, out reason);
152
153 if (result)
154 return SuccessResult();
155 else
156 return FailureResult(reason);
157
158 }
159 catch (Exception e)
160 {
161 m_log.ErrorFormat("[MAP SERVICE IMAGE HANDLER]: Exception {0} {1}", e.Message, e.StackTrace);
162 }
163
164 return FailureResult("Unexpected server error");
165 }
166
167 private byte[] SuccessResult()
168 {
169 XmlDocument doc = new XmlDocument();
170
171 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
172 "", "");
173
174 doc.AppendChild(xmlnode);
175
176 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
177 "");
178
179 doc.AppendChild(rootElement);
180
181 XmlElement result = doc.CreateElement("", "Result", "");
182 result.AppendChild(doc.CreateTextNode("Success"));
183
184 rootElement.AppendChild(result);
185
186 return DocToBytes(doc);
187 }
188
189 private byte[] FailureResult(string msg)
190 {
191 XmlDocument doc = new XmlDocument();
192
193 XmlNode xmlnode = doc.CreateNode(XmlNodeType.XmlDeclaration,
194 "", "");
195
196 doc.AppendChild(xmlnode);
197
198 XmlElement rootElement = doc.CreateElement("", "ServerResponse",
199 "");
200
201 doc.AppendChild(rootElement);
202
203 XmlElement result = doc.CreateElement("", "Result", "");
204 result.AppendChild(doc.CreateTextNode("Failure"));
205
206 rootElement.AppendChild(result);
207
208 XmlElement message = doc.CreateElement("", "Message", "");
209 message.AppendChild(doc.CreateTextNode(msg));
210
211 rootElement.AppendChild(message);
212
213 return DocToBytes(doc);
214 }
215
216 private byte[] DocToBytes(XmlDocument doc)
217 {
218 MemoryStream ms = new MemoryStream();
219 XmlTextWriter xw = new XmlTextWriter(ms, null);
220 xw.Formatting = Formatting.Indented;
221 doc.WriteTo(xw);
222 xw.Flush();
223
224 return ms.ToArray();
225 }
226
227 private System.Net.IPAddress GetCallerIP(IOSHttpRequest request)
228 {
229 if (!m_Proxy)
230 return request.RemoteIPEndPoint.Address;
231
232 // We're behind a proxy
233 string xff = "X-Forwarded-For";
234 string xffValue = request.Headers[xff.ToLower()];
235 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
236 xffValue = request.Headers[xff];
237
238 if (xffValue == null || (xffValue != null && xffValue == string.Empty))
239 {
240 m_log.WarnFormat("[MAP IMAGE HANDLER]: No XFF header");
241 return request.RemoteIPEndPoint.Address;
242 }
243
244 System.Net.IPEndPoint ep = Util.GetClientIPFromXFF(xffValue);
245 if (ep != null)
246 return ep.Address;
247
248 // Oops
249 return request.RemoteIPEndPoint.Address;
250 }
251
252 }
253}
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
index 2dfb862..9afe953 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesConnector.cs
@@ -99,8 +99,6 @@ namespace OpenSim.Server.Handlers.Profiles
99 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest); 99 Server.AddJsonRPCHandler("avatar_properties_request", handler.AvatarPropertiesRequest);
100 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate); 100 Server.AddJsonRPCHandler("avatar_properties_update", handler.AvatarPropertiesUpdate);
101 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate); 101 Server.AddJsonRPCHandler("avatar_interests_update", handler.AvatarInterestsUpdate);
102 Server.AddJsonRPCHandler("user_preferences_update", handler.UserPreferenecesUpdate);
103 Server.AddJsonRPCHandler("user_preferences_request", handler.UserPreferencesRequest);
104 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest); 102 Server.AddJsonRPCHandler("image_assets_request", handler.AvatarImageAssetsRequest);
105 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData); 103 Server.AddJsonRPCHandler("user_data_request", handler.RequestUserAppData);
106 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData); 104 Server.AddJsonRPCHandler("user_data_update", handler.UpdateUserAppData);
diff --git a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
index 49aa8ba..bc88184 100644
--- a/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
+++ b/OpenSim/Server/Handlers/Profiles/UserProfilesHandlers.cs
@@ -380,6 +380,7 @@ namespace OpenSim.Server.Handlers
380 } 380 }
381 #endregion Interests 381 #endregion Interests
382 382
383<<<<<<< HEAD
383 #region User Preferences 384 #region User Preferences
384 public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response) 385 public bool UserPreferencesRequest(OSDMap json, ref JsonRpcResponse response)
385 { 386 {
@@ -433,6 +434,8 @@ namespace OpenSim.Server.Handlers
433 } 434 }
434 #endregion User Preferences 435 #endregion User Preferences
435 436
437=======
438>>>>>>> avn/ubitvar
436 #region Utility 439 #region Utility
437 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response) 440 public bool AvatarImageAssetsRequest(OSDMap json, ref JsonRpcResponse response)
438 { 441 {
diff --git a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
index e7544b5..8780a49 100644
--- a/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
+++ b/OpenSim/Server/Handlers/Simulation/AgentHandlers.cs
@@ -149,6 +149,7 @@ namespace OpenSim.Server.Handlers.Simulation
149 if (args.ContainsKey("my_version")) 149 if (args.ContainsKey("my_version"))
150 theirVersion = args["my_version"].AsString(); 150 theirVersion = args["my_version"].AsString();
151 151
152<<<<<<< HEAD
152 List<UUID> features = new List<UUID>(); 153 List<UUID> features = new List<UUID>();
153 154
154 if (args.ContainsKey("features")) 155 if (args.ContainsKey("features"))
@@ -159,12 +160,18 @@ namespace OpenSim.Server.Handlers.Simulation
159 features.Add(new UUID(o.AsString())); 160 features.Add(new UUID(o.AsString()));
160 } 161 }
161 162
163=======
164>>>>>>> avn/ubitvar
162 GridRegion destination = new GridRegion(); 165 GridRegion destination = new GridRegion();
163 destination.RegionID = regionID; 166 destination.RegionID = regionID;
164 167
165 string reason; 168 string reason;
166 string version; 169 string version;
170<<<<<<< HEAD
167 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason); 171 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, features, out version, out reason);
172=======
173 bool result = m_SimulationService.QueryAccess(destination, agentID, agentHomeURI, viaTeleport, position, theirVersion, out version, out reason);
174>>>>>>> avn/ubitvar
168 175
169 responsedata["int_response_code"] = HttpStatusCode.OK; 176 responsedata["int_response_code"] = HttpStatusCode.OK;
170 177
@@ -262,7 +269,16 @@ namespace OpenSim.Server.Handlers.Simulation
262 httpResponse.KeepAlive = false; 269 httpResponse.KeepAlive = false;
263 Encoding encoding = Encoding.UTF8; 270 Encoding encoding = Encoding.UTF8;
264 271
272<<<<<<< HEAD
265 if (httpRequest.ContentType != "application/json") 273 if (httpRequest.ContentType != "application/json")
274=======
275 Stream inputStream = null;
276 if ((httpRequest.ContentType == "application/x-gzip" || httpRequest.Headers["Content-Encoding"] == "gzip") || (httpRequest.Headers["X-Content-Encoding"] == "gzip"))
277 inputStream = new GZipStream(request, CompressionMode.Decompress);
278 else if (httpRequest.ContentType == "application/json")
279 inputStream = request;
280 else // no go
281>>>>>>> avn/ubitvar
266 { 282 {
267 httpResponse.StatusCode = 406; 283 httpResponse.StatusCode = 406;
268 return encoding.GetBytes("false"); 284 return encoding.GetBytes("false");
@@ -448,7 +464,30 @@ namespace OpenSim.Server.Handlers.Simulation
448 protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination, 464 protected virtual bool CreateAgent(GridRegion source, GridRegion gatekeeper, GridRegion destination,
449 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason) 465 AgentCircuitData aCircuit, uint teleportFlags, bool fromLogin, out string reason)
450 { 466 {
467<<<<<<< HEAD
451 return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason); 468 return m_SimulationService.CreateAgent(source, destination, aCircuit, teleportFlags, out reason);
469=======
470 reason = String.Empty;
471 if ((teleportFlags & (uint)TeleportFlags.ViaLogin) == 0)
472 {
473 Util.FireAndForget(x =>
474 {
475 string r;
476 m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out r);
477 m_log.DebugFormat("[AGENT HANDLER]: ASYNC CreateAgent {0}", r);
478 });
479
480 return true;
481 }
482 else
483 {
484
485 bool ret = m_SimulationService.CreateAgent(destination, aCircuit, teleportFlags, out reason);
486 m_log.DebugFormat("[AGENT HANDLER]: SYNC CreateAgent {0} {1}", ret.ToString(), reason);
487 return ret;
488 }
489
490>>>>>>> avn/ubitvar
452 } 491 }
453 } 492 }
454 493
diff --git a/OpenSim/Server/ServerMain.cs b/OpenSim/Server/ServerMain.cs
index 65e9287..ed5a481 100644
--- a/OpenSim/Server/ServerMain.cs
+++ b/OpenSim/Server/ServerMain.cs
@@ -29,6 +29,7 @@ using Nini.Config;
29using log4net; 29using log4net;
30using System.Reflection; 30using System.Reflection;
31using System; 31using System;
32using System.Net;
32using System.Collections.Generic; 33using System.Collections.Generic;
33using OpenSim.Framework.Servers; 34using OpenSim.Framework.Servers;
34using OpenSim.Framework.Servers.HttpServer; 35using OpenSim.Framework.Servers.HttpServer;
@@ -53,6 +54,10 @@ namespace OpenSim.Server
53 54
54 public static int Main(string[] args) 55 public static int Main(string[] args)
55 { 56 {
57 // Make sure we don't get outbound connections queueing
58 ServicePointManager.DefaultConnectionLimit = 50;
59 ServicePointManager.UseNagleAlgorithm = false;
60
56 m_Server = new HttpServerBase("R.O.B.U.S.T.", args); 61 m_Server = new HttpServerBase("R.O.B.U.S.T.", args);
57 62
58 string registryLocation; 63 string registryLocation;