OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 return new URLRequestErrorJob(request, ERR_UNSAFE_PORT); | 150 return new URLRequestErrorJob(request, ERR_UNSAFE_PORT); |
151 | 151 |
152 if (!request->context() || | 152 if (!request->context() || |
153 !request->context()->http_transaction_factory()) { | 153 !request->context()->http_transaction_factory()) { |
154 NOTREACHED() << "requires a valid context"; | 154 NOTREACHED() << "requires a valid context"; |
155 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); | 155 return new URLRequestErrorJob(request, ERR_INVALID_ARGUMENT); |
156 } | 156 } |
157 | 157 |
158 TransportSecurityState::DomainState domain_state; | 158 TransportSecurityState::DomainState domain_state; |
159 if (scheme == "http" && | 159 if (scheme == "http" && |
160 (request->url().port().empty() || port == 80) && | |
161 request->context()->transport_security_state() && | 160 request->context()->transport_security_state() && |
162 request->context()->transport_security_state()->IsEnabledForHost( | 161 request->context()->transport_security_state()->IsEnabledForHost( |
163 &domain_state, request->url().host())) { | 162 &domain_state, request->url().host())) { |
164 if (domain_state.mode == | 163 if (domain_state.mode == |
165 TransportSecurityState::DomainState::MODE_STRICT) { | 164 TransportSecurityState::DomainState::MODE_STRICT) { |
166 DCHECK_EQ(request->url().scheme(), "http"); | 165 DCHECK_EQ(request->url().scheme(), "http"); |
167 url_canon::Replacements<char> replacements; | 166 url_canon::Replacements<char> replacements; |
168 static const char kNewScheme[] = "https"; | 167 static const char kNewScheme[] = "https"; |
169 replacements.SetScheme(kNewScheme, | 168 replacements.SetScheme(kNewScheme, |
170 url_parse::Component(0, strlen(kNewScheme))); | 169 url_parse::Component(0, strlen(kNewScheme))); |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1318 } | 1317 } |
1319 | 1318 |
1320 bool URLRequestHttpJob::IsCompressibleContent() const { | 1319 bool URLRequestHttpJob::IsCompressibleContent() const { |
1321 std::string mime_type; | 1320 std::string mime_type; |
1322 return GetMimeType(&mime_type) && | 1321 return GetMimeType(&mime_type) && |
1323 (IsSupportedJavascriptMimeType(mime_type.c_str()) || | 1322 (IsSupportedJavascriptMimeType(mime_type.c_str()) || |
1324 IsSupportedNonImageMimeType(mime_type.c_str())); | 1323 IsSupportedNonImageMimeType(mime_type.c_str())); |
1325 } | 1324 } |
1326 | 1325 |
1327 } // namespace net | 1326 } // namespace net |
OLD | NEW |