Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2394)

Unified Diff: chromeos/network/onc/onc_utils.cc

Issue 2608803002: ONC: Fix handling of invalid proxy scheme. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/network/onc/onc_utils.cc
diff --git a/chromeos/network/onc/onc_utils.cc b/chromeos/network/onc/onc_utils.cc
index a696ca5984855e530b1cfc9653571f5d1762193e..d33bea1949520a99eecefacb78e4fab32fff0de7 100644
--- a/chromeos/network/onc/onc_utils.cc
+++ b/chromeos/network/onc/onc_utils.cc
@@ -931,7 +931,15 @@ std::unique_ptr<base::DictionaryValue> ConvertOncProxySettingsToProxyConfig(
onc_proxy_settings.GetStringWithoutPathExpansion(::onc::proxy::kPAC,
&pac_url);
GURL url(pac_url);
- DCHECK(url.is_valid()) << "Invalid URL in ProxySettings.PAC";
+ if (!url.is_valid()) {
+ // Assume the scheme is missing, use http.
+ url = GURL(std::string(url::kHttpScheme) + url::kStandardSchemeSeparator +
emaxx 2016/12/29 22:05:36 This logic looks a bit crude to me. Could we use h
stevenjb 2016/12/29 22:44:18 Ah, I was looking for something like that but didn
+ pac_url);
+ if (!url.is_valid()) {
+ LOG(WARNING) << "Invalid URL in ProxySettings.PAC: " << pac_url;
+ url = GURL();
+ }
+ }
proxy_dict.reset(ProxyConfigDictionary::CreatePacScript(url.spec(), false));
} else if (type == ::onc::proxy::kManual) {
const base::DictionaryValue* manual_dict = nullptr;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698