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/http/http_network_transaction.h" | 5 #include "net/http/http_network_transaction.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1196 if (response_.headers->response_code() / 100 == 1 && | 1196 if (response_.headers->response_code() / 100 == 1 && |
1197 !ForWebSocketHandshake()) { | 1197 !ForWebSocketHandshake()) { |
1198 response_.headers = new HttpResponseHeaders(std::string()); | 1198 response_.headers = new HttpResponseHeaders(std::string()); |
1199 next_state_ = STATE_READ_HEADERS; | 1199 next_state_ = STATE_READ_HEADERS; |
1200 return OK; | 1200 return OK; |
1201 } | 1201 } |
1202 | 1202 |
1203 session_->http_stream_factory()->ProcessAlternativeServices( | 1203 session_->http_stream_factory()->ProcessAlternativeServices( |
1204 session_, response_.headers.get(), HostPortPair::FromURL(request_->url)); | 1204 session_, response_.headers.get(), HostPortPair::FromURL(request_->url)); |
1205 | 1205 |
| 1206 if (IsSecureRequest()) |
| 1207 stream_->GetSSLInfo(&response_.ssl_info); |
| 1208 |
1206 int rv = HandleAuthChallenge(); | 1209 int rv = HandleAuthChallenge(); |
1207 if (rv != OK) | 1210 if (rv != OK) |
1208 return rv; | 1211 return rv; |
1209 | 1212 |
1210 if (IsSecureRequest()) | |
1211 stream_->GetSSLInfo(&response_.ssl_info); | |
1212 | |
1213 headers_valid_ = true; | 1213 headers_valid_ = true; |
1214 return OK; | 1214 return OK; |
1215 } | 1215 } |
1216 | 1216 |
1217 int HttpNetworkTransaction::DoReadBody() { | 1217 int HttpNetworkTransaction::DoReadBody() { |
1218 DCHECK(read_buf_.get()); | 1218 DCHECK(read_buf_.get()); |
1219 DCHECK_GT(read_buf_len_, 0); | 1219 DCHECK_GT(read_buf_len_, 0); |
1220 DCHECK(stream_ != NULL); | 1220 DCHECK(stream_ != NULL); |
1221 | 1221 |
1222 next_state_ = STATE_READ_BODY_COMPLETE; | 1222 next_state_ = STATE_READ_BODY_COMPLETE; |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1658 if (target == HttpAuth::AUTH_PROXY && proxy_info_.is_direct()) | 1658 if (target == HttpAuth::AUTH_PROXY && proxy_info_.is_direct()) |
1659 return ERR_UNEXPECTED_PROXY_AUTH; | 1659 return ERR_UNEXPECTED_PROXY_AUTH; |
1660 | 1660 |
1661 // This case can trigger when an HTTPS server responds with a "Proxy | 1661 // This case can trigger when an HTTPS server responds with a "Proxy |
1662 // authentication required" status code through a non-authenticating | 1662 // authentication required" status code through a non-authenticating |
1663 // proxy. | 1663 // proxy. |
1664 if (!auth_controllers_[target].get()) | 1664 if (!auth_controllers_[target].get()) |
1665 return ERR_UNEXPECTED_PROXY_AUTH; | 1665 return ERR_UNEXPECTED_PROXY_AUTH; |
1666 | 1666 |
1667 int rv = auth_controllers_[target]->HandleAuthChallenge( | 1667 int rv = auth_controllers_[target]->HandleAuthChallenge( |
1668 headers, (request_->load_flags & LOAD_DO_NOT_SEND_AUTH_DATA) != 0, false, | 1668 headers, response_.ssl_info, |
| 1669 (request_->load_flags & LOAD_DO_NOT_SEND_AUTH_DATA) != 0, false, |
1669 net_log_); | 1670 net_log_); |
1670 if (auth_controllers_[target]->HaveAuthHandler()) | 1671 if (auth_controllers_[target]->HaveAuthHandler()) |
1671 pending_auth_target_ = target; | 1672 pending_auth_target_ = target; |
1672 | 1673 |
1673 scoped_refptr<AuthChallengeInfo> auth_info = | 1674 scoped_refptr<AuthChallengeInfo> auth_info = |
1674 auth_controllers_[target]->auth_info(); | 1675 auth_controllers_[target]->auth_info(); |
1675 if (auth_info.get()) | 1676 if (auth_info.get()) |
1676 response_.auth_challenge = auth_info; | 1677 response_.auth_challenge = auth_info; |
1677 | 1678 |
1678 return rv; | 1679 return rv; |
1679 } | 1680 } |
1680 | 1681 |
1681 bool HttpNetworkTransaction::HaveAuth(HttpAuth::Target target) const { | 1682 bool HttpNetworkTransaction::HaveAuth(HttpAuth::Target target) const { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1755 DCHECK(stream_request_); | 1756 DCHECK(stream_request_); |
1756 | 1757 |
1757 // Since the transaction can restart with auth credentials, it may create a | 1758 // Since the transaction can restart with auth credentials, it may create a |
1758 // stream more than once. Accumulate all of the connection attempts across | 1759 // stream more than once. Accumulate all of the connection attempts across |
1759 // those streams by appending them to the vector: | 1760 // those streams by appending them to the vector: |
1760 for (const auto& attempt : stream_request_->connection_attempts()) | 1761 for (const auto& attempt : stream_request_->connection_attempts()) |
1761 connection_attempts_.push_back(attempt); | 1762 connection_attempts_.push_back(attempt); |
1762 } | 1763 } |
1763 | 1764 |
1764 } // namespace net | 1765 } // namespace net |
OLD | NEW |