summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_service.cc
diff options
context:
space:
mode:
authoreroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 02:33:58 +0000
committereroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-04 02:33:58 +0000
commit7ec7c1899afc8537bb25ce373aa2e136aa7788dc (patch)
treec108e17742ec31aef01eef3824d1388b8a3f8937 /net/proxy/proxy_service.cc
parent5cd1f8f498abd2ed8d0bd545b224b95918cbec72 (diff)
downloadchromium_src-7ec7c1899afc8537bb25ce373aa2e136aa7788dc.zip
chromium_src-7ec7c1899afc8537bb25ce373aa2e136aa7788dc.tar.gz
chromium_src-7ec7c1899afc8537bb25ce373aa2e136aa7788dc.tar.bz2
Split out HttpUtil::SpecForRequest() into a more generic function of net_util.h.
This was a TODO, since that function is useful outside of HTTP. In the process, I uncovered some test cases in proxy_service that are passing in invalid URLs (by virtue of the extra DCHECK). This doesn't make much sense to me to support that, so I have changed them. Review URL: http://codereview.chromium.org/160558 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22359 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_service.cc')
-rw-r--r--net/proxy/proxy_service.cc17
1 files changed, 4 insertions, 13 deletions
diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc
index cdf269c..ab18956 100644
--- a/net/proxy/proxy_service.cc
+++ b/net/proxy/proxy_service.cc
@@ -12,6 +12,7 @@
#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
+#include "net/base/net_util.h"
#include "net/proxy/proxy_config_service_fixed.h"
#include "net/proxy/proxy_script_fetcher.h"
#if defined(OS_WIN)
@@ -63,18 +64,6 @@ class ProxyResolverNull : public ProxyResolver {
virtual void SetPacScriptByUrlInternal(const GURL& pac_url) {}
};
-// Strip away any reference fragments and the username/password, as they
-// are not relevant to proxy resolution.
-static GURL SanitizeURLForProxyResolver(const GURL& url) {
- // TODO(eroman): The following duplicates logic from
- // HttpUtil::SpecForRequest. Should probably live in net_util.h
- GURL::Replacements replacements;
- replacements.ClearUsername();
- replacements.ClearPassword();
- replacements.ClearRef();
- return url.ReplaceComponents(replacements);
-}
-
// ProxyService::PacRequest ---------------------------------------------------
class ProxyService::PacRequest
@@ -252,7 +241,9 @@ int ProxyService::ResolveProxy(const GURL& raw_url, ProxyInfo* result,
PacRequest** pac_request) {
DCHECK(callback);
- GURL url = SanitizeURLForProxyResolver(raw_url);
+ // Strip away any reference fragments and the username/password, as they
+ // are not relevant to proxy resolution.
+ GURL url = SimplifyUrlForRequest(raw_url);
// Check if the request can be completed right away. This is the case when
// using a direct connection, or when the config is bad.