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

Side by Side Diff: net/http/http_stream.h

Issue 418035: A large Content-Length header followed by a connection close could trigger an... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 // HttpStream is an interface for reading and writing data to an HttpStream that 5 // HttpStream is an interface for reading and writing data to an HttpStream that
6 // keeps the client agnostic of the actual underlying transport layer. This 6 // keeps the client agnostic of the actual underlying transport layer. This
7 // provides an abstraction for both a basic http stream as well as http 7 // provides an abstraction for both a basic http stream as well as http
8 // pipelining implementations. 8 // pipelining implementations.
9 9
10 #ifndef NET_HTTP_HTTP_STREAM_H_ 10 #ifndef NET_HTTP_HTTP_STREAM_H_
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 // Reads from the underlying socket until the response headers have been 43 // Reads from the underlying socket until the response headers have been
44 // completely received. ERR_IO_PENDING is returned if the operation could 44 // completely received. ERR_IO_PENDING is returned if the operation could
45 // not be completed synchronously, in which case the result will be passed 45 // not be completed synchronously, in which case the result will be passed
46 // to the callback when available. Returns OK on success. The response 46 // to the callback when available. Returns OK on success. The response
47 // headers are available in the HttpResponseInfo returned by GetResponseInfo 47 // headers are available in the HttpResponseInfo returned by GetResponseInfo
48 virtual int ReadResponseHeaders(CompletionCallback* callback) = 0; 48 virtual int ReadResponseHeaders(CompletionCallback* callback) = 0;
49 49
50 // Provides access to HttpResponseInfo (owned by HttpStream). 50 // Provides access to HttpResponseInfo (owned by HttpStream).
51 virtual HttpResponseInfo* GetResponseInfo() const = 0; 51 virtual HttpResponseInfo* GetResponseInfo() const = 0;
52 52
53 // Reads response body data, up to |buf_len| bytes. The number of bytes read 53 // Reads response body data, up to |buf_len| bytes. |buf_len| should be a
54 // is returned, or an error is returned upon failure. ERR_CONNECTION_CLOSED 54 // reasonable size (<256KB). The number of bytes read is returned, or an
55 // is returned to indicate end-of-connection. ERR_IO_PENDING is returned if 55 // error is returned upon failure. ERR_CONNECTION_CLOSED is returned to
56 // the operation could not be completed synchronously, in which case the 56 // indicate end-of-connection. ERR_IO_PENDING is returned if the operation
57 // result will be passed to the callback when available. If the operation is 57 // could not be completed synchronously, in which case the result will be
58 // not completed immediately, the socket acquires a reference to the provided 58 // passed to the callback when available. If the operation is not completed
59 // buffer until the callback is invoked or the socket is destroyed. 59 // immediately, the socket acquires a reference to the provided buffer until
60 // the callback is invoked or the socket is destroyed.
60 virtual int ReadResponseBody(IOBuffer* buf, int buf_len, 61 virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
61 CompletionCallback* callback) = 0; 62 CompletionCallback* callback) = 0;
62 63
63 // Indicates if the response body has been completely read. 64 // Indicates if the response body has been completely read.
64 virtual bool IsResponseBodyComplete() const = 0; 65 virtual bool IsResponseBodyComplete() const = 0;
65 66
66 // Indicates that the end of the response is detectable. This means that 67 // Indicates that the end of the response is detectable. This means that
67 // the response headers indicate either chunked encoding or content length. 68 // the response headers indicate either chunked encoding or content length.
68 // If neither is sent, the server must close the connection for us to detect 69 // If neither is sent, the server must close the connection for us to detect
69 // the end of the response. 70 // the end of the response.
70 virtual bool CanFindEndOfResponse() const = 0; 71 virtual bool CanFindEndOfResponse() const = 0;
71 72
72 // After the response headers have been read and after the response body 73 // After the response headers have been read and after the response body
73 // is complete, this function indicates if more data (either erroneous or 74 // is complete, this function indicates if more data (either erroneous or
74 // as part of the next pipelined response) has been read from the socket. 75 // as part of the next pipelined response) has been read from the socket.
75 virtual bool IsMoreDataBuffered() const = 0; 76 virtual bool IsMoreDataBuffered() const = 0;
76 77
77 private: 78 private:
78 DISALLOW_COPY_AND_ASSIGN(HttpStream); 79 DISALLOW_COPY_AND_ASSIGN(HttpStream);
79 }; 80 };
80 81
81 } // namespace net 82 } // namespace net
82 83
83 #endif // NET_HTTP_HTTP_STREAM_H_ 84 #endif // NET_HTTP_HTTP_STREAM_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_unittest.cc ('k') | net/http/http_stream_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698