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

Side by Side Diff: net/http/http_basic_state.cc

Issue 1149833014: Remove net::HttpUtil::PathForRequest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/http/http_auth_handler_digest.cc ('k') | net/http/http_util.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "net/http/http_basic_state.h" 5 #include "net/http/http_basic_state.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/http/http_request_info.h" 10 #include "net/http/http_request_info.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return read_buf_; 43 return read_buf_;
44 } 44 }
45 45
46 void HttpBasicState::DeleteParser() { parser_.reset(); } 46 void HttpBasicState::DeleteParser() { parser_.reset(); }
47 47
48 std::string HttpBasicState::GenerateRequestLine() const { 48 std::string HttpBasicState::GenerateRequestLine() const {
49 static const char kSuffix[] = " HTTP/1.1\r\n"; 49 static const char kSuffix[] = " HTTP/1.1\r\n";
50 const size_t kSuffixLen = arraysize(kSuffix) - 1; 50 const size_t kSuffixLen = arraysize(kSuffix) - 1;
51 DCHECK(request_info_); 51 DCHECK(request_info_);
52 const GURL& url = request_info_->url; 52 const GURL& url = request_info_->url;
53 const std::string path = using_proxy_ ? HttpUtil::SpecForRequest(url) 53 const std::string path =
54 : HttpUtil::PathForRequest(url); 54 using_proxy_ ? HttpUtil::SpecForRequest(url) : url.PathForRequest();
55 // Don't use StringPrintf for concatenation because it is very inefficient. 55 // Don't use StringPrintf for concatenation because it is very inefficient.
56 std::string request_line; 56 std::string request_line;
57 const size_t expected_size = request_info_->method.size() + 1 + path.size() + 57 const size_t expected_size = request_info_->method.size() + 1 + path.size() +
58 kSuffixLen; 58 kSuffixLen;
59 request_line.reserve(expected_size); 59 request_line.reserve(expected_size);
60 request_line.append(request_info_->method); 60 request_line.append(request_info_->method);
61 request_line.append(1, ' '); 61 request_line.append(1, ' ');
62 request_line.append(path); 62 request_line.append(path);
63 request_line.append(kSuffix, kSuffixLen); 63 request_line.append(kSuffix, kSuffixLen);
64 DCHECK_EQ(expected_size, request_line.size()); 64 DCHECK_EQ(expected_size, request_line.size());
65 return request_line; 65 return request_line;
66 } 66 }
67 67
68 } // namespace net 68 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_handler_digest.cc ('k') | net/http/http_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698