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

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

Issue 2132623002: Landing Recent QUIC changes until 2016-07-02 02:45 UTC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removing comment about RPCs Created 4 years, 5 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/quic_client.h ('k') | net/tools/quic/quic_dispatcher.h » ('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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 net::SpdyHeaderBlock header_block = 317 net::SpdyHeaderBlock header_block =
318 net::SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers); 318 net::SpdyBalsaUtils::RequestHeadersToSpdyHeaders(headers);
319 client.SendRequestAndWaitForResponse(headers, body, /*fin=*/true); 319 client.SendRequestAndWaitForResponse(headers, body, /*fin=*/true);
320 320
321 // Print request and response details. 321 // Print request and response details.
322 if (!FLAGS_quiet) { 322 if (!FLAGS_quiet) {
323 cout << "Request:" << endl; 323 cout << "Request:" << endl;
324 cout << "headers:" << header_block.DebugString(); 324 cout << "headers:" << header_block.DebugString();
325 if (!FLAGS_body_hex.empty()) { 325 if (!FLAGS_body_hex.empty()) {
326 // Print the user provided hex, rather than binary body. 326 // Print the user provided hex, rather than binary body.
327 cout << "body hex: " << FLAGS_body_hex << endl; 327 cout << "body:\n"
328 cout << "body ascii: " << net::QuicUtils::BinaryToAscii( 328 << net::QuicUtils::HexDump(net::QuicUtils::HexDecode(FLAGS_body_hex))
329 net::QuicUtils::HexDecode(FLAGS_body_hex))
330 << endl; 329 << endl;
331 } else { 330 } else {
332 cout << "body: " << body << endl; 331 cout << "body: " << body << endl;
333 } 332 }
334 cout << endl; 333 cout << endl;
335 cout << "Response:" << endl; 334 cout << "Response:" << endl;
336 cout << "headers: " << client.latest_response_headers() << endl; 335 cout << "headers: " << client.latest_response_headers() << endl;
337 string response_body = client.latest_response_body(); 336 string response_body = client.latest_response_body();
338 if (!FLAGS_body_hex.empty()) { 337 if (!FLAGS_body_hex.empty()) {
339 // Assume response is binary data. 338 // Assume response is binary data.
340 cout << "body hex: " << net::QuicUtils::HexEncode(response_body) 339 cout << "body:\n" << net::QuicUtils::HexDump(response_body) << endl;
341 << endl;
342 cout << "body ascii: " << net::QuicUtils::BinaryToAscii(response_body)
343 << endl;
344 } else { 340 } else {
345 cout << "body: " << response_body << endl; 341 cout << "body: " << response_body << endl;
346 } 342 }
347 cout << "trailers: " << client.latest_response_trailers() << endl; 343 cout << "trailers: " << client.latest_response_trailers() << endl;
348 } 344 }
349 345
350 size_t response_code = client.latest_response_code(); 346 size_t response_code = client.latest_response_code();
351 if (response_code >= 200 && response_code < 300) { 347 if (response_code >= 200 && response_code < 300) {
352 cout << "Request succeeded (" << response_code << ")." << endl; 348 cout << "Request succeeded (" << response_code << ")." << endl;
353 return 0; 349 return 0;
354 } else if (response_code >= 300 && response_code < 400) { 350 } else if (response_code >= 300 && response_code < 400) {
355 if (FLAGS_redirect_is_success) { 351 if (FLAGS_redirect_is_success) {
356 cout << "Request succeeded (redirect " << response_code << ")." << endl; 352 cout << "Request succeeded (redirect " << response_code << ")." << endl;
357 return 0; 353 return 0;
358 } else { 354 } else {
359 cout << "Request failed (redirect " << response_code << ")." << endl; 355 cout << "Request failed (redirect " << response_code << ")." << endl;
360 return 1; 356 return 1;
361 } 357 }
362 } else { 358 } else {
363 cerr << "Request failed (" << response_code << ")." << endl; 359 cerr << "Request failed (" << response_code << ")." << endl;
364 return 1; 360 return 1;
365 } 361 }
366 } 362 }
OLDNEW
« no previous file with comments | « net/tools/quic/quic_client.h ('k') | net/tools/quic/quic_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698