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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
« no previous file with comments | « net/ssl/ssl_config_service.cc ('k') | net/test/embedded_test_server/http_request.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 #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 14
15 namespace net { 15 namespace net {
16
17 class HttpChunkedDecoder;
18
16 namespace test_server { 19 namespace test_server {
17 20
18 // Methods of HTTP requests supported by the test HTTP server. 21 // Methods of HTTP requests supported by the test HTTP server.
19 enum HttpMethod { 22 enum HttpMethod {
20 METHOD_UNKNOWN, 23 METHOD_UNKNOWN,
21 METHOD_GET, 24 METHOD_GET,
22 METHOD_HEAD, 25 METHOD_HEAD,
23 METHOD_POST, 26 METHOD_POST,
24 METHOD_PUT, 27 METHOD_PUT,
25 METHOD_DELETE, 28 METHOD_DELETE,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 scoped_ptr<HttpRequest> GetRequest(); 89 scoped_ptr<HttpRequest> GetRequest();
87 90
88 private: 91 private:
89 HttpMethod GetMethodType(const std::string& token) const; 92 HttpMethod GetMethodType(const std::string& token) const;
90 93
91 // Parses headers and returns ACCEPTED if whole request was parsed. Otherwise 94 // Parses headers and returns ACCEPTED if whole request was parsed. Otherwise
92 // returns WAITING. 95 // returns WAITING.
93 ParseResult ParseHeaders(); 96 ParseResult ParseHeaders();
94 97
95 // Parses request's content data and returns ACCEPTED if all of it have been 98 // Parses request's content data and returns ACCEPTED if all of it have been
96 // processed. Chunked Transfer Encoding *is not* supported. 99 // processed. Chunked Transfer Encoding is supported.
97 ParseResult ParseContent(); 100 ParseResult ParseContent();
98 101
99 // Fetches the next line from the buffer. Result does not contain \r\n. 102 // Fetches the next line from the buffer. Result does not contain \r\n.
100 // Returns an empty string for an empty line. It will assert if there is 103 // Returns an empty string for an empty line. It will assert if there is
101 // no line available. 104 // no line available.
102 std::string ShiftLine(); 105 std::string ShiftLine();
103 106
104 scoped_ptr<HttpRequest> http_request_; 107 scoped_ptr<HttpRequest> http_request_;
105 std::string buffer_; 108 std::string buffer_;
106 size_t buffer_position_; // Current position in the internal buffer. 109 size_t buffer_position_; // Current position in the internal buffer.
107 State state_; 110 State state_;
108 // Content length of the request currently being parsed. 111 // Content length of the request currently being parsed.
109 size_t declared_content_length_; 112 size_t declared_content_length_;
110 113
114 scoped_ptr<net::HttpChunkedDecoder> chunked_decoder_;
115
111 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); 116 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser);
112 }; 117 };
113 118
114 } // namespace test_server 119 } // namespace test_server
115 } // namespace net 120 } // namespace net
116 121
117 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ 122 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_
OLDNEW
« no previous file with comments | « net/ssl/ssl_config_service.cc ('k') | net/test/embedded_test_server/http_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698