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

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

Issue 1841863002: Update monet. (Closed) Base URL: https://github.com/domokit/monet.git@master
Patch Set: Created 4 years, 8 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/net_watcher/net_watcher.cc ('k') | net/tools/quic/quic_in_memory_cache.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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 return 1; 228 return 1;
229 } 229 }
230 cout << "Connected to " << host_port << endl; 230 cout << "Connected to " << host_port << endl;
231 231
232 // Construct a GET or POST request for supplied URL. 232 // Construct a GET or POST request for supplied URL.
233 net::BalsaHeaders headers; 233 net::BalsaHeaders headers;
234 headers.SetRequestFirstlineFromStringPieces( 234 headers.SetRequestFirstlineFromStringPieces(
235 FLAGS_body.empty() ? "GET" : "POST", url.spec(), "HTTP/1.1"); 235 FLAGS_body.empty() ? "GET" : "POST", url.spec(), "HTTP/1.1");
236 236
237 // Append any additional headers supplied on the command line. 237 // Append any additional headers supplied on the command line.
238 vector<string> headers_tokenized; 238 for (const std::string& header :
239 Tokenize(FLAGS_headers, ";", &headers_tokenized); 239 base::SplitString(FLAGS_headers, ";", base::KEEP_WHITESPACE,
240 for (size_t i = 0; i < headers_tokenized.size(); ++i) { 240 base::SPLIT_WANT_NONEMPTY)) {
241 string sp; 241 string sp;
242 base::TrimWhitespaceASCII(headers_tokenized[i], base::TRIM_ALL, &sp); 242 base::TrimWhitespaceASCII(header, base::TRIM_ALL, &sp);
243 if (sp.empty()) { 243 if (sp.empty()) {
244 continue; 244 continue;
245 } 245 }
246 vector<string> kv; 246 vector<string> kv;
247 base::SplitString(sp, ':', &kv); 247 base::SplitString(sp, ':', &kv);
248 CHECK_EQ(2u, kv.size()); 248 CHECK_EQ(2u, kv.size());
249 string key; 249 string key;
250 base::TrimWhitespaceASCII(kv[0], base::TRIM_ALL, &key); 250 base::TrimWhitespaceASCII(kv[0], base::TRIM_ALL, &key);
251 string value; 251 string value;
252 base::TrimWhitespaceASCII(kv[1], base::TRIM_ALL, &value); 252 base::TrimWhitespaceASCII(kv[1], base::TRIM_ALL, &value);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 return 0; 286 return 0;
287 } else { 287 } else {
288 cout << "Request failed (redirect " << response_code << ")." << endl; 288 cout << "Request failed (redirect " << response_code << ")." << endl;
289 return 1; 289 return 1;
290 } 290 }
291 } else { 291 } else {
292 cerr << "Request failed (" << response_code << ")." << endl; 292 cerr << "Request failed (" << response_code << ")." << endl;
293 return 1; 293 return 1;
294 } 294 }
295 } 295 }
OLDNEW
« no previous file with comments | « net/tools/net_watcher/net_watcher.cc ('k') | net/tools/quic/quic_in_memory_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698