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

Side by Side Diff: chrome_frame/test/test_server.cc

Issue 12087091: Move string tokenizer to base/strings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sort Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/html_utils.cc ('k') | chrome_frame/utils.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 #include <windows.h> 5 #include <windows.h>
6 #include <objbase.h> 6 #include <objbase.h>
7 #include <urlmon.h> 7 #include <urlmon.h>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 19 matching lines...) Expand all
30 const char kDefaultContentType[] = "text/html; charset=UTF-8"; 30 const char kDefaultContentType[] = "text/html; charset=UTF-8";
31 31
32 void Request::ParseHeaders(const std::string& headers) { 32 void Request::ParseHeaders(const std::string& headers) {
33 DCHECK(method_.length() == 0); 33 DCHECK(method_.length() == 0);
34 34
35 size_t pos = headers.find("\r\n"); 35 size_t pos = headers.find("\r\n");
36 DCHECK(pos != std::string::npos); 36 DCHECK(pos != std::string::npos);
37 if (pos != std::string::npos) { 37 if (pos != std::string::npos) {
38 headers_ = headers.substr(pos + 2); 38 headers_ = headers.substr(pos + 2);
39 39
40 StringTokenizer tokenizer(headers.begin(), headers.begin() + pos, " "); 40 base::StringTokenizer tokenizer(headers.begin(), headers.begin() + pos, " ") ;
41 std::string* parse[] = { &method_, &path_, &version_ }; 41 std::string* parse[] = { &method_, &path_, &version_ };
42 int field = 0; 42 int field = 0;
43 while (tokenizer.GetNext() && field < arraysize(parse)) { 43 while (tokenizer.GetNext() && field < arraysize(parse)) {
44 parse[field++]->assign(tokenizer.token_begin(), 44 parse[field++]->assign(tokenizer.token_begin(),
45 tokenizer.token_end()); 45 tokenizer.token_end());
46 } 46 }
47 } 47 }
48 48
49 // Check for content-length in case we're being sent some data. 49 // Check for content-length in case we're being sent some data.
50 net::HttpUtil::HeadersIterator it(headers_.begin(), headers_.end(), 50 net::HttpUtil::HeadersIterator it(headers_.begin(), headers_.end(),
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 data_.append(content_length_header); 410 data_.append(content_length_header);
411 data_.append("\r\n"); 411 data_.append("\r\n");
412 } 412 }
413 413
414 MessageLoop::current()->PostDelayedTask( 414 MessageLoop::current()->PostDelayedTask(
415 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this), 415 FROM_HERE, base::Bind(&ConfigurableConnection::SendChunk, this),
416 base::TimeDelta::FromMilliseconds(options.timeout_)); 416 base::TimeDelta::FromMilliseconds(options.timeout_));
417 } 417 }
418 418
419 } // namespace test_server 419 } // namespace test_server
OLDNEW
« no previous file with comments | « chrome_frame/html_utils.cc ('k') | chrome_frame/utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698