| 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 |
| 53 // These functions implement the interface described in HttpStream with | 61 // These functions implement the interface described in HttpStream with |
| 54 // some additional functionality | 62 // some additional functionality |
| 55 int SendRequest(const std::string& request_line, | 63 int SendRequest(const std::string& request_line, |
| 56 const HttpRequestHeaders& headers, | 64 const HttpRequestHeaders& headers, |
| 57 HttpResponseInfo* response, | 65 HttpResponseInfo* response, |
| 58 const CompletionCallback& callback); | 66 const CompletionCallback& callback); |
| 59 | 67 |
| 60 int ReadResponseHeaders(const CompletionCallback& callback); | 68 int ReadResponseHeaders(const CompletionCallback& callback); |
| 61 | 69 |
| 62 int ReadResponseBody(IOBuffer* buf, int buf_len, | 70 int ReadResponseBody(IOBuffer* buf, int buf_len, |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // The request to send. | 210 // The request to send. |
| 203 const HttpRequestInfo* request_; | 211 const HttpRequestInfo* request_; |
| 204 | 212 |
| 205 // The request header data. May include a merged request body. | 213 // The request header data. May include a merged request body. |
| 206 scoped_refptr<DrainableIOBuffer> request_headers_; | 214 scoped_refptr<DrainableIOBuffer> request_headers_; |
| 207 | 215 |
| 208 // Size of just the request headers. May be less than the length of | 216 // Size of just the request headers. May be less than the length of |
| 209 // |request_headers_| if the body was merged with the headers. | 217 // |request_headers_| if the body was merged with the headers. |
| 210 int request_headers_length_; | 218 int request_headers_length_; |
| 211 | 219 |
| 220 // True if HTTP/0.9 should be permitted on non-default ports. |
| 221 bool http_09_on_non_default_ports_enabled_; |
| 222 |
| 212 // Temporary buffer for reading. | 223 // Temporary buffer for reading. |
| 213 scoped_refptr<GrowableIOBuffer> read_buf_; | 224 scoped_refptr<GrowableIOBuffer> read_buf_; |
| 214 | 225 |
| 215 // Offset of the first unused byte in |read_buf_|. May be nonzero due to | 226 // Offset of the first unused byte in |read_buf_|. May be nonzero due to |
| 216 // body data in the same packet as header data but is zero when reading | 227 // body data in the same packet as header data but is zero when reading |
| 217 // headers. | 228 // headers. |
| 218 int read_buf_unused_offset_; | 229 int read_buf_unused_offset_; |
| 219 | 230 |
| 220 // The amount beyond |read_buf_unused_offset_| where the status line starts; | 231 // The amount beyond |read_buf_unused_offset_| where the status line starts; |
| 221 // -1 if not found yet. | 232 // -1 if not found yet. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 int upload_error_; | 292 int upload_error_; |
| 282 | 293 |
| 283 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; | 294 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; |
| 284 | 295 |
| 285 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); | 296 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); |
| 286 }; | 297 }; |
| 287 | 298 |
| 288 } // namespace net | 299 } // namespace net |
| 289 | 300 |
| 290 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ | 301 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ |
| OLD | NEW |