Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: net/http/http_network_transaction.cc

Issue 284423002: Remove HttpStreamFactory's NPN/SPDY globals, except for spdy_enabled. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix merge Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 70
71 using base::Time; 71 using base::Time;
72 using base::TimeDelta; 72 using base::TimeDelta;
73 73
74 namespace net { 74 namespace net {
75 75
76 namespace { 76 namespace {
77 77
78 void ProcessAlternateProtocol( 78 void ProcessAlternateProtocol(
79 HttpStreamFactory* factory, 79 HttpNetworkSession* session,
80 const base::WeakPtr<HttpServerProperties>& http_server_properties,
81 const HttpResponseHeaders& headers, 80 const HttpResponseHeaders& headers,
82 const HostPortPair& http_host_port_pair) { 81 const HostPortPair& http_host_port_pair) {
83 std::string alternate_protocol_str; 82 std::string alternate_protocol_str;
84 83
85 if (!headers.EnumerateHeader(NULL, kAlternateProtocolHeader, 84 if (!headers.EnumerateHeader(NULL, kAlternateProtocolHeader,
86 &alternate_protocol_str)) { 85 &alternate_protocol_str)) {
87 // Header is not present. 86 // Header is not present.
88 return; 87 return;
89 } 88 }
90 89
91 factory->ProcessAlternateProtocol(http_server_properties, 90 session->http_stream_factory()->ProcessAlternateProtocol(
92 alternate_protocol_str, 91 session->http_server_properties(),
93 http_host_port_pair); 92 alternate_protocol_str,
93 http_host_port_pair,
94 *session);
94 } 95 }
95 96
96 // Returns true if |error| is a client certificate authentication error. 97 // Returns true if |error| is a client certificate authentication error.
97 bool IsClientCertificateError(int error) { 98 bool IsClientCertificateError(int error) {
98 switch (error) { 99 switch (error) {
99 case ERR_BAD_SSL_CLIENT_AUTH_CERT: 100 case ERR_BAD_SSL_CLIENT_AUTH_CERT:
100 case ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED: 101 case ERR_SSL_CLIENT_AUTH_PRIVATE_KEY_ACCESS_DENIED:
101 case ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY: 102 case ERR_SSL_CLIENT_AUTH_CERT_NO_PRIVATE_KEY:
102 case ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED: 103 case ERR_SSL_CLIENT_AUTH_SIGNATURE_FAILED:
103 return true; 104 return true;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 headers_valid_(false), 136 headers_valid_(false),
136 logged_response_time_(false), 137 logged_response_time_(false),
137 fallback_error_code_(ERR_SSL_INAPPROPRIATE_FALLBACK), 138 fallback_error_code_(ERR_SSL_INAPPROPRIATE_FALLBACK),
138 request_headers_(), 139 request_headers_(),
139 read_buf_len_(0), 140 read_buf_len_(0),
140 total_received_bytes_(0), 141 total_received_bytes_(0),
141 next_state_(STATE_NONE), 142 next_state_(STATE_NONE),
142 establishing_tunnel_(false), 143 establishing_tunnel_(false),
143 websocket_handshake_stream_base_create_helper_(NULL) { 144 websocket_handshake_stream_base_create_helper_(NULL) {
144 session->ssl_config_service()->GetSSLConfig(&server_ssl_config_); 145 session->ssl_config_service()->GetSSLConfig(&server_ssl_config_);
145 if (session->http_stream_factory()->has_next_protos()) { 146 session->GetNextProtos(&server_ssl_config_.next_protos);
146 server_ssl_config_.next_protos =
147 session->http_stream_factory()->next_protos();
148 }
149 proxy_ssl_config_ = server_ssl_config_; 147 proxy_ssl_config_ = server_ssl_config_;
150 } 148 }
151 149
152 HttpNetworkTransaction::~HttpNetworkTransaction() { 150 HttpNetworkTransaction::~HttpNetworkTransaction() {
153 if (stream_.get()) { 151 if (stream_.get()) {
154 HttpResponseHeaders* headers = GetResponseHeaders(); 152 HttpResponseHeaders* headers = GetResponseHeaders();
155 // TODO(mbelshe): The stream_ should be able to compute whether or not the 153 // TODO(mbelshe): The stream_ should be able to compute whether or not the
156 // stream should be kept alive. No reason to compute here 154 // stream should be kept alive. No reason to compute here
157 // and pass it in. 155 // and pass it in.
158 bool try_to_keep_alive = 156 bool try_to_keep_alive =
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1079 // Unless this is a WebSocket request, in which case we pass it on up. 1077 // Unless this is a WebSocket request, in which case we pass it on up.
1080 if (response_.headers->response_code() / 100 == 1 && 1078 if (response_.headers->response_code() / 100 == 1 &&
1081 !ForWebSocketHandshake()) { 1079 !ForWebSocketHandshake()) {
1082 response_.headers = new HttpResponseHeaders(std::string()); 1080 response_.headers = new HttpResponseHeaders(std::string());
1083 next_state_ = STATE_READ_HEADERS; 1081 next_state_ = STATE_READ_HEADERS;
1084 return OK; 1082 return OK;
1085 } 1083 }
1086 1084
1087 HostPortPair endpoint = HostPortPair(request_->url.HostNoBrackets(), 1085 HostPortPair endpoint = HostPortPair(request_->url.HostNoBrackets(),
1088 request_->url.EffectiveIntPort()); 1086 request_->url.EffectiveIntPort());
1089 ProcessAlternateProtocol(session_->http_stream_factory(), 1087 ProcessAlternateProtocol(session_,
1090 session_->http_server_properties(),
1091 *response_.headers.get(), 1088 *response_.headers.get(),
1092 endpoint); 1089 endpoint);
1093 1090
1094 int rv = HandleAuthChallenge(); 1091 int rv = HandleAuthChallenge();
1095 if (rv != OK) 1092 if (rv != OK)
1096 return rv; 1093 return rv;
1097 1094
1098 if (is_https_request()) 1095 if (is_https_request())
1099 stream_->GetSSLInfo(&response_.ssl_info); 1096 stream_->GetSSLInfo(&response_.ssl_info);
1100 1097
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
1610 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1607 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1611 state); 1608 state);
1612 break; 1609 break;
1613 } 1610 }
1614 return description; 1611 return description;
1615 } 1612 }
1616 1613
1617 #undef STATE_CASE 1614 #undef STATE_CASE
1618 1615
1619 } // namespace net 1616 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_network_session.cc ('k') | net/http/http_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698