| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 const std::string& scheme) { | 204 const std::string& scheme) { |
| 205 DCHECK(scheme == "http" || scheme == "https"); | 205 DCHECK(scheme == "http" || scheme == "https"); |
| 206 | 206 |
| 207 if (!request->context()->http_transaction_factory()) { | 207 if (!request->context()->http_transaction_factory()) { |
| 208 NOTREACHED() << "requires a valid context"; | 208 NOTREACHED() << "requires a valid context"; |
| 209 return new URLRequestErrorJob( | 209 return new URLRequestErrorJob( |
| 210 request, network_delegate, ERR_INVALID_ARGUMENT); | 210 request, network_delegate, ERR_INVALID_ARGUMENT); |
| 211 } | 211 } |
| 212 | 212 |
| 213 GURL redirect_url; | 213 GURL redirect_url; |
| 214 if (request->GetHSTSRedirect(&redirect_url)) | 214 if (request->GetHSTSRedirect(&redirect_url)) { |
| 215 return new URLRequestRedirectJob(request, network_delegate, redirect_url); | 215 return new URLRequestRedirectJob( |
| 216 request, network_delegate, redirect_url, |
| 217 // Use status code 307 to preserve the method, so POST requests work. |
| 218 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT); |
| 219 } |
| 216 return new URLRequestHttpJob(request, | 220 return new URLRequestHttpJob(request, |
| 217 network_delegate, | 221 network_delegate, |
| 218 request->context()->http_user_agent_settings()); | 222 request->context()->http_user_agent_settings()); |
| 219 } | 223 } |
| 220 | 224 |
| 221 | 225 |
| 222 URLRequestHttpJob::URLRequestHttpJob( | 226 URLRequestHttpJob::URLRequestHttpJob( |
| 223 URLRequest* request, | 227 URLRequest* request, |
| 224 NetworkDelegate* network_delegate, | 228 NetworkDelegate* network_delegate, |
| 225 const HttpUserAgentSettings* http_user_agent_settings) | 229 const HttpUserAgentSettings* http_user_agent_settings) |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1611 | 1615 |
| 1612 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1616 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1613 awaiting_callback_ = false; | 1617 awaiting_callback_ = false; |
| 1614 } | 1618 } |
| 1615 | 1619 |
| 1616 void URLRequestHttpJob::OnDetachRequest() { | 1620 void URLRequestHttpJob::OnDetachRequest() { |
| 1617 http_transaction_delegate_->OnDetachRequest(); | 1621 http_transaction_delegate_->OnDetachRequest(); |
| 1618 } | 1622 } |
| 1619 | 1623 |
| 1620 } // namespace net | 1624 } // namespace net |
| OLD | NEW |