summaryrefslogtreecommitdiffstats
path: root/net/proxy/proxy_script_fetcher_impl.cc
diff options
context:
space:
mode:
authorbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 11:44:28 +0000
committerbattre@chromium.org <battre@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-02-16 11:44:28 +0000
commitd9d71e087d93e99c4bfb8be52314cc046513ad37 (patch)
tree28d5c4af1f96b6b1217858ae487eb2a9b12a4739 /net/proxy/proxy_script_fetcher_impl.cc
parentad4d97af6f6f8a9f7e0af7dda6448437db744848 (diff)
downloadchromium_src-d9d71e087d93e99c4bfb8be52314cc046513ad37.zip
chromium_src-d9d71e087d93e99c4bfb8be52314cc046513ad37.tar.gz
chromium_src-d9d71e087d93e99c4bfb8be52314cc046513ad37.tar.bz2
Implementation of custom PAC scripts in Proxy Settings API.
BUG=50725 TEST= Review URL: http://codereview.chromium.org/6504004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@75102 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/proxy/proxy_script_fetcher_impl.cc')
-rw-r--r--net/proxy/proxy_script_fetcher_impl.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/proxy/proxy_script_fetcher_impl.cc b/net/proxy/proxy_script_fetcher_impl.cc
index bc245a2..e840189 100644
--- a/net/proxy/proxy_script_fetcher_impl.cc
+++ b/net/proxy/proxy_script_fetcher_impl.cc
@@ -9,6 +9,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
+#include "net/base/data_url.h"
#include "net/base/io_buffer.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.h"
@@ -123,6 +124,18 @@ int ProxyScriptFetcherImpl::Fetch(const GURL& url,
DCHECK(callback);
DCHECK(text);
+ // Handle base-64 encoded data-urls that contain custom PAC scripts.
+ if (url.SchemeIs("data")) {
+ std::string mime_type;
+ std::string charset;
+ std::string data;
+ if (!DataURL::Parse(url, &mime_type, &charset, &data))
+ return ERR_FAILED;
+
+ ConvertResponseToUTF16(charset, data, text);
+ return OK;
+ }
+
cur_request_.reset(new URLRequest(url, this));
cur_request_->set_context(url_request_context_);
cur_request_->set_method("GET");