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 28 matching lines...) Expand all Loading... |
39 class NET_EXPORT_PRIVATE HttpStreamParser { | 39 class NET_EXPORT_PRIVATE HttpStreamParser { |
40 public: | 40 public: |
41 // Any data in |read_buffer| will be used before reading from the socket | 41 // Any data in |read_buffer| will be used before reading from the socket |
42 // and any data left over after parsing the stream will be put into | 42 // and any data left over after parsing the stream will be put into |
43 // |read_buffer|. The left over data will start at offset 0 and the | 43 // |read_buffer|. The left over data will start at offset 0 and the |
44 // buffer's offset will be set to the first free byte. |read_buffer| may | 44 // buffer's offset will be set to the first free byte. |read_buffer| may |
45 // have its capacity changed. | 45 // have its capacity changed. |
46 HttpStreamParser(ClientSocketHandle* connection, | 46 HttpStreamParser(ClientSocketHandle* connection, |
47 const HttpRequestInfo* request, | 47 const HttpRequestInfo* request, |
48 GrowableIOBuffer* read_buffer, | 48 GrowableIOBuffer* read_buffer, |
49 const BoundNetLog& net_log); | 49 const NetLogWithSource& net_log); |
50 virtual ~HttpStreamParser(); | 50 virtual ~HttpStreamParser(); |
51 | 51 |
52 // Sets whether or not HTTP/0.9 is only allowed on default ports. It's not | 52 // Sets whether or not HTTP/0.9 is only allowed on default ports. It's not |
53 // allowed, by default. | 53 // allowed, by default. |
54 void set_http_09_on_non_default_ports_enabled( | 54 void set_http_09_on_non_default_ports_enabled( |
55 bool http_09_on_non_default_ports_enabled) { | 55 bool http_09_on_non_default_ports_enabled) { |
56 http_09_on_non_default_ports_enabled_ = | 56 http_09_on_non_default_ports_enabled_ = |
57 http_09_on_non_default_ports_enabled; | 57 http_09_on_non_default_ports_enabled; |
58 } | 58 } |
59 | 59 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 264 |
265 // In the client callback, the client can do anything, including | 265 // In the client callback, the client can do anything, including |
266 // destroying this class, so any pending callback must be issued | 266 // destroying this class, so any pending callback must be issued |
267 // after everything else is done. When it is time to issue the client | 267 // after everything else is done. When it is time to issue the client |
268 // callback, move it from |callback_| to |scheduled_callback_|. | 268 // callback, move it from |callback_| to |scheduled_callback_|. |
269 CompletionCallback scheduled_callback_; | 269 CompletionCallback scheduled_callback_; |
270 | 270 |
271 // The underlying socket. | 271 // The underlying socket. |
272 ClientSocketHandle* const connection_; | 272 ClientSocketHandle* const connection_; |
273 | 273 |
274 BoundNetLog net_log_; | 274 NetLogWithSource net_log_; |
275 | 275 |
276 // Callback to be used when doing IO. | 276 // Callback to be used when doing IO. |
277 CompletionCallback io_callback_; | 277 CompletionCallback io_callback_; |
278 | 278 |
279 // Buffer used to read the request body from UploadDataStream. | 279 // Buffer used to read the request body from UploadDataStream. |
280 scoped_refptr<SeekableIOBuffer> request_body_read_buf_; | 280 scoped_refptr<SeekableIOBuffer> request_body_read_buf_; |
281 // Buffer used to send the request body. This points the same buffer as | 281 // Buffer used to send the request body. This points the same buffer as |
282 // |request_body_read_buf_| unless the data is chunked. | 282 // |request_body_read_buf_| unless the data is chunked. |
283 scoped_refptr<SeekableIOBuffer> request_body_send_buf_; | 283 scoped_refptr<SeekableIOBuffer> request_body_send_buf_; |
284 bool sent_last_chunk_; | 284 bool sent_last_chunk_; |
285 | 285 |
286 // Error received when uploading the body, if any. | 286 // Error received when uploading the body, if any. |
287 int upload_error_; | 287 int upload_error_; |
288 | 288 |
289 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; | 289 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; |
290 | 290 |
291 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); | 291 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); |
292 }; | 292 }; |
293 | 293 |
294 } // namespace net | 294 } // namespace net |
295 | 295 |
296 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ | 296 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ |
OLD | NEW |