OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_H_ | 5 #ifndef SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_H_ |
6 #define SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_H_ | 6 #define SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_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/strings/string_piece.h" | 12 #include "base/strings/string_piece.h" |
13 #include "mojo/services/http_server/public/interfaces/http_request.mojom.h" | 13 #include "mojo/services/http_server/interfaces/http_request.mojom.h" |
14 | 14 |
15 namespace http_server { | 15 namespace http_server { |
16 | 16 |
17 // Parses the input data and produces a valid HttpRequest object. If there is | 17 // Parses the input data and produces a valid HttpRequest object. If there is |
18 // more than one request in one chunk, then only the first one will be parsed. | 18 // more than one request in one chunk, then only the first one will be parsed. |
19 class HttpRequestParser { | 19 class HttpRequestParser { |
20 public: | 20 public: |
21 // Parsing result. | 21 // Parsing result. |
22 enum ParseResult { | 22 enum ParseResult { |
23 WAITING, // A request is not completed yet, waiting for more data. | 23 WAITING, // A request is not completed yet, waiting for more data. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 State state_; | 68 State state_; |
69 // Remaining bytes of the request content not yet put onto request->body. | 69 // Remaining bytes of the request content not yet put onto request->body. |
70 size_t remaining_content_bytes_; | 70 size_t remaining_content_bytes_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); | 72 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace http_server | 75 } // namespace http_server |
76 | 76 |
77 #endif // SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_H_ | 77 #endif // SERVICES_HTTP_SERVER_HTTP_REQUEST_PARSER_H_ |
OLD | NEW |