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

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

Issue 3056029: Move the number conversions from string_util to a new file.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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_cache.cc ('k') | net/http/partial_data.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 <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/field_trial.h" 11 #include "base/field_trial.h"
12 #include "base/format_macros.h" 12 #include "base/format_macros.h"
13 #include "base/histogram.h" 13 #include "base/histogram.h"
14 #include "base/scoped_ptr.h" 14 #include "base/scoped_ptr.h"
15 #include "base/stats_counters.h" 15 #include "base/stats_counters.h"
16 #include "base/stl_util-inl.h" 16 #include "base/stl_util-inl.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/string_number_conversions.h"
18 #include "build/build_config.h" 19 #include "build/build_config.h"
19 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
20 #include "net/base/connection_type_histograms.h" 21 #include "net/base/connection_type_histograms.h"
21 #include "net/base/host_mapping_rules.h" 22 #include "net/base/host_mapping_rules.h"
22 #include "net/base/io_buffer.h" 23 #include "net/base/io_buffer.h"
23 #include "net/base/load_flags.h" 24 #include "net/base/load_flags.h"
24 #include "net/base/net_errors.h" 25 #include "net/base/net_errors.h"
25 #include "net/base/net_util.h" 26 #include "net/base/net_util.h"
26 #include "net/base/ssl_cert_request_info.h" 27 #include "net/base/ssl_cert_request_info.h"
27 #include "net/base/ssl_connection_status_flags.h" 28 #include "net/base/ssl_connection_status_flags.h"
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 request_->url.EffectiveIntPort()); 644 request_->url.EffectiveIntPort());
644 645
645 // Extra URL we might be attempting to resolve to. 646 // Extra URL we might be attempting to resolve to.
646 GURL alternate_endpoint_url; 647 GURL alternate_endpoint_url;
647 648
648 // Tracks whether we are using |request_->url| or |alternate_endpoint_url|. 649 // Tracks whether we are using |request_->url| or |alternate_endpoint_url|.
649 const GURL *curr_endpoint_url = &request_->url; 650 const GURL *curr_endpoint_url = &request_->url;
650 651
651 if (g_host_mapping_rules && g_host_mapping_rules->RewriteHost(&endpoint_)) { 652 if (g_host_mapping_rules && g_host_mapping_rules->RewriteHost(&endpoint_)) {
652 url_canon::Replacements<char> replacements; 653 url_canon::Replacements<char> replacements;
653 const std::string port_str = IntToString(endpoint_.port()); 654 const std::string port_str = base::IntToString(endpoint_.port());
654 replacements.SetPort(port_str.c_str(), 655 replacements.SetPort(port_str.c_str(),
655 url_parse::Component(0, port_str.size())); 656 url_parse::Component(0, port_str.size()));
656 replacements.SetHost(endpoint_.host().c_str(), 657 replacements.SetHost(endpoint_.host().c_str(),
657 url_parse::Component(0, endpoint_.host().size())); 658 url_parse::Component(0, endpoint_.host().size()));
658 alternate_endpoint_url = curr_endpoint_url->ReplaceComponents(replacements); 659 alternate_endpoint_url = curr_endpoint_url->ReplaceComponents(replacements);
659 curr_endpoint_url = &alternate_endpoint_url; 660 curr_endpoint_url = &alternate_endpoint_url;
660 } 661 }
661 662
662 const HttpAlternateProtocols& alternate_protocols = 663 const HttpAlternateProtocols& alternate_protocols =
663 session_->alternate_protocols(); 664 session_->alternate_protocols();
664 if (alternate_protocols.HasAlternateProtocolFor(endpoint_)) { 665 if (alternate_protocols.HasAlternateProtocolFor(endpoint_)) {
665 response_.was_alternate_protocol_available = true; 666 response_.was_alternate_protocol_available = true;
666 if (alternate_protocol_mode_ == kUnspecified) { 667 if (alternate_protocol_mode_ == kUnspecified) {
667 HttpAlternateProtocols::PortProtocolPair alternate = 668 HttpAlternateProtocols::PortProtocolPair alternate =
668 alternate_protocols.GetAlternateProtocolFor(endpoint_); 669 alternate_protocols.GetAlternateProtocolFor(endpoint_);
669 if (alternate.protocol != HttpAlternateProtocols::BROKEN) { 670 if (alternate.protocol != HttpAlternateProtocols::BROKEN) {
670 DCHECK_LE(HttpAlternateProtocols::NPN_SPDY_1, alternate.protocol); 671 DCHECK_LE(HttpAlternateProtocols::NPN_SPDY_1, alternate.protocol);
671 DCHECK_GT(HttpAlternateProtocols::NUM_ALTERNATE_PROTOCOLS, 672 DCHECK_GT(HttpAlternateProtocols::NUM_ALTERNATE_PROTOCOLS,
672 alternate.protocol); 673 alternate.protocol);
673 endpoint_.set_port(alternate.port); 674 endpoint_.set_port(alternate.port);
674 alternate_protocol_ = alternate.protocol; 675 alternate_protocol_ = alternate.protocol;
675 alternate_protocol_mode_ = kUsingAlternateProtocol; 676 alternate_protocol_mode_ = kUsingAlternateProtocol;
676 677
677 url_canon::Replacements<char> replacements; 678 url_canon::Replacements<char> replacements;
678 replacements.SetScheme("https", 679 replacements.SetScheme("https",
679 url_parse::Component(0, strlen("https"))); 680 url_parse::Component(0, strlen("https")));
680 const std::string port_str = IntToString(endpoint_.port()); 681 const std::string port_str = base::IntToString(endpoint_.port());
681 replacements.SetPort(port_str.c_str(), 682 replacements.SetPort(port_str.c_str(),
682 url_parse::Component(0, port_str.size())); 683 url_parse::Component(0, port_str.size()));
683 alternate_endpoint_url = 684 alternate_endpoint_url =
684 curr_endpoint_url->ReplaceComponents(replacements); 685 curr_endpoint_url->ReplaceComponents(replacements);
685 curr_endpoint_url = &alternate_endpoint_url; 686 curr_endpoint_url = &alternate_endpoint_url;
686 } 687 }
687 } 688 }
688 } 689 }
689 690
690 if (request_->load_flags & LOAD_BYPASS_PROXY) { 691 if (request_->load_flags & LOAD_BYPASS_PROXY) {
(...skipping 1138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1829 default: 1830 default:
1830 description = StringPrintf("Unknown state 0x%08X (%u)", state, state); 1831 description = StringPrintf("Unknown state 0x%08X (%u)", state, state);
1831 break; 1832 break;
1832 } 1833 }
1833 return description; 1834 return description;
1834 } 1835 }
1835 1836
1836 #undef STATE_CASE 1837 #undef STATE_CASE
1837 1838
1838 } // namespace net 1839 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_cache.cc ('k') | net/http/partial_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698