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

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

Issue 266243004: Clang format slam. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
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
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 // void OnDataChunkReceived(Socket* socket, const char* data, int size) { 48 // void OnDataChunkReceived(Socket* socket, const char* data, int size) {
49 // parser.ProcessChunk(std::string(data, size)); 49 // parser.ProcessChunk(std::string(data, size));
50 // if (parser.ParseRequest() == HttpRequestParser::ACCEPTED) { 50 // if (parser.ParseRequest() == HttpRequestParser::ACCEPTED) {
51 // scoped_ptr<HttpRequest> request = parser.GetRequest(); 51 // scoped_ptr<HttpRequest> request = parser.GetRequest();
52 // (... process the request ...) 52 // (... process the request ...)
53 // } 53 // }
54 class HttpRequestParser { 54 class HttpRequestParser {
55 public: 55 public:
56 // Parsing result. 56 // Parsing result.
57 enum ParseResult { 57 enum ParseResult {
58 WAITING, // A request is not completed yet, waiting for more data. 58 WAITING, // A request is not completed yet, waiting for more data.
59 ACCEPTED, // A request has been parsed and it is ready to be processed. 59 ACCEPTED, // A request has been parsed and it is ready to be processed.
60 }; 60 };
61 61
62 // Parser state. 62 // Parser state.
63 enum State { 63 enum State {
64 STATE_HEADERS, // Waiting for a request headers. 64 STATE_HEADERS, // Waiting for a request headers.
65 STATE_CONTENT, // Waiting for content data. 65 STATE_CONTENT, // Waiting for content data.
66 STATE_ACCEPTED, // Request has been parsed. 66 STATE_ACCEPTED, // Request has been parsed.
67 }; 67 };
68 68
69 HttpRequestParser(); 69 HttpRequestParser();
70 ~HttpRequestParser(); 70 ~HttpRequestParser();
71 71
72 // Adds chunk of data into the internal buffer. 72 // Adds chunk of data into the internal buffer.
73 void ProcessChunk(const base::StringPiece& data); 73 void ProcessChunk(const base::StringPiece& data);
74 74
75 // Parses the http request (including data - if provided). 75 // Parses the http request (including data - if provided).
(...skipping 30 matching lines...) Expand all
106 // Content length of the request currently being parsed. 106 // Content length of the request currently being parsed.
107 size_t declared_content_length_; 107 size_t declared_content_length_;
108 108
109 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser); 109 DISALLOW_COPY_AND_ASSIGN(HttpRequestParser);
110 }; 110 };
111 111
112 } // namespace test_server 112 } // namespace test_server
113 } // namespace net 113 } // namespace net
114 114
115 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_ 115 #endif // NET_TEST_EMBEDDED_TEST_SERVER_HTTP_REQUEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698