diff options
author | Melanie | 2010-03-18 20:09:04 +0000 |
---|---|---|
committer | Melanie | 2010-03-18 20:09:04 +0000 |
commit | 4c2a51b1b5e2169e0f336c56a023c35bcc334cbd (patch) | |
tree | 9fbaf708764f315034a283fd8fedc8afe0864d75 /OpenSim/Framework/Servers | |
parent | Merge branch 'careminster' into careminster-presence-refactor (diff) | |
parent | Flesh out the new permission method (diff) | |
download | opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.zip opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.gz opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.bz2 opensim-SC-4c2a51b1b5e2169e0f336c56a023c35bcc334cbd.tar.xz |
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | 76 | ||||
-rw-r--r-- | OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | 12 |
2 files changed, 58 insertions, 30 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 9a6ef77..350c041 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -42,6 +42,7 @@ using Nwc.XmlRpc; | |||
42 | using OpenMetaverse.StructuredData; | 42 | using OpenMetaverse.StructuredData; |
43 | using CoolHTTPListener = HttpServer.HttpListener; | 43 | using CoolHTTPListener = HttpServer.HttpListener; |
44 | using HttpListener=System.Net.HttpListener; | 44 | using HttpListener=System.Net.HttpListener; |
45 | using LogPrio=HttpServer.LogPrio; | ||
45 | 46 | ||
46 | namespace OpenSim.Framework.Servers.HttpServer | 47 | namespace OpenSim.Framework.Servers.HttpServer |
47 | { | 48 | { |
@@ -294,7 +295,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
294 | headervals[headername] = req.Headers[headername]; | 295 | headervals[headername] = req.Headers[headername]; |
295 | } | 296 | } |
296 | 297 | ||
297 | keysvals.Add("headers",headervals); | 298 | keysvals.Add("headers", headervals); |
298 | keysvals.Add("querystringkeys", querystringkeys); | 299 | keysvals.Add("querystringkeys", querystringkeys); |
299 | 300 | ||
300 | psEvArgs.Request(psreq.RequestID, keysvals); | 301 | psEvArgs.Request(psreq.RequestID, keysvals); |
@@ -341,7 +342,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
341 | // the request can be passed through to the other handlers. This is a low | 342 | // the request can be passed through to the other handlers. This is a low |
342 | // probability event; if a request is matched it is normally expected to be | 343 | // probability event; if a request is matched it is normally expected to be |
343 | // handled | 344 | // handled |
344 | //m_log.Debug("[BASE HTTP SERVER]: Handling Request" + request.RawUrl); | 345 | // m_log.Debug("[BASE HTTP SERVER]: Handling request to " + request.RawUrl); |
345 | 346 | ||
346 | IHttpAgentHandler agentHandler; | 347 | IHttpAgentHandler agentHandler; |
347 | 348 | ||
@@ -496,7 +497,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
496 | { | 497 | { |
497 | case null: | 498 | case null: |
498 | case "text/html": | 499 | case "text/html": |
499 | //m_log.Info("[Debug BASE HTTP SERVER]: found a text/html content type"); | 500 | // m_log.DebugFormat( |
501 | // "[BASE HTTP SERVER]: Found a text/html content type for request {0}", request.RawUrl); | ||
500 | HandleHTTPRequest(request, response); | 502 | HandleHTTPRequest(request, response); |
501 | return; | 503 | return; |
502 | 504 | ||
@@ -524,10 +526,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
524 | HandleLLSDRequests(request, response); | 526 | HandleLLSDRequests(request, response); |
525 | return; | 527 | return; |
526 | } | 528 | } |
527 | //m_log.Info("[Debug BASE HTTP SERVER]: Checking for HTTP Handler"); | 529 | |
530 | // m_log.DebugFormat("[BASE HTTP SERVER]: Checking for HTTP Handler for request {0}", request.RawUrl); | ||
528 | if (DoWeHaveAHTTPHandler(request.RawUrl)) | 531 | if (DoWeHaveAHTTPHandler(request.RawUrl)) |
529 | { | 532 | { |
530 | //m_log.Info("[Debug BASE HTTP SERVER]: found HTTP Handler"); | 533 | // m_log.DebugFormat("[BASE HTTP SERVER]: Found HTTP Handler for request {0}", request.RawUrl); |
531 | HandleHTTPRequest(request, response); | 534 | HandleHTTPRequest(request, response); |
532 | return; | 535 | return; |
533 | } | 536 | } |
@@ -623,7 +626,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
623 | 626 | ||
624 | private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) | 627 | private bool TryGetHTTPHandler(string handlerKey, out GenericHTTPMethod HTTPHandler) |
625 | { | 628 | { |
626 | //m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); | 629 | // m_log.DebugFormat("[BASE HTTP HANDLER]: Looking for HTTP handler for {0}", handlerKey); |
627 | 630 | ||
628 | string bestMatch = null; | 631 | string bestMatch = null; |
629 | 632 | ||
@@ -943,7 +946,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
943 | } | 946 | } |
944 | catch (IOException e) | 947 | catch (IOException e) |
945 | { | 948 | { |
946 | m_log.DebugFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); | 949 | m_log.WarnFormat("[BASE HTTP SERVER]: LLSD IOException {0}.", e); |
947 | } | 950 | } |
948 | catch (SocketException e) | 951 | catch (SocketException e) |
949 | { | 952 | { |
@@ -1218,7 +1221,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1218 | } | 1221 | } |
1219 | 1222 | ||
1220 | public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) | 1223 | public void HandleHTTPRequest(OSHttpRequest request, OSHttpResponse response) |
1221 | { | 1224 | { |
1225 | // m_log.DebugFormat( | ||
1226 | // "[BASE HTTP SERVER]: HandleHTTPRequest for request to {0}, method {1}", | ||
1227 | // request.RawUrl, request.HttpMethod); | ||
1228 | |||
1222 | switch (request.HttpMethod) | 1229 | switch (request.HttpMethod) |
1223 | { | 1230 | { |
1224 | case "OPTIONS": | 1231 | case "OPTIONS": |
@@ -1233,6 +1240,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1233 | 1240 | ||
1234 | private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) | 1241 | private void HandleContentVerbs(OSHttpRequest request, OSHttpResponse response) |
1235 | { | 1242 | { |
1243 | // m_log.DebugFormat("[BASE HTTP SERVER]: HandleContentVerbs for request to {0}", request.RawUrl); | ||
1244 | |||
1236 | // This is a test. There's a workable alternative.. as this way sucks. | 1245 | // This is a test. There's a workable alternative.. as this way sucks. |
1237 | // We'd like to put this into a text file parhaps that's easily editable. | 1246 | // We'd like to put this into a text file parhaps that's easily editable. |
1238 | // | 1247 | // |
@@ -1273,13 +1282,15 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1273 | 1282 | ||
1274 | foreach (string queryname in querystringkeys) | 1283 | foreach (string queryname in querystringkeys) |
1275 | { | 1284 | { |
1285 | // m_log.DebugFormat( | ||
1286 | // "[BASE HTTP SERVER]: Got query paremeter {0}={1}", queryname, request.QueryString[queryname]); | ||
1276 | keysvals.Add(queryname, request.QueryString[queryname]); | 1287 | keysvals.Add(queryname, request.QueryString[queryname]); |
1277 | requestVars.Add(queryname, keysvals[queryname]); | 1288 | requestVars.Add(queryname, keysvals[queryname]); |
1278 | } | 1289 | } |
1279 | 1290 | ||
1280 | foreach (string headername in rHeaders) | 1291 | foreach (string headername in rHeaders) |
1281 | { | 1292 | { |
1282 | //m_log.Warn("[HEADER]: " + headername + "=" + request.Headers[headername]); | 1293 | // m_log.Debug("[BASE HTTP SERVER]: " + headername + "=" + request.Headers[headername]); |
1283 | headervals[headername] = request.Headers[headername]; | 1294 | headervals[headername] = request.Headers[headername]; |
1284 | } | 1295 | } |
1285 | 1296 | ||
@@ -1288,15 +1299,16 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1288 | host = (string)headervals["Host"]; | 1299 | host = (string)headervals["Host"]; |
1289 | } | 1300 | } |
1290 | 1301 | ||
1291 | keysvals.Add("headers",headervals); | 1302 | keysvals.Add("headers", headervals); |
1292 | keysvals.Add("querystringkeys", querystringkeys); | 1303 | keysvals.Add("querystringkeys", querystringkeys); |
1293 | keysvals.Add("requestvars", requestVars); | 1304 | keysvals.Add("requestvars", requestVars); |
1305 | // keysvals.Add("form", request.Form); | ||
1294 | 1306 | ||
1295 | if (keysvals.Contains("method")) | 1307 | if (keysvals.Contains("method")) |
1296 | { | 1308 | { |
1297 | //m_log.Warn("[HTTP]: Contains Method"); | 1309 | // m_log.Debug("[BASE HTTP SERVER]: Contains Method"); |
1298 | string method = (string) keysvals["method"]; | 1310 | string method = (string) keysvals["method"]; |
1299 | //m_log.Warn("[HTTP]: " + requestBody); | 1311 | // m_log.Debug("[BASE HTTP SERVER]: " + requestBody); |
1300 | GenericHTTPMethod requestprocessor; | 1312 | GenericHTTPMethod requestprocessor; |
1301 | bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); | 1313 | bool foundHandler = TryGetHTTPHandler(method, out requestprocessor); |
1302 | if (foundHandler) | 1314 | if (foundHandler) |
@@ -1308,13 +1320,12 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1308 | } | 1320 | } |
1309 | else | 1321 | else |
1310 | { | 1322 | { |
1311 | //m_log.Warn("[HTTP]: Handler Not Found"); | 1323 | // m_log.Warn("[BASE HTTP SERVER]: Handler Not Found"); |
1312 | SendHTML404(response, host); | 1324 | SendHTML404(response, host); |
1313 | } | 1325 | } |
1314 | } | 1326 | } |
1315 | else | 1327 | else |
1316 | { | 1328 | { |
1317 | |||
1318 | GenericHTTPMethod requestprocessor; | 1329 | GenericHTTPMethod requestprocessor; |
1319 | bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor); | 1330 | bool foundHandler = TryGetHTTPHandlerPathBased(request.RawUrl, out requestprocessor); |
1320 | if (foundHandler) | 1331 | if (foundHandler) |
@@ -1326,7 +1337,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1326 | } | 1337 | } |
1327 | else | 1338 | else |
1328 | { | 1339 | { |
1329 | //m_log.Warn("[HTTP]: Handler Not Found"); | 1340 | // m_log.Warn("[BASE HTTP SERVER]: Handler Not Found2"); |
1330 | SendHTML404(response, host); | 1341 | SendHTML404(response, host); |
1331 | } | 1342 | } |
1332 | } | 1343 | } |
@@ -1374,8 +1385,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1374 | { | 1385 | { |
1375 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) | 1386 | if (String.IsNullOrEmpty(bestMatch) || searchquery.Length > bestMatch.Length) |
1376 | { | 1387 | { |
1377 | // You have to specifically register for '/' and to get it, you must specificaly request it | 1388 | // You have to specifically register for '/' and to get it, you must specifically request it |
1378 | // | ||
1379 | if (pattern == "/" && searchquery == "/" || pattern != "/") | 1389 | if (pattern == "/" && searchquery == "/" || pattern != "/") |
1380 | bestMatch = pattern; | 1390 | bestMatch = pattern; |
1381 | } | 1391 | } |
@@ -1814,30 +1824,36 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1814 | /// <summary> | 1824 | /// <summary> |
1815 | /// Relays HttpServer log messages to our own logging mechanism. | 1825 | /// Relays HttpServer log messages to our own logging mechanism. |
1816 | /// </summary> | 1826 | /// </summary> |
1817 | /// There is also a UseTraceLogs line in this file that can be uncommented for more detailed log information | 1827 | /// To use this you must uncomment the switch section |
1828 | /// | ||
1829 | /// You may also be able to get additional trace information from HttpServer if you uncomment the UseTraceLogs | ||
1830 | /// property in StartHttp() for the HttpListener | ||
1818 | public class HttpServerLogWriter : ILogWriter | 1831 | public class HttpServerLogWriter : ILogWriter |
1819 | { | 1832 | { |
1820 | //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 1833 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
1821 | 1834 | ||
1822 | public void Write(object source, LogPrio priority, string message) | 1835 | public void Write(object source, LogPrio priority, string message) |
1823 | { | 1836 | { |
1824 | /* | 1837 | /* |
1825 | switch (priority) | 1838 | switch (priority) |
1826 | { | 1839 | { |
1827 | case HttpServer.LogPrio.Debug: | 1840 | case LogPrio.Trace: |
1828 | m_log.DebugFormat("[{0}]: {1}", source.ToString(), message); | 1841 | m_log.DebugFormat("[{0}]: {1}", source, message); |
1842 | break; | ||
1843 | case LogPrio.Debug: | ||
1844 | m_log.DebugFormat("[{0}]: {1}", source, message); | ||
1829 | break; | 1845 | break; |
1830 | case HttpServer.LogPrio.Error: | 1846 | case LogPrio.Error: |
1831 | m_log.ErrorFormat("[{0}]: {1}", source.ToString(), message); | 1847 | m_log.ErrorFormat("[{0}]: {1}", source, message); |
1832 | break; | 1848 | break; |
1833 | case HttpServer.LogPrio.Info: | 1849 | case LogPrio.Info: |
1834 | m_log.InfoFormat("[{0}]: {1}", source.ToString(), message); | 1850 | m_log.InfoFormat("[{0}]: {1}", source, message); |
1835 | break; | 1851 | break; |
1836 | case HttpServer.LogPrio.Warning: | 1852 | case LogPrio.Warning: |
1837 | m_log.WarnFormat("[{0}]: {1}", source.ToString(), message); | 1853 | m_log.WarnFormat("[{0}]: {1}", source, message); |
1838 | break; | 1854 | break; |
1839 | case HttpServer.LogPrio.Fatal: | 1855 | case LogPrio.Fatal: |
1840 | m_log.ErrorFormat("[{0}]: FATAL! - {1}", source.ToString(), message); | 1856 | m_log.ErrorFormat("[{0}]: FATAL! - {1}", source, message); |
1841 | break; | 1857 | break; |
1842 | default: | 1858 | default: |
1843 | break; | 1859 | break; |
@@ -1847,4 +1863,4 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1847 | return; | 1863 | return; |
1848 | } | 1864 | } |
1849 | } | 1865 | } |
1850 | } | 1866 | } \ No newline at end of file |
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs index bcfb0a4..e354dfb 100644 --- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs +++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequest.cs | |||
@@ -127,6 +127,11 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
127 | } | 127 | } |
128 | private Hashtable _query; | 128 | private Hashtable _query; |
129 | 129 | ||
130 | /// <value> | ||
131 | /// POST request values, if applicable | ||
132 | /// </value> | ||
133 | // public Hashtable Form { get; private set; } | ||
134 | |||
130 | public string RawUrl | 135 | public string RawUrl |
131 | { | 136 | { |
132 | get { return _request.Uri.AbsolutePath; } | 137 | get { return _request.Uri.AbsolutePath; } |
@@ -228,6 +233,13 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
228 | { | 233 | { |
229 | _log.ErrorFormat("[OSHttpRequest]: Error parsing querystring"); | 234 | _log.ErrorFormat("[OSHttpRequest]: Error parsing querystring"); |
230 | } | 235 | } |
236 | |||
237 | // Form = new Hashtable(); | ||
238 | // foreach (HttpInputItem item in req.Form) | ||
239 | // { | ||
240 | // _log.DebugFormat("[OSHttpRequest]: Got form item {0}={1}", item.Name, item.Value); | ||
241 | // Form.Add(item.Name, item.Value); | ||
242 | // } | ||
231 | } | 243 | } |
232 | 244 | ||
233 | public override string ToString() | 245 | public override string ToString() |