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

Side by Side Diff: net/tools/quic/quic_client_bin.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: sync Created 3 years, 12 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 | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_dispatcher_test.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 // A binary wrapper for QuicClient. 5 // A binary wrapper for QuicClient.
6 // Connects to a host using QUIC, sends a request to the provided URL, and 6 // Connects to a host using QUIC, sends a request to the provided URL, and
7 // displays the response. 7 // displays the response.
8 // 8 //
9 // Some usage examples: 9 // Some usage examples:
10 // 10 //
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "net/base/privacy_mode.h" 52 #include "net/base/privacy_mode.h"
53 #include "net/cert/cert_verifier.h" 53 #include "net/cert/cert_verifier.h"
54 #include "net/cert/multi_log_ct_verifier.h" 54 #include "net/cert/multi_log_ct_verifier.h"
55 #include "net/http/transport_security_state.h" 55 #include "net/http/transport_security_state.h"
56 #include "net/quic/chromium/crypto/proof_verifier_chromium.h" 56 #include "net/quic/chromium/crypto/proof_verifier_chromium.h"
57 #include "net/quic/core/quic_flags.h" 57 #include "net/quic/core/quic_flags.h"
58 #include "net/quic/core/quic_packets.h" 58 #include "net/quic/core/quic_packets.h"
59 #include "net/quic/core/quic_server_id.h" 59 #include "net/quic/core/quic_server_id.h"
60 #include "net/quic/core/quic_utils.h" 60 #include "net/quic/core/quic_utils.h"
61 #include "net/quic/platform/api/quic_socket_address.h" 61 #include "net/quic/platform/api/quic_socket_address.h"
62 #include "net/quic/platform/api/quic_str_cat.h"
62 #include "net/spdy/spdy_header_block.h" 63 #include "net/spdy/spdy_header_block.h"
63 #include "net/tools/epoll_server/epoll_server.h" 64 #include "net/tools/epoll_server/epoll_server.h"
64 #include "net/tools/quic/quic_client.h" 65 #include "net/tools/quic/quic_client.h"
65 #include "net/tools/quic/synchronous_host_resolver.h" 66 #include "net/tools/quic/synchronous_host_resolver.h"
66 #include "url/gurl.h" 67 #include "url/gurl.h"
67 68
68 using base::StringPiece; 69 using base::StringPiece;
69 using net::CertVerifier; 70 using net::CertVerifier;
70 using net::CTPolicyEnforcer; 71 using net::CTPolicyEnforcer;
71 using net::CTVerifier; 72 using net::CTVerifier;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 int rv = net::SynchronousHostResolver::Resolve(host, &addresses); 239 int rv = net::SynchronousHostResolver::Resolve(host, &addresses);
239 if (rv != net::OK) { 240 if (rv != net::OK) {
240 LOG(ERROR) << "Unable to resolve '" << host 241 LOG(ERROR) << "Unable to resolve '" << host
241 << "' : " << net::ErrorToShortString(rv); 242 << "' : " << net::ErrorToShortString(rv);
242 return 1; 243 return 1;
243 } 244 }
244 ip_addr = 245 ip_addr =
245 net::QuicIpAddress(net::QuicIpAddressImpl(addresses[0].address())); 246 net::QuicIpAddress(net::QuicIpAddressImpl(addresses[0].address()));
246 } 247 }
247 248
248 string host_port = 249 string host_port = net::QuicStrCat(ip_addr.ToString(), ":", port);
249 base::StringPrintf("%s:%d", ip_addr.ToString().c_str(), port);
250 VLOG(1) << "Resolved " << host << " to " << host_port << endl; 250 VLOG(1) << "Resolved " << host << " to " << host_port << endl;
251 251
252 // Build the client, and try to connect. 252 // Build the client, and try to connect.
253 net::EpollServer epoll_server; 253 net::EpollServer epoll_server;
254 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(), 254 net::QuicServerId server_id(url.host(), url.EffectiveIntPort(),
255 net::PRIVACY_MODE_DISABLED); 255 net::PRIVACY_MODE_DISABLED);
256 net::QuicVersionVector versions = net::AllSupportedVersions(); 256 net::QuicVersionVector versions = net::AllSupportedVersions();
257 if (FLAGS_quic_version != -1) { 257 if (FLAGS_quic_version != -1) {
258 versions.clear(); 258 versions.clear();
259 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version)); 259 versions.push_back(static_cast<net::QuicVersion>(FLAGS_quic_version));
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 return 0; 368 return 0;
369 } else { 369 } else {
370 cout << "Request failed (redirect " << response_code << ")." << endl; 370 cout << "Request failed (redirect " << response_code << ")." << endl;
371 return 1; 371 return 1;
372 } 372 }
373 } else { 373 } else {
374 cerr << "Request failed (" << response_code << ")." << endl; 374 cerr << "Request failed (" << response_code << ")." << endl;
375 return 1; 375 return 1;
376 } 376 }
377 } 377 }
OLDNEW
« no previous file with comments | « net/tools/quic/end_to_end_test.cc ('k') | net/tools/quic/quic_dispatcher_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698