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

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

Issue 640593004: Fix a pair of Cronet upload bugs and add tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reorder fields Created 6 years, 2 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
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 return WAITING; 82 return WAITING;
83 83
84 // Parse request's the first header line. 84 // Parse request's the first header line.
85 // Request main main header, eg. GET /foobar.html HTTP/1.1 85 // Request main main header, eg. GET /foobar.html HTTP/1.1
86 { 86 {
87 const std::string header_line = ShiftLine(); 87 const std::string header_line = ShiftLine();
88 std::vector<std::string> header_line_tokens; 88 std::vector<std::string> header_line_tokens;
89 base::SplitString(header_line, ' ', &header_line_tokens); 89 base::SplitString(header_line, ' ', &header_line_tokens);
90 DCHECK_EQ(3u, header_line_tokens.size()); 90 DCHECK_EQ(3u, header_line_tokens.size());
91 // Method. 91 // Method.
92 http_request_->method_string = header_line_tokens[0];
92 http_request_->method = GetMethodType(base::StringToLowerASCII( 93 http_request_->method = GetMethodType(base::StringToLowerASCII(
93 header_line_tokens[0])); 94 header_line_tokens[0]));
94 // Address. 95 // Address.
95 // Don't build an absolute URL as the parser does not know (should not 96 // Don't build an absolute URL as the parser does not know (should not
96 // know) anything about the server address. 97 // know) anything about the server address.
97 http_request_->relative_url = header_line_tokens[1]; 98 http_request_->relative_url = header_line_tokens[1];
98 // Protocol. 99 // Protocol.
99 const std::string protocol = 100 const std::string protocol =
100 base::StringToLowerASCII(header_line_tokens[2]); 101 base::StringToLowerASCII(header_line_tokens[2]);
101 CHECK(protocol == "http/1.0" || protocol == "http/1.1") << 102 CHECK(protocol == "http/1.0" || protocol == "http/1.1") <<
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 return METHOD_DELETE; 195 return METHOD_DELETE;
195 } else if (token == "patch") { 196 } else if (token == "patch") {
196 return METHOD_PATCH; 197 return METHOD_PATCH;
197 } 198 }
198 NOTREACHED() << "Method not implemented: " << token; 199 NOTREACHED() << "Method not implemented: " << token;
199 return METHOD_UNKNOWN; 200 return METHOD_UNKNOWN;
200 } 201 }
201 202
202 } // namespace test_server 203 } // namespace test_server
203 } // namespace net 204 } // namespace net
OLDNEW
« no previous file with comments | « net/test/embedded_test_server/http_request.h ('k') | net/test/embedded_test_server/http_request_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698