OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
546 AddAuthorizationHeader(cookie_infos, &request_info_); | 546 AddAuthorizationHeader(cookie_infos, &request_info_); |
547 } | 547 } |
548 // We may have been canceled within CanGetCookies. | 548 // We may have been canceled within CanGetCookies. |
549 if (GetStatus().is_success()) { | 549 if (GetStatus().is_success()) { |
550 StartTransaction(); | 550 StartTransaction(); |
551 } else { | 551 } else { |
552 NotifyCanceled(); | 552 NotifyCanceled(); |
553 } | 553 } |
554 } | 554 } |
555 | 555 |
556 void URLRequestHttpJob::CheckForXAutoLogin() { | |
557 const HttpResponseInfo* response_info = transaction_->GetResponseInfo(); | |
558 DCHECK(response_info); | |
559 | |
560 std::string auto_login = HttpResponseHeaders::kXAutoLogin; | |
561 std::string value; | |
562 if (response_info->headers->EnumerateHeader(NULL, auto_login, &value)) { | |
563 request_->delegate()->OnAutoLogin(request_, value); | |
564 } | |
565 } | |
566 | |
556 void URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete() { | 567 void URLRequestHttpJob::SaveCookiesAndNotifyHeadersComplete() { |
557 DCHECK(transaction_.get()); | 568 DCHECK(transaction_.get()); |
558 | 569 |
559 const HttpResponseInfo* response_info = transaction_->GetResponseInfo(); | 570 const HttpResponseInfo* response_info = transaction_->GetResponseInfo(); |
560 DCHECK(response_info); | 571 DCHECK(response_info); |
561 | 572 |
562 response_cookies_.clear(); | 573 response_cookies_.clear(); |
563 response_cookies_save_index_ = 0; | 574 response_cookies_save_index_ = 0; |
564 | 575 |
565 FetchResponseCookies(response_info, &response_cookies_); | 576 FetchResponseCookies(response_info, &response_cookies_); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
741 ssl_info.public_key_hashes)) { | 752 ssl_info.public_key_hashes)) { |
742 result = ERR_CERT_INVALID; | 753 result = ERR_CERT_INVALID; |
743 UMA_HISTOGRAM_BOOLEAN("Net.CertificatePinSuccess", false); | 754 UMA_HISTOGRAM_BOOLEAN("Net.CertificatePinSuccess", false); |
744 } else { | 755 } else { |
745 UMA_HISTOGRAM_BOOLEAN("Net.CertificatePinSuccess", true); | 756 UMA_HISTOGRAM_BOOLEAN("Net.CertificatePinSuccess", true); |
746 } | 757 } |
747 } | 758 } |
748 } | 759 } |
749 | 760 |
750 if (result == OK) { | 761 if (result == OK) { |
762 CheckForXAutoLogin(); | |
darin (slow to review)
2011/07/01 17:46:21
why can't you just do X-Auto-Login processing at a
willchan no longer on Chromium
2011/07/02 18:10:15
+1
| |
751 SaveCookiesAndNotifyHeadersComplete(); | 763 SaveCookiesAndNotifyHeadersComplete(); |
752 } else if (ShouldTreatAsCertificateError(result)) { | 764 } else if (ShouldTreatAsCertificateError(result)) { |
753 // We encountered an SSL certificate error. Ask our delegate to decide | 765 // We encountered an SSL certificate error. Ask our delegate to decide |
754 // what we should do. | 766 // what we should do. |
755 // TODO(wtc): also pass ssl_info.cert_status, or just pass the whole | 767 // TODO(wtc): also pass ssl_info.cert_status, or just pass the whole |
756 // ssl_info. | 768 // ssl_info. |
757 request_->delegate()->OnSSLCertificateError( | 769 request_->delegate()->OnSSLCertificateError( |
758 request_, result, transaction_->GetResponseInfo()->ssl_info.cert); | 770 request_, result, transaction_->GetResponseInfo()->ssl_info.cert); |
759 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 771 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
760 request_->delegate()->OnCertificateRequested( | 772 request_->delegate()->OnCertificateRequested( |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1516 if (done_) | 1528 if (done_) |
1517 return; | 1529 return; |
1518 done_ = true; | 1530 done_ = true; |
1519 | 1531 |
1520 RecordPerfHistograms(reason); | 1532 RecordPerfHistograms(reason); |
1521 if (reason == FINISHED) | 1533 if (reason == FINISHED) |
1522 RecordCompressionHistograms(); | 1534 RecordCompressionHistograms(); |
1523 } | 1535 } |
1524 | 1536 |
1525 } // namespace net | 1537 } // namespace net |
OLD | NEW |