| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" || | 250 DCHECK(scheme == "http" || scheme == "https" || scheme == "ws" || |
| 251 scheme == "wss"); | 251 scheme == "wss"); |
| 252 | 252 |
| 253 if (!request->context()->http_transaction_factory()) { | 253 if (!request->context()->http_transaction_factory()) { |
| 254 NOTREACHED() << "requires a valid context"; | 254 NOTREACHED() << "requires a valid context"; |
| 255 return new URLRequestErrorJob( | 255 return new URLRequestErrorJob( |
| 256 request, network_delegate, ERR_INVALID_ARGUMENT); | 256 request, network_delegate, ERR_INVALID_ARGUMENT); |
| 257 } | 257 } |
| 258 | 258 |
| 259 GURL redirect_url; | 259 GURL redirect_url; |
| 260 if (request->GetHSTSRedirect(&redirect_url)) { | 260 std::string redirect_type; |
| 261 if (request->GetSecureRedirect(&redirect_url, &redirect_type)) { |
| 261 return new URLRequestRedirectJob( | 262 return new URLRequestRedirectJob( |
| 262 request, network_delegate, redirect_url, | 263 request, network_delegate, redirect_url, |
| 263 // Use status code 307 to preserve the method, so POST requests work. | 264 // Use status code 307 to preserve the method, so POST requests work. |
| 264 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, "HSTS"); | 265 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT, redirect_type); |
| 265 } | 266 } |
| 266 return new URLRequestHttpJob(request, | 267 return new URLRequestHttpJob(request, |
| 267 network_delegate, | 268 network_delegate, |
| 268 request->context()->http_user_agent_settings()); | 269 request->context()->http_user_agent_settings()); |
| 269 } | 270 } |
| 270 | 271 |
| 271 URLRequestHttpJob::URLRequestHttpJob( | 272 URLRequestHttpJob::URLRequestHttpJob( |
| 272 URLRequest* request, | 273 URLRequest* request, |
| 273 NetworkDelegate* network_delegate, | 274 NetworkDelegate* network_delegate, |
| 274 const HttpUserAgentSettings* http_user_agent_settings) | 275 const HttpUserAgentSettings* http_user_agent_settings) |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1678 // Notify NetworkQualityEstimator. | 1679 // Notify NetworkQualityEstimator. |
| 1679 if (request()) { | 1680 if (request()) { |
| 1680 NetworkQualityEstimator* network_quality_estimator = | 1681 NetworkQualityEstimator* network_quality_estimator = |
| 1681 request()->context()->network_quality_estimator(); | 1682 request()->context()->network_quality_estimator(); |
| 1682 if (network_quality_estimator) | 1683 if (network_quality_estimator) |
| 1683 network_quality_estimator->NotifyURLRequestDestroyed(*request()); | 1684 network_quality_estimator->NotifyURLRequestDestroyed(*request()); |
| 1684 } | 1685 } |
| 1685 } | 1686 } |
| 1686 | 1687 |
| 1687 } // namespace net | 1688 } // namespace net |
| OLD | NEW |