| 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 "handshake is not considered a failure\n" | 118 "handshake is not considered a failure\n" |
| 119 "--redirect_is_success if specified an HTTP response code of 3xx " | 119 "--redirect_is_success if specified an HTTP response code of 3xx " |
| 120 "is considered to be a successful response, otherwise a failure\n"; | 120 "is considered to be a successful response, otherwise a failure\n"; |
| 121 cout << help_str; | 121 cout << help_str; |
| 122 exit(0); | 122 exit(0); |
| 123 } | 123 } |
| 124 if (line->HasSwitch("host")) { | 124 if (line->HasSwitch("host")) { |
| 125 FLAGS_host = line->GetSwitchValueASCII("host"); | 125 FLAGS_host = line->GetSwitchValueASCII("host"); |
| 126 } | 126 } |
| 127 if (line->HasSwitch("port")) { | 127 if (line->HasSwitch("port")) { |
| 128 int port; | 128 if (!base::StringToInt(line->GetSwitchValueASCII("port"), &FLAGS_port)) { |
| 129 if (base::StringToInt(line->GetSwitchValueASCII("port"), &port)) { | |
| 130 FLAGS_port = port; | |
| 131 } else { | |
| 132 std::cerr << "--port must be an integer\n"; | 129 std::cerr << "--port must be an integer\n"; |
| 133 return 1; | 130 return 1; |
| 134 } | 131 } |
| 135 } | 132 } |
| 136 if (line->HasSwitch("body")) { | 133 if (line->HasSwitch("body")) { |
| 137 FLAGS_body = line->GetSwitchValueASCII("body"); | 134 FLAGS_body = line->GetSwitchValueASCII("body"); |
| 138 } | 135 } |
| 139 if (line->HasSwitch("headers")) { | 136 if (line->HasSwitch("headers")) { |
| 140 FLAGS_headers = line->GetSwitchValueASCII("headers"); | 137 FLAGS_headers = line->GetSwitchValueASCII("headers"); |
| 141 } | 138 } |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 return 0; | 277 return 0; |
| 281 } else { | 278 } else { |
| 282 cout << "Request failed (redirect " << response_code << ")." << endl; | 279 cout << "Request failed (redirect " << response_code << ")." << endl; |
| 283 return 1; | 280 return 1; |
| 284 } | 281 } |
| 285 } else { | 282 } else { |
| 286 cerr << "Request failed (" << response_code << ")." << endl; | 283 cerr << "Request failed (" << response_code << ")." << endl; |
| 287 return 1; | 284 return 1; |
| 288 } | 285 } |
| 289 } | 286 } |
| OLD | NEW |