| 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 | 
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" | 
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" | 
| 13 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" | 
|  | 14 #include "url/gurl.h" | 
| 14 | 15 | 
| 15 namespace net { | 16 namespace net { | 
| 16 | 17 | 
| 17 class HttpChunkedDecoder; | 18 class HttpChunkedDecoder; | 
| 18 | 19 | 
| 19 namespace test_server { | 20 namespace test_server { | 
| 20 | 21 | 
| 21 // Methods of HTTP requests supported by the test HTTP server. | 22 // Methods of HTTP requests supported by the test HTTP server. | 
| 22 enum HttpMethod { | 23 enum HttpMethod { | 
| 23   METHOD_UNKNOWN, | 24   METHOD_UNKNOWN, | 
| 24   METHOD_GET, | 25   METHOD_GET, | 
| 25   METHOD_HEAD, | 26   METHOD_HEAD, | 
| 26   METHOD_POST, | 27   METHOD_POST, | 
| 27   METHOD_PUT, | 28   METHOD_PUT, | 
| 28   METHOD_DELETE, | 29   METHOD_DELETE, | 
| 29   METHOD_PATCH, | 30   METHOD_PATCH, | 
|  | 31   METHOD_CONNECT, | 
| 30 }; | 32 }; | 
| 31 | 33 | 
| 32 // Represents a HTTP request. Since it can be big, use scoped_ptr to pass it | 34 // Represents a HTTP request. Since it can be big, use scoped_ptr to pass it | 
| 33 // instead of copying. However, the struct is copyable so tests can save and | 35 // instead of copying. However, the struct is copyable so tests can save and | 
| 34 // examine a HTTP request. | 36 // examine a HTTP request. | 
| 35 struct HttpRequest { | 37 struct HttpRequest { | 
| 36   HttpRequest(); | 38   HttpRequest(); | 
| 37   ~HttpRequest(); | 39   ~HttpRequest(); | 
| 38 | 40 | 
|  | 41   GURL ToURL() const; | 
|  | 42 | 
| 39   std::string relative_url;  // Starts with '/'. Example: "/test?query=foo" | 43   std::string relative_url;  // Starts with '/'. Example: "/test?query=foo" | 
| 40   HttpMethod method; | 44   HttpMethod method; | 
| 41   std::string method_string; | 45   std::string method_string; | 
| 42   std::string all_headers; | 46   std::string all_headers; | 
| 43   std::map<std::string, std::string> headers; | 47   std::map<std::string, std::string> headers; | 
| 44   std::string content; | 48   std::string content; | 
| 45   bool has_content; | 49   bool has_content; | 
| 46 }; | 50 }; | 
| 47 | 51 | 
| 48 // Parses the input data and produces a valid HttpRequest object. If there is | 52 // Parses the input data and produces a valid HttpRequest object. If there is | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 113 | 117 | 
| 114   scoped_ptr<HttpChunkedDecoder> chunked_decoder_; | 118   scoped_ptr<HttpChunkedDecoder> chunked_decoder_; | 
| 115 | 119 | 
| 116   DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); | 120   DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); | 
| 117 }; | 121 }; | 
| 118 | 122 | 
| 119 }  // namespace test_server | 123 }  // namespace test_server | 
| 120 }  // namespace net | 124 }  // namespace net | 
| 121 | 125 | 
| 122 #endif  // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ | 126 #endif  // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ | 
| OLD | NEW | 
|---|