| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/process_util.h" | 8 #include "base/process_util.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 bool strip_post_specific_headers = false; | 431 bool strip_post_specific_headers = false; |
| 432 if (http_status_code != 307) { | 432 if (http_status_code != 307) { |
| 433 // NOTE: Even though RFC 2616 says to preserve the request method when | 433 // NOTE: Even though RFC 2616 says to preserve the request method when |
| 434 // following a 302 redirect, normal browsers don't do that. Instead, they | 434 // following a 302 redirect, normal browsers don't do that. Instead, they |
| 435 // all convert a POST into a GET in response to a 302 and so shall we. For | 435 // all convert a POST into a GET in response to a 302 and so shall we. For |
| 436 // 307 redirects, browsers preserve the method. The RFC says to prompt the | 436 // 307 redirects, browsers preserve the method. The RFC says to prompt the |
| 437 // user to confirm the generation of a new POST request, but IE omits this | 437 // user to confirm the generation of a new POST request, but IE omits this |
| 438 // prompt and so shall we. | 438 // prompt and so shall we. |
| 439 strip_post_specific_headers = method_ == "POST"; | 439 strip_post_specific_headers = method_ == "POST"; |
| 440 method_ = "GET"; | 440 method_ = "GET"; |
| 441 upload_ = NULL; |
| 441 } | 442 } |
| 442 url_ = location; | 443 url_ = location; |
| 443 upload_ = NULL; | |
| 444 --redirect_limit_; | 444 --redirect_limit_; |
| 445 | 445 |
| 446 if (strip_post_specific_headers) { | 446 if (strip_post_specific_headers) { |
| 447 // If being switched from POST to GET, must remove headers that were | 447 // If being switched from POST to GET, must remove headers that were |
| 448 // specific to the POST and don't have meaning in GET. For example | 448 // specific to the POST and don't have meaning in GET. For example |
| 449 // the inclusion of a multipart Content-Type header in GET can cause | 449 // the inclusion of a multipart Content-Type header in GET can cause |
| 450 // problems with some servers: | 450 // problems with some servers: |
| 451 // http://code.google.com/p/chromium/issues/detail?id=843 | 451 // http://code.google.com/p/chromium/issues/detail?id=843 |
| 452 // | 452 // |
| 453 // TODO(eroman): It would be better if this data was structured into | 453 // TODO(eroman): It would be better if this data was structured into |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 } | 491 } |
| 492 | 492 |
| 493 #ifndef NDEBUG | 493 #ifndef NDEBUG |
| 494 | 494 |
| 495 URLRequestMetrics::~URLRequestMetrics() { | 495 URLRequestMetrics::~URLRequestMetrics() { |
| 496 DLOG_IF(WARNING, object_count != 0) << | 496 DLOG_IF(WARNING, object_count != 0) << |
| 497 "Leaking " << object_count << " URLRequest object(s)"; | 497 "Leaking " << object_count << " URLRequest object(s)"; |
| 498 } | 498 } |
| 499 | 499 |
| 500 #endif | 500 #endif |
| OLD | NEW |