From 531edd51d82ecd6a842a2611c99e9919634491ef Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 30 Sep 2012 07:22:55 -0700 Subject: Added request.Proxy=null everywhere, as discussed in http://stackoverflow.com/questions/2519655/httpwebrequest-is-extremely-slow. Thanks R.Gunther (rigun@rigutech.nl) https://lists.berlios.de/pipermail/opensim-users/2012-September/010986.html --- OpenSim/ConsoleClient/Requester.cs | 2 +- OpenSim/Framework/Communications/RestClient.cs | 2 ++ OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs | 1 + OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs | 1 + OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs | 1 + .../Framework/Servers/HttpServer/RestObjectPosterResponse.cs | 1 + OpenSim/Framework/Servers/HttpServer/RestSessionService.cs | 2 ++ OpenSim/Framework/UntrustedWebRequest.cs | 1 + OpenSim/Framework/WebUtil.cs | 5 +++++ .../CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs | 1 + .../CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs | 12 +++++++----- .../CoreModules/Scripting/VectorRender/VectorRenderModule.cs | 1 + OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs | 1 + OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs | 1 + OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs | 1 + .../OptionalModules/Avatar/Concierge/ConciergeModule.cs | 2 +- .../Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs | 1 + .../Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs | 1 + .../XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs | 1 + .../Scripting/RegionReadyModule/RegionReadyModule.cs | 1 + .../Services/Connectors/Hypergrid/HeloServicesConnector.cs | 1 + .../Connectors/Hypergrid/UserAgentServiceConnector.cs | 1 + .../Connectors/Neighbour/NeighbourServicesConnector.cs | 1 + .../Connectors/SimianGrid/SimianAssetServiceConnector.cs | 6 +++++- .../Connectors/SimianGrid/SimianGridMaptileModule.cs | 1 + 25 files changed, 41 insertions(+), 8 deletions(-) diff --git a/OpenSim/ConsoleClient/Requester.cs b/OpenSim/ConsoleClient/Requester.cs index aabb02c..0952e58 100644 --- a/OpenSim/ConsoleClient/Requester.cs +++ b/OpenSim/ConsoleClient/Requester.cs @@ -46,8 +46,8 @@ namespace OpenSim.ConsoleClient WebRequest request = WebRequest.Create(requestUrl); WebResponse response = null; + request.Proxy = null; request.Method = "POST"; - request.ContentType = "application/x-www-form-urlencoded"; byte[] buffer = Encoding.ASCII.GetBytes(data); diff --git a/OpenSim/Framework/Communications/RestClient.cs b/OpenSim/Framework/Communications/RestClient.cs index 97b3b60..226e52f 100644 --- a/OpenSim/Framework/Communications/RestClient.cs +++ b/OpenSim/Framework/Communications/RestClient.cs @@ -306,6 +306,7 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 200000; _request.Method = RequestMethod; + _request.Proxy = null; _asyncException = null; // IAsyncResult responseAsyncResult = _request.BeginGetResponse(new AsyncCallback(ResponseIsReadyDelegate), _request); @@ -365,6 +366,7 @@ namespace OpenSim.Framework.Communications _request.ContentType = "application/xml"; _request.Timeout = 900000; _request.Method = RequestMethod; + _request.Proxy = null; _asyncException = null; _request.ContentLength = src.Length; diff --git a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs index 3dce578..7aaf776 100644 --- a/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs +++ b/OpenSim/Framework/Configuration/HTTP/HTTPConfiguration.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework.Configuration.HTTP byte[] buf = new byte[8192]; HttpWebRequest request = (HttpWebRequest) WebRequest.Create(remoteConfigSettings.baseConfigURL + configFileName); + request.Proxy = null; HttpWebResponse response = (HttpWebResponse) request.GetResponse(); Stream resStream = response.GetResponseStream(); diff --git a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs index a2f5d9c..96d4d59 100644 --- a/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs +++ b/OpenSim/Framework/RegionLoader/Web/RegionLoaderWebServer.cs @@ -70,6 +70,7 @@ namespace OpenSim.Framework.RegionLoader.Web int regionCount = 0; HttpWebRequest webRequest = (HttpWebRequest) WebRequest.Create(url); webRequest.Timeout = 30000; //30 Second Timeout + webRequest.Proxy = null; m_log.DebugFormat("[WEBLOADER]: Sending download request to {0}", url); try diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs index 48ced19..61161e3 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPoster.cs @@ -50,6 +50,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; MemoryStream buffer = new MemoryStream(); diff --git a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs index 451745c..727f027 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestObjectPosterResponse.cs @@ -57,6 +57,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs index 19c03a8..1612d4a 100644 --- a/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs +++ b/OpenSim/Framework/Servers/HttpServer/RestSessionService.cs @@ -74,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 20000; @@ -139,6 +140,7 @@ namespace OpenSim.Framework.Servers.HttpServer WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; request.ContentType = "text/xml"; request.Timeout = 10000; diff --git a/OpenSim/Framework/UntrustedWebRequest.cs b/OpenSim/Framework/UntrustedWebRequest.cs index e6411cc..f2355b1 100644 --- a/OpenSim/Framework/UntrustedWebRequest.cs +++ b/OpenSim/Framework/UntrustedWebRequest.cs @@ -88,6 +88,7 @@ namespace OpenSim.Framework httpWebRequest.ReadWriteTimeout = readWriteTimeoutMS; httpWebRequest.Timeout = timeoutMS; httpWebRequest.KeepAlive = false; + httpWebRequest.Proxy = null; return httpWebRequest; } diff --git a/OpenSim/Framework/WebUtil.cs b/OpenSim/Framework/WebUtil.cs index 1d9e2ce..9eff0d2 100644 --- a/OpenSim/Framework/WebUtil.cs +++ b/OpenSim/Framework/WebUtil.cs @@ -171,6 +171,7 @@ namespace OpenSim.Framework request.Method = method; request.Timeout = timeout; request.KeepAlive = false; + request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -350,6 +351,7 @@ namespace OpenSim.Framework request.Method = "POST"; request.Timeout = timeout; request.KeepAlive = false; + request.Proxy = null; request.MaximumAutomaticRedirections = 10; request.ReadWriteTimeout = timeout / 4; request.Headers[OSHeaderRequestID] = reqnum.ToString(); @@ -730,6 +732,7 @@ namespace OpenSim.Framework Type type = typeof(TRequest); WebRequest request = WebRequest.Create(requestUrl); + request.Proxy = null; WebResponse response = null; TResponse deserial = default(TResponse); XmlSerializer deserializer = new XmlSerializer(typeof(TResponse)); @@ -924,6 +927,7 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; string respstring = String.Empty; using (MemoryStream buffer = new MemoryStream()) @@ -1051,6 +1055,7 @@ namespace OpenSim.Framework WebRequest request = WebRequest.Create(requestUrl); request.Method = verb; + request.Proxy = null; MemoryStream buffer = null; if ((verb == "POST") || (verb == "PUT")) diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs index d328eb3..2be91c0 100644 --- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs +++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs @@ -384,6 +384,7 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest Request = (HttpWebRequest) WebRequest.Create(Url); Request.Method = HttpMethod; Request.ContentType = HttpMIMEType; + Request.Proxy = null; if(!HttpVerifyCert) { diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 45e6527..5af3326 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -148,19 +148,21 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL private void MakeHttpRequest(string url, UUID requestID) { WebRequest request = HttpWebRequest.Create(url); - - if (m_proxyurl != null && m_proxyurl.Length > 0) + + if (m_proxyurl != null && m_proxyurl.Length > 0) { - if (m_proxyexcepts != null && m_proxyexcepts.Length > 0) + if (m_proxyexcepts != null && m_proxyexcepts.Length > 0) { string[] elist = m_proxyexcepts.Split(';'); request.Proxy = new WebProxy(m_proxyurl, true, elist); - } - else + } + else { request.Proxy = new WebProxy(m_proxyurl, true); } } + else + request.Proxy = null; RequestState state = new RequestState((HttpWebRequest) request, requestID); // IAsyncResult result = request.BeginGetResponse(new AsyncCallback(HttpRequestReturn), state); diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index b4e3d77..9def6ee 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -826,6 +826,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender try { WebRequest request = HttpWebRequest.Create(url); + request.Proxy = null; //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. //Ckrinke Stream str = null; HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs index c72acc3..ff8f119 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveHelpers.cs @@ -110,6 +110,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver request.ContentLength = 0; request.KeepAlive = false; + request.Proxy = null; WebResponse response = request.GetResponse(); Stream file = response.GetResponseStream(); diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index 4694b14..c70031f 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -352,6 +352,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain request.ContentLength = 0; request.KeepAlive = false; + request.Proxy = null; WebResponse response = request.GetResponse(); Stream file = response.GetResponseStream(); diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index dfba3ff..0fdc5a8 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -819,6 +819,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap mapitemsrequest.Method = "POST"; mapitemsrequest.ContentType = "application/xml+llsd"; + mapitemsrequest.Proxy = null; OSDMap RAMap = new OSDMap(); // string RAMapString = RAMap.ToString(); diff --git a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs index e22618d..fbbb60f 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Concierge/ConciergeModule.cs @@ -386,7 +386,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Concierge updatePost.ContentType = "text/xml"; updatePost.ContentLength = payload.Length; updatePost.UserAgent = "OpenSim.Concierge"; - + updatePost.Proxy = null; BrokerState bs = new BrokerState(uri, payload, updatePost); bs.Timer = new Timer(delegate(object state) diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs index 37ab35a..8a5ce62 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/FreeSwitchVoice/FreeSwitchVoiceModule.cs @@ -541,6 +541,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.FreeSwitchVoice forwardreq.Method = method; forwardreq.ContentType = contenttype; forwardreq.KeepAlive = false; + forwardreq.Proxy = null; if (method == "POST") { diff --git a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs index c5fcef4..f5d8e19 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Voice/VivoxVoice/VivoxVoiceModule.cs @@ -1119,6 +1119,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Voice.VivoxVoice // We are sending just parameters, no content req.ContentLength = 0; + req.Proxy = null; // Send request and retrieve the response rsp = (HttpWebResponse)req.GetResponse(); diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index d412cd1..5102115 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -1150,6 +1150,7 @@ namespace Nwc.XmlRpc request.ContentType = "text/xml"; request.AllowWriteStreamBuffering = true; request.KeepAlive = !_disableKeepAlive; + request.Proxy = null; Stream stream = request.GetRequestStream(); XmlTextWriter xml = new XmlTextWriter(stream, Encoding.ASCII); diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs index bad75f7..3e476ce 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReadyModule/RegionReadyModule.cs @@ -280,6 +280,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.RegionReady WebRequest request = WebRequest.Create(m_uri); request.Method = request_method; request.ContentType = content_type; + request.Proxy = null; Stream os = null; try diff --git a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs index 5c50936..089e878 100644 --- a/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/HeloServicesConnector.cs @@ -77,6 +77,7 @@ namespace OpenSim.Services.Connectors public virtual string Helo() { HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(m_ServerURI); + req.Proxy = null; // Eventually we need to switch to HEAD /* req.Method = "HEAD"; */ diff --git a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs index 2f263ae..8cd2daa 100644 --- a/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs +++ b/OpenSim/Services/Connectors/Hypergrid/UserAgentServiceConnector.cs @@ -125,6 +125,7 @@ namespace OpenSim.Services.Connectors.Hypergrid AgentCreateRequest.Method = "POST"; AgentCreateRequest.ContentType = "application/json"; AgentCreateRequest.Timeout = 10000; + AgentCreateRequest.Proxy = null; //AgentCreateRequest.KeepAlive = false; //AgentCreateRequest.Headers.Add("Authorization", authKey); diff --git a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs index 7429293..07142bf 100644 --- a/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs +++ b/OpenSim/Services/Connectors/Neighbour/NeighbourServicesConnector.cs @@ -107,6 +107,7 @@ namespace OpenSim.Services.Connectors helloNeighbourRequest.Method = "POST"; helloNeighbourRequest.ContentType = "application/json"; helloNeighbourRequest.Timeout = 10000; + helloNeighbourRequest.Proxy = null; // Fill it in OSDMap args = null; diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs index 6bfc5cc..2b00b4d 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianAssetServiceConnector.cs @@ -184,6 +184,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { HttpWebRequest request = UntrustedHttpWebRequest.Create(url); request.Method = "HEAD"; + request.Proxy = null; using (WebResponse response = request.GetResponse()) { @@ -339,7 +340,8 @@ namespace OpenSim.Services.Connectors.SimianGrid // Simian does not require the asset ID to be in the URL because it's in the post data. // By appending it to the URL also, we allow caching proxies (squid) to invalidate asset URLs HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl + asset.FullID.ToString()); - + request.Proxy = null; + HttpWebResponse response = MultipartForm.Post(request, postParameters); using (Stream responseStream = response.GetResponseStream()) { @@ -427,6 +429,7 @@ namespace OpenSim.Services.Connectors.SimianGrid { HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url); request.Method = "DELETE"; + request.Proxy = null; using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) { @@ -460,6 +463,7 @@ namespace OpenSim.Services.Connectors.SimianGrid try { HttpWebRequest request = UntrustedHttpWebRequest.Create(url); + request.Proxy = null; using (WebResponse response = request.GetResponse()) { diff --git a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs index 93fdae3..730d1da 100644 --- a/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs +++ b/OpenSim/Services/Connectors/SimianGrid/SimianGridMaptileModule.cs @@ -212,6 +212,7 @@ namespace OpenSim.Region.OptionalModules.Simian HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(m_serverUrl); request.Timeout = 20000; request.ReadWriteTimeout = 5000; + request.Proxy = null; using (HttpWebResponse response = MultipartForm.Post(request, postParameters)) { -- cgit v1.1