| 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 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1234 if (response_.headers->response_code() / 100 == 1 && | 1234 if (response_.headers->response_code() / 100 == 1 && |
| 1235 !ForWebSocketHandshake()) { | 1235 !ForWebSocketHandshake()) { |
| 1236 response_.headers = new HttpResponseHeaders(std::string()); | 1236 response_.headers = new HttpResponseHeaders(std::string()); |
| 1237 next_state_ = STATE_READ_HEADERS; | 1237 next_state_ = STATE_READ_HEADERS; |
| 1238 return OK; | 1238 return OK; |
| 1239 } | 1239 } |
| 1240 | 1240 |
| 1241 ProcessAlternativeServices(session_, *response_.headers.get(), | 1241 ProcessAlternativeServices(session_, *response_.headers.get(), |
| 1242 HostPortPair::FromURL(request_->url)); | 1242 HostPortPair::FromURL(request_->url)); |
| 1243 | 1243 |
| 1244 if (IsSecureRequest()) |
| 1245 stream_->GetSSLInfo(&response_.ssl_info); |
| 1246 |
| 1244 int rv = HandleAuthChallenge(); | 1247 int rv = HandleAuthChallenge(); |
| 1245 if (rv != OK) | 1248 if (rv != OK) |
| 1246 return rv; | 1249 return rv; |
| 1247 | 1250 |
| 1248 if (IsSecureRequest()) | |
| 1249 stream_->GetSSLInfo(&response_.ssl_info); | |
| 1250 | |
| 1251 headers_valid_ = true; | 1251 headers_valid_ = true; |
| 1252 return OK; | 1252 return OK; |
| 1253 } | 1253 } |
| 1254 | 1254 |
| 1255 int HttpNetworkTransaction::DoReadBody() { | 1255 int HttpNetworkTransaction::DoReadBody() { |
| 1256 DCHECK(read_buf_.get()); | 1256 DCHECK(read_buf_.get()); |
| 1257 DCHECK_GT(read_buf_len_, 0); | 1257 DCHECK_GT(read_buf_len_, 0); |
| 1258 DCHECK(stream_ != NULL); | 1258 DCHECK(stream_ != NULL); |
| 1259 | 1259 |
| 1260 next_state_ = STATE_READ_BODY_COMPLETE; | 1260 next_state_ = STATE_READ_BODY_COMPLETE; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1696 if (target == HttpAuth::AUTH_PROXY && proxy_info_.is_direct()) | 1696 if (target == HttpAuth::AUTH_PROXY && proxy_info_.is_direct()) |
| 1697 return ERR_UNEXPECTED_PROXY_AUTH; | 1697 return ERR_UNEXPECTED_PROXY_AUTH; |
| 1698 | 1698 |
| 1699 // This case can trigger when an HTTPS server responds with a "Proxy | 1699 // This case can trigger when an HTTPS server responds with a "Proxy |
| 1700 // authentication required" status code through a non-authenticating | 1700 // authentication required" status code through a non-authenticating |
| 1701 // proxy. | 1701 // proxy. |
| 1702 if (!auth_controllers_[target].get()) | 1702 if (!auth_controllers_[target].get()) |
| 1703 return ERR_UNEXPECTED_PROXY_AUTH; | 1703 return ERR_UNEXPECTED_PROXY_AUTH; |
| 1704 | 1704 |
| 1705 int rv = auth_controllers_[target]->HandleAuthChallenge( | 1705 int rv = auth_controllers_[target]->HandleAuthChallenge( |
| 1706 headers, (request_->load_flags & LOAD_DO_NOT_SEND_AUTH_DATA) != 0, false, | 1706 response_, (request_->load_flags & LOAD_DO_NOT_SEND_AUTH_DATA) != 0, |
| 1707 net_log_); | 1707 false, net_log_); |
| 1708 if (auth_controllers_[target]->HaveAuthHandler()) | 1708 if (auth_controllers_[target]->HaveAuthHandler()) |
| 1709 pending_auth_target_ = target; | 1709 pending_auth_target_ = target; |
| 1710 | 1710 |
| 1711 scoped_refptr<AuthChallengeInfo> auth_info = | 1711 scoped_refptr<AuthChallengeInfo> auth_info = |
| 1712 auth_controllers_[target]->auth_info(); | 1712 auth_controllers_[target]->auth_info(); |
| 1713 if (auth_info.get()) | 1713 if (auth_info.get()) |
| 1714 response_.auth_challenge = auth_info; | 1714 response_.auth_challenge = auth_info; |
| 1715 | 1715 |
| 1716 return rv; | 1716 return rv; |
| 1717 } | 1717 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1793 DCHECK(stream_request_); | 1793 DCHECK(stream_request_); |
| 1794 | 1794 |
| 1795 // Since the transaction can restart with auth credentials, it may create a | 1795 // Since the transaction can restart with auth credentials, it may create a |
| 1796 // stream more than once. Accumulate all of the connection attempts across | 1796 // stream more than once. Accumulate all of the connection attempts across |
| 1797 // those streams by appending them to the vector: | 1797 // those streams by appending them to the vector: |
| 1798 for (const auto& attempt : stream_request_->connection_attempts()) | 1798 for (const auto& attempt : stream_request_->connection_attempts()) |
| 1799 connection_attempts_.push_back(attempt); | 1799 connection_attempts_.push_back(attempt); |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 } // namespace net | 1802 } // namespace net |
| OLD | NEW |