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 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // NOTE: Even though RFC 2616 says to preserve the request method when | 452 // NOTE: Even though RFC 2616 says to preserve the request method when |
453 // following a 302 redirect, normal browsers don't do that. Instead, they | 453 // following a 302 redirect, normal browsers don't do that. Instead, they |
454 // all convert a POST into a GET in response to a 302 and so shall we. For | 454 // all convert a POST into a GET in response to a 302 and so shall we. For |
455 // 307 redirects, browsers preserve the method. The RFC says to prompt the | 455 // 307 redirects, browsers preserve the method. The RFC says to prompt the |
456 // user to confirm the generation of a new POST request, but IE omits this | 456 // user to confirm the generation of a new POST request, but IE omits this |
457 // prompt and so shall we. | 457 // prompt and so shall we. |
458 strip_post_specific_headers = method_ == "POST"; | 458 strip_post_specific_headers = method_ == "POST"; |
459 method_ = "GET"; | 459 method_ = "GET"; |
460 upload_ = NULL; | 460 upload_ = NULL; |
461 } | 461 } |
| 462 |
| 463 // Suppress the referrer if we're redirecting out of https. |
| 464 if (GURL(referrer_).SchemeIsSecure() && !location.SchemeIsSecure()) |
| 465 referrer_.clear(); |
| 466 |
462 url_ = location; | 467 url_ = location; |
463 --redirect_limit_; | 468 --redirect_limit_; |
464 | 469 |
465 if (strip_post_specific_headers) { | 470 if (strip_post_specific_headers) { |
466 // If being switched from POST to GET, must remove headers that were | 471 // If being switched from POST to GET, must remove headers that were |
467 // specific to the POST and don't have meaning in GET. For example | 472 // specific to the POST and don't have meaning in GET. For example |
468 // the inclusion of a multipart Content-Type header in GET can cause | 473 // the inclusion of a multipart Content-Type header in GET can cause |
469 // problems with some servers: | 474 // problems with some servers: |
470 // http://code.google.com/p/chromium/issues/detail?id=843 | 475 // http://code.google.com/p/chromium/issues/detail?id=843 |
471 // | 476 // |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 void URLRequest::SetUserData(const void* key, UserData* data) { | 523 void URLRequest::SetUserData(const void* key, UserData* data) { |
519 user_data_[key] = linked_ptr<UserData>(data); | 524 user_data_[key] = linked_ptr<UserData>(data); |
520 } | 525 } |
521 | 526 |
522 void URLRequest::GetInfoForTracker( | 527 void URLRequest::GetInfoForTracker( |
523 RequestTracker<URLRequest>::RecentRequestInfo* info) const { | 528 RequestTracker<URLRequest>::RecentRequestInfo* info) const { |
524 DCHECK(info); | 529 DCHECK(info); |
525 info->original_url = original_url_; | 530 info->original_url = original_url_; |
526 info->load_log = load_log_; | 531 info->load_log = load_log_; |
527 } | 532 } |
OLD | NEW |