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 29 matching lines...) Expand all Loading... |
40 class NET_EXPORT_PRIVATE HttpStreamParser { | 40 class NET_EXPORT_PRIVATE HttpStreamParser { |
41 public: | 41 public: |
42 // Any data in |read_buffer| will be used before reading from the socket | 42 // Any data in |read_buffer| will be used before reading from the socket |
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 NetLogWithSource& 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 | 53 // Sets whether or not HTTP/0.9 is only allowed on default ports. It's not |
54 // allowed, by default. | 54 // allowed, by default. |
55 void set_http_09_on_non_default_ports_enabled( | 55 void set_http_09_on_non_default_ports_enabled( |
56 bool http_09_on_non_default_ports_enabled) { | 56 bool http_09_on_non_default_ports_enabled) { |
57 http_09_on_non_default_ports_enabled_ = | 57 http_09_on_non_default_ports_enabled_ = |
58 http_09_on_non_default_ports_enabled; | 58 http_09_on_non_default_ports_enabled; |
59 } | 59 } |
60 | 60 |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 266 |
267 // In the client callback, the client can do anything, including | 267 // In the client callback, the client can do anything, including |
268 // destroying this class, so any pending callback must be issued | 268 // destroying this class, so any pending callback must be issued |
269 // after everything else is done. When it is time to issue the client | 269 // after everything else is done. When it is time to issue the client |
270 // callback, move it from |callback_| to |scheduled_callback_|. | 270 // callback, move it from |callback_| to |scheduled_callback_|. |
271 CompletionCallback scheduled_callback_; | 271 CompletionCallback scheduled_callback_; |
272 | 272 |
273 // The underlying socket. | 273 // The underlying socket. |
274 ClientSocketHandle* const connection_; | 274 ClientSocketHandle* const connection_; |
275 | 275 |
276 BoundNetLog net_log_; | 276 NetLogWithSource net_log_; |
277 | 277 |
278 // Callback to be used when doing IO. | 278 // Callback to be used when doing IO. |
279 CompletionCallback io_callback_; | 279 CompletionCallback io_callback_; |
280 | 280 |
281 // Buffer used to read the request body from UploadDataStream. | 281 // Buffer used to read the request body from UploadDataStream. |
282 scoped_refptr<SeekableIOBuffer> request_body_read_buf_; | 282 scoped_refptr<SeekableIOBuffer> request_body_read_buf_; |
283 // Buffer used to send the request body. This points the same buffer as | 283 // Buffer used to send the request body. This points the same buffer as |
284 // |request_body_read_buf_| unless the data is chunked. | 284 // |request_body_read_buf_| unless the data is chunked. |
285 scoped_refptr<SeekableIOBuffer> request_body_send_buf_; | 285 scoped_refptr<SeekableIOBuffer> request_body_send_buf_; |
286 bool sent_last_chunk_; | 286 bool sent_last_chunk_; |
287 | 287 |
288 // Error received when uploading the body, if any. | 288 // Error received when uploading the body, if any. |
289 int upload_error_; | 289 int upload_error_; |
290 | 290 |
291 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; | 291 base::WeakPtrFactory<HttpStreamParser> weak_ptr_factory_; |
292 | 292 |
293 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); | 293 DISALLOW_COPY_AND_ASSIGN(HttpStreamParser); |
294 }; | 294 }; |
295 | 295 |
296 } // namespace net | 296 } // namespace net |
297 | 297 |
298 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ | 298 #endif // NET_HTTP_HTTP_STREAM_PARSER_H_ |
OLD | NEW |