Commit a774b922 authored by lgarron's avatar lgarron Committed by Commit bot

Switch //net functions to use SchemeIsCryptographic() instead of SchemeIsSecure().

SchemeIsCryptographic more appropriately reflects
the intent (that a cryptographically secure
transport was used - e.g. https:// and wss:// schemes),
whereas SchemeIsSecure also considers situations where
the scheme is locally trusted (e.g. filesystem URLs)

BUG=362214

Review URL: https://codereview.chromium.org/1131963003

Cr-Commit-Position: refs/heads/master@{#329966}
parent 05a3de40
......@@ -128,7 +128,7 @@ SdchProblemCode SdchDictionary::CanUse(const GURL& target_url) const {
if (path_.size() && !PathMatch(target_url.path(), path_))
return SDCH_DICTIONARY_FOUND_HAS_WRONG_PATH;
if (target_url.SchemeIsSecure() != url_.SchemeIsSecure())
if (target_url.SchemeIsCryptographic() != url_.SchemeIsCryptographic())
return SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME;
// TODO(jar): Remove overly restrictive failsafe test (added per security
......
......@@ -186,7 +186,7 @@ SdchProblemCode SdchManager::IsInSupportedDomain(const GURL& url) {
if (!g_sdch_enabled_ )
return SDCH_DISABLED;
if (!secure_scheme_supported() && url.SchemeIsSecure())
if (!secure_scheme_supported() && url.SchemeIsCryptographic())
return SDCH_SECURE_SCHEME_NOT_SUPPORTED;
if (blacklisted_domains_.empty())
......@@ -268,7 +268,7 @@ SdchManager::GetDictionarySet(const GURL& target_url) {
int count = 0;
scoped_ptr<SdchManager::DictionarySet> result(new DictionarySet);
for (const auto& entry: dictionaries_) {
if (!secure_scheme_supported() && target_url.SchemeIsSecure())
if (!secure_scheme_supported() && target_url.SchemeIsCryptographic())
continue;
if (entry.second->data.CanUse(target_url) != SDCH_OK)
continue;
......@@ -301,7 +301,7 @@ SdchManager::GetDictionarySetByHash(
return result.Pass();
if (!SdchManager::secure_scheme_supported() &&
target_url.SchemeIsSecure()) {
target_url.SchemeIsCryptographic()) {
*problem_code = SDCH_DICTIONARY_FOUND_HAS_WRONG_SCHEME;
return result.Pass();
}
......
......@@ -186,7 +186,7 @@ std::string CanonicalCookie::GetCookieSourceFromURL(const GURL& url) {
url::Replacements<char> replacements;
replacements.ClearPort();
if (url.SchemeIsSecure())
if (url.SchemeIsCryptographic())
replacements.SetScheme("http", url::Component(0, 4));
return url.GetOrigin().ReplaceComponents(replacements).spec();
......@@ -394,7 +394,7 @@ bool CanonicalCookie::IncludeForRequestURL(const GURL& url,
return false;
// Secure cookies should not be included in requests for URLs with an
// insecure scheme.
if (IsSecure() && !url.SchemeIsSecure())
if (IsSecure() && !url.SchemeIsCryptographic())
return false;
// Don't include cookies for requests that don't apply to the cookie domain.
if (!IsDomainMatch(url.host()))
......
......@@ -70,12 +70,12 @@ enum AuthTarget {
AuthTarget DetermineAuthTarget(const HttpAuthHandler* handler) {
switch (handler->target()) {
case HttpAuth::AUTH_PROXY:
if (handler->origin().SchemeIsSecure())
if (handler->origin().SchemeIsCryptographic())
return AUTH_TARGET_SECURE_PROXY;
else
return AUTH_TARGET_PROXY;
case HttpAuth::AUTH_SERVER:
if (handler->origin().SchemeIsSecure())
if (handler->origin().SchemeIsCryptographic())
return AUTH_TARGET_SECURE_SERVER;
else
return AUTH_TARGET_SERVER;
......
......@@ -590,7 +590,7 @@ void HttpNetworkTransaction::GetConnectionAttempts(
}
bool HttpNetworkTransaction::IsSecureRequest() const {
return request_->url.SchemeIsSecure();
return request_->url.SchemeIsCryptographic();
}
bool HttpNetworkTransaction::UsingHttpProxyWithoutTunnel() const {
......
......@@ -792,7 +792,7 @@ int HttpStreamParser::HandleReadHeaderResult(int result) {
// rather than empty HTTP/0.9 response.
io_state_ = STATE_DONE;
return ERR_EMPTY_RESPONSE;
} else if (request_->url.SchemeIsSecure()) {
} else if (request_->url.SchemeIsCryptographic()) {
// The connection was closed in the middle of the headers. For HTTPS we
// don't parse partial headers. Return a different error code so that we
// know that we shouldn't attempt to retry the request.
......@@ -1039,7 +1039,7 @@ bool HttpStreamParser::IsConnectionReusable() const {
}
void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) {
if (request_->url.SchemeIsSecure() && connection_->socket()) {
if (request_->url.SchemeIsCryptographic() && connection_->socket()) {
SSLClientSocket* ssl_socket =
static_cast<SSLClientSocket*>(connection_->socket());
ssl_socket->GetSSLInfo(ssl_info);
......@@ -1048,7 +1048,7 @@ void HttpStreamParser::GetSSLInfo(SSLInfo* ssl_info) {
void HttpStreamParser::GetSSLCertRequestInfo(
SSLCertRequestInfo* cert_request_info) {
if (request_->url.SchemeIsSecure() && connection_->socket()) {
if (request_->url.SchemeIsCryptographic() && connection_->socket()) {
SSLClientSocket* ssl_socket =
static_cast<SSLClientSocket*>(connection_->socket());
ssl_socket->GetSSLCertRequestInfo(cert_request_info);
......
......@@ -65,7 +65,7 @@ int QuicHttpStream::InitializeStream(const HttpRequestInfo* request_info,
NetLog::TYPE_HTTP_STREAM_REQUEST_BOUND_TO_QUIC_SESSION,
session_->net_log().source().ToEventParametersCallback());
if (request_info->url.SchemeIsSecure()) {
if (request_info->url.SchemeIsCryptographic()) {
SSLInfo ssl_info;
bool secure_session =
session_->GetSSLInfo(&ssl_info) && ssl_info.cert.get();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment