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

Side by Side Diff: net/test/embedded_test_server/http_request.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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_controller.cc ('k') | net/test/embedded_test_server/request_handler_util.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 "net/test/embedded_test_server/http_request.h" 5 #include "net/test/embedded_test_server/http_request.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DCHECK_EQ(3u, header_line_tokens.size()); 102 DCHECK_EQ(3u, header_line_tokens.size());
103 // Method. 103 // Method.
104 http_request_->method_string = header_line_tokens[0]; 104 http_request_->method_string = header_line_tokens[0];
105 http_request_->method = 105 http_request_->method =
106 GetMethodType(base::ToLowerASCII(header_line_tokens[0])); 106 GetMethodType(base::ToLowerASCII(header_line_tokens[0]));
107 // Address. 107 // Address.
108 // Don't build an absolute URL as the parser does not know (should not 108 // Don't build an absolute URL as the parser does not know (should not
109 // know) anything about the server address. 109 // know) anything about the server address.
110 GURL url(header_line_tokens[1]); 110 GURL url(header_line_tokens[1]);
111 if (url.is_valid()) { 111 if (url.is_valid()) {
112 http_request_->relative_url = url.path(); 112 http_request_->relative_url = url.path().as_string();
113 } else if (header_line_tokens[1][0] == '/') { 113 } else if (header_line_tokens[1][0] == '/') {
114 http_request_->relative_url = header_line_tokens[1]; 114 http_request_->relative_url = header_line_tokens[1];
115 } else { 115 } else {
116 http_request_->relative_url = "/" + header_line_tokens[1]; 116 http_request_->relative_url = "/" + header_line_tokens[1];
117 } 117 }
118 118
119 // Protocol. 119 // Protocol.
120 const std::string protocol = base::ToLowerASCII(header_line_tokens[2]); 120 const std::string protocol = base::ToLowerASCII(header_line_tokens[2]);
121 CHECK(protocol == "http/1.0" || protocol == "http/1.1") << 121 CHECK(protocol == "http/1.0" || protocol == "http/1.1") <<
122 "Protocol not supported: " << protocol; 122 "Protocol not supported: " << protocol;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 return METHOD_CONNECT; 248 return METHOD_CONNECT;
249 } else if (token == "options") { 249 } else if (token == "options") {
250 return METHOD_OPTIONS; 250 return METHOD_OPTIONS;
251 } 251 }
252 LOG(WARNING) << "Method not implemented: " << token; 252 LOG(WARNING) << "Method not implemented: " << token;
253 return METHOD_GET; 253 return METHOD_GET;
254 } 254 }
255 255
256 } // namespace test_server 256 } // namespace test_server
257 } // namespace net 257 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_auth_controller.cc ('k') | net/test/embedded_test_server/request_handler_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698