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 // 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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 } | 282 } |
283 if (!client.Connect()) { | 283 if (!client.Connect()) { |
284 net::QuicErrorCode error = client.session()->error(); | 284 net::QuicErrorCode error = client.session()->error(); |
285 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { | 285 if (FLAGS_version_mismatch_ok && error == net::QUIC_INVALID_VERSION) { |
286 cout << "Server talks QUIC, but none of the versions supported by " | 286 cout << "Server talks QUIC, but none of the versions supported by " |
287 << "this client: " << QuicVersionVectorToString(versions) << endl; | 287 << "this client: " << QuicVersionVectorToString(versions) << endl; |
288 // Version mismatch is not deemed a failure. | 288 // Version mismatch is not deemed a failure. |
289 return 0; | 289 return 0; |
290 } | 290 } |
291 cerr << "Failed to connect to " << host_port | 291 cerr << "Failed to connect to " << host_port |
292 << ". Error: " << net::QuicUtils::ErrorToString(error) << endl; | 292 << ". Error: " << net::QuicErrorCodeToString(error) << endl; |
293 return 1; | 293 return 1; |
294 } | 294 } |
295 cout << "Connected to " << host_port << endl; | 295 cout << "Connected to " << host_port << endl; |
296 | 296 |
297 // Construct the string body from flags, if provided. | 297 // Construct the string body from flags, if provided. |
298 string body = FLAGS_body; | 298 string body = FLAGS_body; |
299 if (!FLAGS_body_hex.empty()) { | 299 if (!FLAGS_body_hex.empty()) { |
300 DCHECK(FLAGS_body.empty()) << "Only set one of --body and --body_hex."; | 300 DCHECK(FLAGS_body.empty()) << "Only set one of --body and --body_hex."; |
301 body = net::QuicUtils::HexDecode(FLAGS_body_hex); | 301 body = net::QuicUtils::HexDecode(FLAGS_body_hex); |
302 } | 302 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 return 0; | 367 return 0; |
368 } else { | 368 } else { |
369 cout << "Request failed (redirect " << response_code << ")." << endl; | 369 cout << "Request failed (redirect " << response_code << ")." << endl; |
370 return 1; | 370 return 1; |
371 } | 371 } |
372 } else { | 372 } else { |
373 cerr << "Request failed (" << response_code << ")." << endl; | 373 cerr << "Request failed (" << response_code << ")." << endl; |
374 return 1; | 374 return 1; |
375 } | 375 } |
376 } | 376 } |
OLD | NEW |