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

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

Issue 1215933004: New new versions of Starts/EndsWith and SplitString in net (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@starts_with
Patch Set: Created 5 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_in_memory_cache.cc ('k') | net/url_request/url_request_unittest.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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 235
236 // Append any additional headers supplied on the command line. 236 // Append any additional headers supplied on the command line.
237 vector<string> headers_tokenized; 237 vector<string> headers_tokenized;
238 Tokenize(FLAGS_headers, ";", &headers_tokenized); 238 Tokenize(FLAGS_headers, ";", &headers_tokenized);
239 for (size_t i = 0; i < headers_tokenized.size(); ++i) { 239 for (size_t i = 0; i < headers_tokenized.size(); ++i) {
240 string sp; 240 string sp;
241 base::TrimWhitespaceASCII(headers_tokenized[i], base::TRIM_ALL, &sp); 241 base::TrimWhitespaceASCII(headers_tokenized[i], base::TRIM_ALL, &sp);
242 if (sp.empty()) { 242 if (sp.empty()) {
243 continue; 243 continue;
244 } 244 }
245 vector<string> kv; 245 vector<string> kv =
246 base::SplitString(sp, ':', &kv); 246 base::SplitString(sp, ":", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
247 CHECK_EQ(2u, kv.size()); 247 CHECK_EQ(2u, kv.size());
248 string key; 248 string key;
249 base::TrimWhitespaceASCII(kv[0], base::TRIM_ALL, &key); 249 base::TrimWhitespaceASCII(kv[0], base::TRIM_ALL, &key);
250 string value; 250 string value;
251 base::TrimWhitespaceASCII(kv[1], base::TRIM_ALL, &value); 251 base::TrimWhitespaceASCII(kv[1], base::TRIM_ALL, &value);
252 request.extra_headers.SetHeader(key, value); 252 request.extra_headers.SetHeader(key, value);
253 } 253 }
254 254
255 // Make sure to store the response, for later output. 255 // Make sure to store the response, for later output.
256 client.set_store_response(true); 256 client.set_store_response(true);
(...skipping 29 matching lines...) Expand all
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/quic/quic_in_memory_cache.cc ('k') | net/url_request/url_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698