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

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

Issue 661194: Make a proper TCPSocketParams (Closed)
Patch Set: Address comments Created 10 years, 10 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
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "base/format_macros.h" 7 #include "base/format_macros.h"
8 #include "base/scoped_ptr.h" 8 #include "base/scoped_ptr.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/field_trial.h" 10 #include "base/field_trial.h"
(...skipping 15 matching lines...) Expand all
26 #include "net/http/http_chunked_decoder.h" 26 #include "net/http/http_chunked_decoder.h"
27 #include "net/http/http_network_session.h" 27 #include "net/http/http_network_session.h"
28 #include "net/http/http_request_info.h" 28 #include "net/http/http_request_info.h"
29 #include "net/http/http_response_headers.h" 29 #include "net/http/http_response_headers.h"
30 #include "net/http/http_response_info.h" 30 #include "net/http/http_response_info.h"
31 #include "net/http/http_util.h" 31 #include "net/http/http_util.h"
32 #include "net/socket/client_socket_factory.h" 32 #include "net/socket/client_socket_factory.h"
33 #include "net/socket/socks5_client_socket.h" 33 #include "net/socket/socks5_client_socket.h"
34 #include "net/socket/socks_client_socket.h" 34 #include "net/socket/socks_client_socket.h"
35 #include "net/socket/ssl_client_socket.h" 35 #include "net/socket/ssl_client_socket.h"
36 #include "net/socket/tcp_client_socket_pool.h"
36 #include "net/spdy/spdy_session.h" 37 #include "net/spdy/spdy_session.h"
37 #include "net/spdy/spdy_session_pool.h" 38 #include "net/spdy/spdy_session_pool.h"
38 #include "net/spdy/spdy_stream.h" 39 #include "net/spdy/spdy_stream.h"
39 40
40 using base::Time; 41 using base::Time;
41 42
42 namespace net { 43 namespace net {
43 44
44 namespace { 45 namespace {
45 46
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 649 }
649 650
650 // Use the fixed testing ports if they've been provided. 651 // Use the fixed testing ports if they've been provided.
651 if (using_ssl_) { 652 if (using_ssl_) {
652 if (session_->fixed_https_port() != 0) 653 if (session_->fixed_https_port() != 0)
653 port = session_->fixed_https_port(); 654 port = session_->fixed_https_port();
654 } else if (session_->fixed_http_port() != 0) { 655 } else if (session_->fixed_http_port() != 0) {
655 port = session_->fixed_http_port(); 656 port = session_->fixed_http_port();
656 } 657 }
657 658
659 // Check first if we have a spdy session for this group. If so, then go
660 // straight to using that.
661 HostPortPair host_port_pair(host, port);
662 if (session_->spdy_session_pool()->HasSession(host_port_pair)) {
663 using_spdy_ = true;
664 return OK;
665 }
666
658 // For a connection via HTTP proxy not using CONNECT, the connection 667 // For a connection via HTTP proxy not using CONNECT, the connection
659 // is to the proxy server only. For all other cases 668 // is to the proxy server only. For all other cases
660 // (direct, HTTP proxy CONNECT, SOCKS), the connection is upto the 669 // (direct, HTTP proxy CONNECT, SOCKS), the connection is upto the
661 // url endpoint. Hence we append the url data into the connection_group. 670 // url endpoint. Hence we append the url data into the connection_group.
662 if (proxy_mode_ != kHTTPProxy) 671 if (proxy_mode_ != kHTTPProxy)
663 connection_group.append(request_->url.GetOrigin().spec()); 672 connection_group.append(request_->url.GetOrigin().spec());
664 673
665 DCHECK(!connection_group.empty()); 674 DCHECK(!connection_group.empty());
666 675
667 HostResolver::RequestInfo resolve_info(host, port); 676 // If the user is refreshing the page, bypass the host cache.
668 resolve_info.set_priority(request_->priority); 677 bool disable_resolver_cache = request_->load_flags & LOAD_BYPASS_CACHE ||
678 request_->load_flags & LOAD_DISABLE_CACHE;
669 679
670 // The referrer is used by the DNS prefetch system to correlate resolutions 680 TCPSocketParams tcp_params(host, port, request_->priority, request_->referrer,
671 // with the page that triggered them. It doesn't impact the actual addresses 681 disable_resolver_cache);
672 // that we resolve to.
673 resolve_info.set_referrer(request_->referrer);
674 682
675 // If the user is refreshing the page, bypass the host cache. 683 int rv = connection_->Init(connection_group, tcp_params, request_->priority,
676 if (request_->load_flags & LOAD_BYPASS_CACHE ||
677 request_->load_flags & LOAD_DISABLE_CACHE) {
678 resolve_info.set_allow_cached_response(false);
679 }
680
681 HostPortPair host_port_pair(host, port);
682
683 // Check first if we have a spdy session for this group. If so, then go
684 // straight to using that.
685 if (session_->spdy_session_pool()->HasSession(host_port_pair)) {
686 using_spdy_ = true;
687 return OK;
688 }
689
690 int rv = connection_->Init(connection_group, resolve_info, request_->priority,
691 &io_callback_, session_->tcp_socket_pool(), 684 &io_callback_, session_->tcp_socket_pool(),
692 load_log_); 685 load_log_);
693 return rv; 686 return rv;
694 } 687 }
695 688
696 int HttpNetworkTransaction::DoInitConnectionComplete(int result) { 689 int HttpNetworkTransaction::DoInitConnectionComplete(int result) {
697 if (result < 0) { 690 if (result < 0) {
698 UpdateConnectionTypeHistograms(CONNECTION_HTTP, false); 691 UpdateConnectionTypeHistograms(CONNECTION_HTTP, false);
699 return ReconsiderProxyAfterError(result); 692 return ReconsiderProxyAfterError(result);
700 } 693 }
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1896 AuthChallengeInfo* auth_info = new AuthChallengeInfo; 1889 AuthChallengeInfo* auth_info = new AuthChallengeInfo;
1897 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY; 1890 auth_info->is_proxy = target == HttpAuth::AUTH_PROXY;
1898 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin)); 1891 auth_info->host_and_port = ASCIIToWide(GetHostAndPort(auth_origin));
1899 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme()); 1892 auth_info->scheme = ASCIIToWide(auth_handler_[target]->scheme());
1900 // TODO(eroman): decode realm according to RFC 2047. 1893 // TODO(eroman): decode realm according to RFC 2047.
1901 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm()); 1894 auth_info->realm = ASCIIToWide(auth_handler_[target]->realm());
1902 response_.auth_challenge = auth_info; 1895 response_.auth_challenge = auth_info;
1903 } 1896 }
1904 1897
1905 } // namespace net 1898 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket/client_socket_pool_base_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698