OLD | NEW |
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 DCHECK_EQ(3u, header_line_tokens.size()); | 103 DCHECK_EQ(3u, header_line_tokens.size()); |
104 // Method. | 104 // Method. |
105 http_request_->method_string = header_line_tokens[0]; | 105 http_request_->method_string = header_line_tokens[0]; |
106 http_request_->method = | 106 http_request_->method = |
107 GetMethodType(base::ToLowerASCII(header_line_tokens[0])); | 107 GetMethodType(base::ToLowerASCII(header_line_tokens[0])); |
108 // Address. | 108 // Address. |
109 // Don't build an absolute URL as the parser does not know (should not | 109 // Don't build an absolute URL as the parser does not know (should not |
110 // know) anything about the server address. | 110 // know) anything about the server address. |
111 GURL url(header_line_tokens[1]); | 111 GURL url(header_line_tokens[1]); |
112 if (url.is_valid()) { | 112 if (url.is_valid()) { |
113 http_request_->relative_url = url.path(); | 113 http_request_->relative_url = url.PathForRequest(); |
114 } else if (header_line_tokens[1][0] == '/') { | 114 } else if (header_line_tokens[1][0] == '/') { |
115 http_request_->relative_url = header_line_tokens[1]; | 115 http_request_->relative_url = header_line_tokens[1]; |
116 } else { | 116 } else { |
117 http_request_->relative_url = "/" + header_line_tokens[1]; | 117 http_request_->relative_url = "/" + header_line_tokens[1]; |
118 } | 118 } |
119 | 119 |
120 // Protocol. | 120 // Protocol. |
121 const std::string protocol = base::ToLowerASCII(header_line_tokens[2]); | 121 const std::string protocol = base::ToLowerASCII(header_line_tokens[2]); |
122 CHECK(protocol == "http/1.0" || protocol == "http/1.1") << | 122 CHECK(protocol == "http/1.0" || protocol == "http/1.1") << |
123 "Protocol not supported: " << protocol; | 123 "Protocol not supported: " << protocol; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 return METHOD_CONNECT; | 249 return METHOD_CONNECT; |
250 } else if (token == "options") { | 250 } else if (token == "options") { |
251 return METHOD_OPTIONS; | 251 return METHOD_OPTIONS; |
252 } | 252 } |
253 LOG(WARNING) << "Method not implemented: " << token; | 253 LOG(WARNING) << "Method not implemented: " << token; |
254 return METHOD_GET; | 254 return METHOD_GET; |
255 } | 255 } |
256 | 256 |
257 } // namespace test_server | 257 } // namespace test_server |
258 } // namespace net | 258 } // namespace net |
OLD | NEW |