diff options
author | Melanie | 2012-09-16 04:21:18 +0100 |
---|---|---|
committer | Melanie | 2012-09-16 04:21:18 +0100 |
commit | 66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba (patch) | |
tree | f5ce10e917fa3ab24ed98cc10ca5a87057da71a9 /OpenSim/Framework | |
parent | Merge branch 'master' into careminster (diff) | |
parent | Revamp the HTTP textures handler to allow a maximum of four fetches (diff) | |
download | opensim-SC_OLD-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.zip opensim-SC_OLD-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.gz opensim-SC_OLD-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.bz2 opensim-SC_OLD-66bf1376b5f9a0c9b5a3bdb58ac7eca09b6389ba.tar.xz |
Merge branch 'avination' into careminster
Conflicts:
OpenSim/Capabilities/Handlers/GetTexture/GetTextureHandler.cs
Diffstat (limited to 'OpenSim/Framework')
4 files changed, 57 insertions, 18 deletions
diff --git a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs index 44c3411..691b45a 100644 --- a/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs +++ b/OpenSim/Framework/Servers/HttpServer/BaseHttpServer.cs | |||
@@ -632,7 +632,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
632 | // Every month or so this will wrap and give bad numbers, not really a problem | 632 | // Every month or so this will wrap and give bad numbers, not really a problem |
633 | // since its just for reporting | 633 | // since its just for reporting |
634 | int tickdiff = requestEndTick - requestStartTick; | 634 | int tickdiff = requestEndTick - requestStartTick; |
635 | if (tickdiff > 3000) | 635 | if (tickdiff > 3000 && requestHandler.Name != "GetTexture") |
636 | { | 636 | { |
637 | m_log.InfoFormat( | 637 | m_log.InfoFormat( |
638 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", | 638 | "[BASE HTTP SERVER]: Slow handling of {0} {1} {2} {3} from {4} took {5}ms", |
@@ -1493,7 +1493,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1493 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) | 1493 | internal byte[] DoHTTPGruntWork(Hashtable responsedata, OSHttpResponse response) |
1494 | { | 1494 | { |
1495 | int responsecode; | 1495 | int responsecode; |
1496 | string responseString; | 1496 | string responseString = String.Empty; |
1497 | byte[] responseData = null; | ||
1497 | string contentType; | 1498 | string contentType; |
1498 | 1499 | ||
1499 | if (responsedata == null) | 1500 | if (responsedata == null) |
@@ -1509,7 +1510,10 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1509 | { | 1510 | { |
1510 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); | 1511 | //m_log.Info("[BASE HTTP SERVER]: Doing HTTP Grunt work with response"); |
1511 | responsecode = (int)responsedata["int_response_code"]; | 1512 | responsecode = (int)responsedata["int_response_code"]; |
1512 | responseString = (string)responsedata["str_response_string"]; | 1513 | if (responsedata["bin_response_data"] != null) |
1514 | responseData = (byte[])responsedata["bin_response_data"]; | ||
1515 | else | ||
1516 | responseString = (string)responsedata["str_response_string"]; | ||
1513 | contentType = (string)responsedata["content_type"]; | 1517 | contentType = (string)responsedata["content_type"]; |
1514 | } | 1518 | } |
1515 | catch | 1519 | catch |
@@ -1564,25 +1568,40 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
1564 | 1568 | ||
1565 | response.AddHeader("Content-Type", contentType); | 1569 | response.AddHeader("Content-Type", contentType); |
1566 | 1570 | ||
1571 | if (responsedata.ContainsKey("headers")) | ||
1572 | { | ||
1573 | Hashtable headerdata = (Hashtable)responsedata["headers"]; | ||
1574 | |||
1575 | foreach (string header in headerdata.Keys) | ||
1576 | response.AddHeader(header, (string)headerdata[header]); | ||
1577 | } | ||
1578 | |||
1567 | byte[] buffer; | 1579 | byte[] buffer; |
1568 | 1580 | ||
1569 | if (!(contentType.Contains("image") | 1581 | if (responseData != null) |
1570 | || contentType.Contains("x-shockwave-flash") | ||
1571 | || contentType.Contains("application/x-oar") | ||
1572 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1573 | { | 1582 | { |
1574 | // Text | 1583 | buffer = responseData; |
1575 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1576 | } | 1584 | } |
1577 | else | 1585 | else |
1578 | { | 1586 | { |
1579 | // Binary! | 1587 | if (!(contentType.Contains("image") |
1580 | buffer = Convert.FromBase64String(responseString); | 1588 | || contentType.Contains("x-shockwave-flash") |
1581 | } | 1589 | || contentType.Contains("application/x-oar") |
1590 | || contentType.Contains("application/vnd.ll.mesh"))) | ||
1591 | { | ||
1592 | // Text | ||
1593 | buffer = Encoding.UTF8.GetBytes(responseString); | ||
1594 | } | ||
1595 | else | ||
1596 | { | ||
1597 | // Binary! | ||
1598 | buffer = Convert.FromBase64String(responseString); | ||
1599 | } | ||
1582 | 1600 | ||
1583 | response.SendChunked = false; | 1601 | response.SendChunked = false; |
1584 | response.ContentLength64 = buffer.Length; | 1602 | response.ContentLength64 = buffer.Length; |
1585 | response.ContentEncoding = Encoding.UTF8; | 1603 | response.ContentEncoding = Encoding.UTF8; |
1604 | } | ||
1586 | 1605 | ||
1587 | return buffer; | 1606 | return buffer; |
1588 | } | 1607 | } |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs index c24a000..a80b1d7 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs | |||
@@ -52,7 +52,8 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
52 | { | 52 | { |
53 | Normal = 0, | 53 | Normal = 0, |
54 | LslHttp = 1, | 54 | LslHttp = 1, |
55 | Inventory = 2 | 55 | Inventory = 2, |
56 | Texture = 3 | ||
56 | } | 57 | } |
57 | 58 | ||
58 | public PollServiceEventArgs( | 59 | public PollServiceEventArgs( |
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index a1dee4e..db088e7 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs | |||
@@ -231,8 +231,7 @@ namespace OpenSim.Framework.Servers.HttpServer | |||
231 | { | 231 | { |
232 | if (m_running) | 232 | if (m_running) |
233 | { | 233 | { |
234 | if (req.PollServiceArgs.Type == PollServiceEventArgs.EventType.LslHttp || | 234 | if (req.PollServiceArgs.Type != PollServiceEventArgs.EventType.Normal) |
235 | req.PollServiceArgs.Type == PollServiceEventArgs.EventType.Inventory) | ||
236 | { | 235 | { |
237 | m_requests.Enqueue(req); | 236 | m_requests.Enqueue(req); |
238 | } | 237 | } |
diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 6a40cd5..8094b6d 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs | |||
@@ -695,6 +695,13 @@ namespace OpenSim.Framework | |||
695 | public static void MakeRequest<TRequest, TResponse>(string verb, | 695 | public static void MakeRequest<TRequest, TResponse>(string verb, |
696 | string requestUrl, TRequest obj, Action<TResponse> action) | 696 | string requestUrl, TRequest obj, Action<TResponse> action) |
697 | { | 697 | { |
698 | MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, action, 0); | ||
699 | } | ||
700 | |||
701 | public static void MakeRequest<TRequest, TResponse>(string verb, | ||
702 | string requestUrl, TRequest obj, Action<TResponse> action, | ||
703 | int maxConnections) | ||
704 | { | ||
698 | int reqnum = WebUtil.RequestNumber++; | 705 | int reqnum = WebUtil.RequestNumber++; |
699 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 706 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); |
700 | 707 | ||
@@ -706,6 +713,10 @@ namespace OpenSim.Framework | |||
706 | Type type = typeof(TRequest); | 713 | Type type = typeof(TRequest); |
707 | 714 | ||
708 | WebRequest request = WebRequest.Create(requestUrl); | 715 | WebRequest request = WebRequest.Create(requestUrl); |
716 | HttpWebRequest ht = (HttpWebRequest)request; | ||
717 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) | ||
718 | ht.ServicePoint.ConnectionLimit = maxConnections; | ||
719 | |||
709 | WebResponse response = null; | 720 | WebResponse response = null; |
710 | TResponse deserial = default(TResponse); | 721 | TResponse deserial = default(TResponse); |
711 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); | 722 | XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); |
@@ -1003,6 +1014,11 @@ namespace OpenSim.Framework | |||
1003 | 1014 | ||
1004 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) | 1015 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout) |
1005 | { | 1016 | { |
1017 | return MakeRequest<TRequest, TResponse>(verb, requestUrl, obj, pTimeout, 0); | ||
1018 | } | ||
1019 | |||
1020 | public static TResponse MakeRequest<TRequest, TResponse>(string verb, string requestUrl, TRequest obj, int pTimeout, int maxConnections) | ||
1021 | { | ||
1006 | int reqnum = WebUtil.RequestNumber++; | 1022 | int reqnum = WebUtil.RequestNumber++; |
1007 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); | 1023 | // m_log.DebugFormat("[WEB UTIL]: <{0}> start osd request for {1}, method {2}",reqnum,url,method); |
1008 | 1024 | ||
@@ -1013,6 +1029,10 @@ namespace OpenSim.Framework | |||
1013 | TResponse deserial = default(TResponse); | 1029 | TResponse deserial = default(TResponse); |
1014 | 1030 | ||
1015 | WebRequest request = WebRequest.Create(requestUrl); | 1031 | WebRequest request = WebRequest.Create(requestUrl); |
1032 | HttpWebRequest ht = (HttpWebRequest)request; | ||
1033 | if (maxConnections > 0 && ht.ServicePoint.ConnectionLimit < maxConnections) | ||
1034 | ht.ServicePoint.ConnectionLimit = maxConnections; | ||
1035 | |||
1016 | request.Method = verb; | 1036 | request.Method = verb; |
1017 | if (pTimeout != 0) | 1037 | if (pTimeout != 0) |
1018 | request.Timeout = pTimeout * 1000; | 1038 | request.Timeout = pTimeout * 1000; |