| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/singleton.h" | 9 #include "base/singleton.h" |
| 10 #include "base/stats_counters.h" | 10 #include "base/stats_counters.h" |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 // NOTE: Even though RFC 2616 says to preserve the request method when | 450 // NOTE: Even though RFC 2616 says to preserve the request method when |
| 451 // following a 302 redirect, normal browsers don't do that. Instead, they | 451 // following a 302 redirect, normal browsers don't do that. Instead, they |
| 452 // all convert a POST into a GET in response to a 302 and so shall we. For | 452 // all convert a POST into a GET in response to a 302 and so shall we. For |
| 453 // 307 redirects, browsers preserve the method. The RFC says to prompt the | 453 // 307 redirects, browsers preserve the method. The RFC says to prompt the |
| 454 // user to confirm the generation of a new POST request, but IE omits this | 454 // user to confirm the generation of a new POST request, but IE omits this |
| 455 // prompt and so shall we. | 455 // prompt and so shall we. |
| 456 strip_post_specific_headers = method_ == "POST"; | 456 strip_post_specific_headers = method_ == "POST"; |
| 457 method_ = "GET"; | 457 method_ = "GET"; |
| 458 upload_ = NULL; | 458 upload_ = NULL; |
| 459 } | 459 } |
| 460 // If first_party_for_cookies_ is redirected, update it to the new location. |
| 461 if (first_party_for_cookies_ == url_) |
| 462 first_party_for_cookies_ = location; |
| 460 url_ = location; | 463 url_ = location; |
| 461 --redirect_limit_; | 464 --redirect_limit_; |
| 462 | 465 |
| 463 if (strip_post_specific_headers) { | 466 if (strip_post_specific_headers) { |
| 464 // If being switched from POST to GET, must remove headers that were | 467 // If being switched from POST to GET, must remove headers that were |
| 465 // specific to the POST and don't have meaning in GET. For example | 468 // specific to the POST and don't have meaning in GET. For example |
| 466 // the inclusion of a multipart Content-Type header in GET can cause | 469 // the inclusion of a multipart Content-Type header in GET can cause |
| 467 // problems with some servers: | 470 // problems with some servers: |
| 468 // http://code.google.com/p/chromium/issues/detail?id=843 | 471 // http://code.google.com/p/chromium/issues/detail?id=843 |
| 469 // | 472 // |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { | 512 URLRequest::UserData* URLRequest::GetUserData(const void* key) const { |
| 510 UserDataMap::const_iterator found = user_data_.find(key); | 513 UserDataMap::const_iterator found = user_data_.find(key); |
| 511 if (found != user_data_.end()) | 514 if (found != user_data_.end()) |
| 512 return found->second.get(); | 515 return found->second.get(); |
| 513 return NULL; | 516 return NULL; |
| 514 } | 517 } |
| 515 | 518 |
| 516 void URLRequest::SetUserData(const void* key, UserData* data) { | 519 void URLRequest::SetUserData(const void* key, UserData* data) { |
| 517 user_data_[key] = linked_ptr<UserData>(data); | 520 user_data_[key] = linked_ptr<UserData>(data); |
| 518 } | 521 } |
| OLD | NEW |