| 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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 | 1580 |
| 1577 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1581 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1578 awaiting_callback_ = false; | 1582 awaiting_callback_ = false; |
| 1579 } | 1583 } |
| 1580 | 1584 |
| 1581 void URLRequestHttpJob::OnDetachRequest() { | 1585 void URLRequestHttpJob::OnDetachRequest() { |
| 1582 http_transaction_delegate_->OnDetachRequest(); | 1586 http_transaction_delegate_->OnDetachRequest(); |
| 1583 } | 1587 } |
| 1584 | 1588 |
| 1585 } // namespace net | 1589 } // namespace net |
| OLD | NEW |