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_HTTP_HTTP_STREAM_PARSER_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_PARSER_H_ |
6 #define NET_HTTP_HTTP_STREAM_PARSER_H_ | 6 #define NET_HTTP_HTTP_STREAM_PARSER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // and any data left over after parsing the stream will be put into | 43 // and any data left over after parsing the stream will be put into |
44 // |read_buffer|. The left over data will start at offset 0 and the | 44 // |read_buffer|. The left over data will start at offset 0 and the |
45 // buffer's offset will be set to the first free byte. |read_buffer| may | 45 // buffer's offset will be set to the first free byte. |read_buffer| may |
46 // have its capacity changed. | 46 // have its capacity changed. |
47 HttpStreamParser(ClientSocketHandle* connection, | 47 HttpStreamParser(ClientSocketHandle* connection, |
48 const HttpRequestInfo* request, | 48 const HttpRequestInfo* request, |
49 GrowableIOBuffer* read_buffer, | 49 GrowableIOBuffer* read_buffer, |
50 const BoundNetLog& net_log); | 50 const BoundNetLog& net_log); |
51 virtual ~HttpStreamParser(); | 51 virtual ~HttpStreamParser(); |
52 | 52 |
53 // Sets whether or not HTTP/0.9 is only allowed on default ports. It's not | |
54 // allowed, by default. | |
55 void set_http_09_on_non_default_ports_enabled( | |
56 bool http_09_on_non_default_ports_enabled) { | |
57 http_09_on_non_default_ports_enabled_ = | |
58 http_09_on_non_default_ports_enabled; | |
59 } | |
60 | |
61 // These functions implement the interface described in HttpStream with | 53 // These functions implement the interface described in HttpStream with |
62 // some additional functionality | 54 // some additional functionality |
63 int SendRequest(const std::string& request_line, | 55 int SendRequest(const std::string& request_line, |
64 const HttpRequestHeaders& headers, | 56 const HttpRequestHeaders& headers, |
65 HttpResponseInfo* response, | 57 HttpResponseInfo* response, |
66 const CompletionCallback& callback); | 58 const CompletionCallback& callback); |
67 | 59 |
68 int ReadResponseHeaders(const CompletionCallback& callback); | 60 int ReadResponseHeaders(const CompletionCallback& callback); |
69 | 61 |
70 int ReadResponseBody(IOBuffer* buf, int buf_len, | 62 int ReadResponseBody(IOBuffer* buf, int buf_len, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 // The request to send. | 202 // The request to send. |
211 const HttpRequestInfo* request_; | 203 const HttpRequestInfo* request_; |
212 | 204 |
213 // The request header data. May include a merged request body. | 205 // The request header data. May include a merged request body. |
214 scoped_refptr<DrainableIOBuffer> request_headers_; | 206 scoped_refptr<DrainableIOBuffer> request_headers_; |
215 | 207 |
216 // Size of just the request headers. May be less than the length of | 208 // Size of just the request headers. May be less than the length of |
217 // |request_headers_| if the body was merged with the headers. | 209 // |request_headers_| if the body was merged with the headers. |
218 int request_headers_length_; | 210 int request_headers_length_; |
219 | 211 |
220 // True if HTTP/0.9 should be permitted on non-default ports. | |
221 bool http_09_on_non_default_ports_enabled_; | |
222 | |
223 // Temporary buffer for reading. | 212 // Temporary buffer for reading. |
224 scoped_refptr<GrowableIOBuffer> read_buf_; | 213 scoped_refptr<GrowableIOBuffer> read_buf_; |
225 | 214 |
226 // Offset of the first unused byte in |read_buf_|. May be nonzero due to | 215 // Offset of the first unused byte in |read_buf_|. May be nonzero due to |
227 // body data in the same packet as header data but is zero when reading | 216 // body data in the same packet as header data but is zero when reading |
228 // headers. | 217 // headers. |
229 int read_buf_unused_offset_; | 218 int read_buf_unused_offset_; |
230 | 219 |
231 // The amount beyond |read_buf_unused_offset_| where the status line starts; | 220 // The amount beyond |read_buf_unused_offset_| where the status line starts; |
232 // -1 if not found yet. | 221 // -1 if not found yet. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 int upload_error_; | 281 int upload_error_; |
293 | 282 |
294 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; | 283 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; |
295 | 284 |
296 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); | 285 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); |
297 }; | 286 }; |
298 | 287 |
299 } // namespace net | 288 } // namespace net |
300 | 289 |
301 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ | 290 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ |
OLD | NEW |