From e3e41e365c10e330f37fbb2162c02d9baf42a8c9 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Thu, 4 Oct 2012 15:08:26 -0400 Subject: [PATCH] bug 795905 call proxyservice::asyncresolve() when direct in case of filters r=biesi --HG-- extra : rebase_source : c0d97222a8c5bad3ed8120c5a5a9cfdb7d3b8d6f --- .../protocol/ftp/nsFtpConnectionThread.cpp | 5 +---- netwerk/protocol/http/nsHttpChannel.cpp | 8 ------- .../test/unit/test_protocolproxyservice.js | 21 ++++++++++++++++++- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index d2ac2125f93..4d67f53c1ad 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -1768,13 +1768,10 @@ nsFtpState::Init(nsFtpChannel *channel) // Lookup Proxy information asynchronously if it isn't already set // on the channel and if we aren't configured explicitly to go directly - uint32_t proxyConfigType; nsCOMPtr pps = do_GetService(NS_PROTOCOLPROXYSERVICE_CONTRACTID); - if (pps && !mChannel->ProxyInfo() && - NS_SUCCEEDED(pps->GetProxyConfigType(&proxyConfigType)) && - proxyConfigType != nsIProtocolProxyService::PROXYCONFIG_DIRECT) { + if (pps && !mChannel->ProxyInfo()) { pps->AsyncResolve(mChannel->URI(), 0, this, getter_AddRefs(mProxyRequest)); } diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp index 34a75c27eaf..12a740ff82a 100644 --- a/netwerk/protocol/http/nsHttpChannel.cpp +++ b/netwerk/protocol/http/nsHttpChannel.cpp @@ -1727,14 +1727,6 @@ nsHttpChannel::ResolveProxy() if (NS_FAILED(rv)) return rv; - // Check if we are configured to directly connect. This will save us - // a round trip through the event dispatch system - uint32_t proxyConfigType; - if (NS_SUCCEEDED(pps->GetProxyConfigType(&proxyConfigType)) && - proxyConfigType == nsIProtocolProxyService::PROXYCONFIG_DIRECT) { - return NS_ERROR_FAILURE; - } - return pps->AsyncResolve(mProxyURI ? mProxyURI : mURI, mProxyResolveFlags, this, getter_AddRefs(mProxyRequest)); } diff --git a/netwerk/test/unit/test_protocolproxyservice.js b/netwerk/test/unit/test_protocolproxyservice.js index c641937260f..e67eb166a31 100644 --- a/netwerk/test/unit/test_protocolproxyservice.js +++ b/netwerk/test/unit/test_protocolproxyservice.js @@ -616,15 +616,34 @@ function run_failed_script_test() var req = pps.asyncResolve(uri, 0, cb); } +var directFilter; + function failed_script_callback(pi) { // we should go direct do_check_eq(pi, null); + // test that we honor filters when configured to go direct prefs.setIntPref("network.proxy.type", 0); - do_test_finished(); + directFilter = new TestFilter("http", "127.0.0.1", 7246, 0, 0); + pps.registerFilter(directFilter, 10); + + var chan = ios.newChannel("http://127.0.0.1:7247", "", null); + chan.asyncOpen(directFilterListener, chan); } +var directFilterListener = { + onStartRequest: function test_onStart(request, ctx) { }, + onDataAvailable: function test_OnData() { }, + + onStopRequest: function test_onStop(request, ctx, status) { + ctx.QueryInterface(Components.interfaces.nsIProxiedChannel); + check_proxy(ctx.proxyInfo, "http", "127.0.0.1", 7246, 0, 0, false); + pps.unregisterFilter(directFilter); + do_test_finished(); + }, +}; + function run_deprecated_sync_test() { var uri = ios.newURI("http://www.mozilla.org/", null, null);