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 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ | 5 #ifndef NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ |
6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ | 6 #define NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 // Represents a HTTP request. Since it can be big, use scoped_ptr to pass it | 29 // Represents a HTTP request. Since it can be big, use scoped_ptr to pass it |
30 // instead of copying. However, the struct is copyable so tests can save and | 30 // instead of copying. However, the struct is copyable so tests can save and |
31 // examine a HTTP request. | 31 // examine a HTTP request. |
32 struct HttpRequest { | 32 struct HttpRequest { |
33 HttpRequest(); | 33 HttpRequest(); |
34 ~HttpRequest(); | 34 ~HttpRequest(); |
35 | 35 |
36 std::string relative_url; // Starts with '/'. Example: "/test?query=foo" | 36 std::string relative_url; // Starts with '/'. Example: "/test?query=foo" |
37 HttpMethod method; | 37 HttpMethod method; |
| 38 std::string method_string; |
38 std::map<std::string, std::string> headers; | 39 std::map<std::string, std::string> headers; |
39 std::string content; | 40 std::string content; |
40 bool has_content; | 41 bool has_content; |
41 }; | 42 }; |
42 | 43 |
43 // Parses the input data and produces a valid HttpRequest object. If there is | 44 // Parses the input data and produces a valid HttpRequest object. If there is |
44 // more than one request in one chunk, then only the first one will be parsed. | 45 // more than one request in one chunk, then only the first one will be parsed. |
45 // The common use is as below: | 46 // The common use is as below: |
46 // HttpRequestParser parser; | 47 // HttpRequestParser parser; |
47 // (...) | 48 // (...) |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // Content length of the request currently being parsed. | 107 // Content length of the request currently being parsed. |
107 size_t declared_content_length_; | 108 size_t declared_content_length_; |
108 | 109 |
109 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); | 110 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); |
110 }; | 111 }; |
111 | 112 |
112 } // namespace test_server | 113 } // namespace test_server |
113 } // namespace net | 114 } // namespace net |
114 | 115 |
115 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ | 116 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ |
OLD | NEW |