summaryrefslogtreecommitdiffstats
path: root/net/http/http_stream.h
diff options
context:
space:
mode:
authormbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 05:56:38 +0000
committermbelshe@chromium.org <mbelshe@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-19 05:56:38 +0000
commit8e6441caa3adedf373b8ff80bb1fb48caff81556 (patch)
tree4a37d2fe5aaa3aad04b01171feb04e329c7e0383 /net/http/http_stream.h
parent33f275a2e2e703c58f514af8efe963e2e29792f9 (diff)
downloadchromium_src-8e6441caa3adedf373b8ff80bb1fb48caff81556.zip
chromium_src-8e6441caa3adedf373b8ff80bb1fb48caff81556.tar.gz
chromium_src-8e6441caa3adedf373b8ff80bb1fb48caff81556.tar.bz2
Extract connection logic from HttpNetworkTransaction into a new
HttpStreamFactory. The HttpNetworkTransaction now deals exclusively with streams rather than connections directly. This cut the size of HTN roughly in in half. The HttpNetworkTransaction is still responsible for all proxy and server authentication functions. This is because the streams may come and go - we could create a stream, have the server declare auth is needed, and then the next attempt would be on a different stream. So Auth belongs on the HNT. The HNT no longer has direct access to the connection itself; instead, it only knows of an HttpStream. The StreamRequest, however, is responsible for determining whether the connection needs to use a proxy, whether AlternateProtocols are available, and whether the connection should be SPDY or HTTP. Other changes: - moved some static configuration methods from HNT to HttpStreamFactory. - added some methods to the HttpStream. BUG=none TEST=all Review URL: http://codereview.chromium.org/3171002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56646 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http/http_stream.h')
-rw-r--r--net/http/http_stream.h34
1 files changed, 32 insertions, 2 deletions
diff --git a/net/http/http_stream.h b/net/http/http_stream.h
index 2cdbc39..9981e09 100644
--- a/net/http/http_stream.h
+++ b/net/http/http_stream.h
@@ -18,11 +18,13 @@
namespace net {
-struct HttpRequestInfo;
+class BoundNetLog;
class HttpResponseInfo;
class IOBuffer;
+class SSLCertRequestInfo;
+class SSLInfo;
class UploadDataStream;
-class BoundNetLog;
+struct HttpRequestInfo;
class HttpStream {
public:
@@ -71,6 +73,17 @@ class HttpStream {
virtual int ReadResponseBody(IOBuffer* buf, int buf_len,
CompletionCallback* callback) = 0;
+ // Closes the stream.
+ // |not_reusable| indicates if the stream can be used for further requests.
+ // In the case of HTTP, where we re-use the byte-stream (e.g. the connection)
+ // this means we need to close the connection; in the case of SPDY, where the
+ // underlying stream is never reused, it has no effect.
+ // TODO(mbelshe): We should figure out how to fold the not_reusable flag
+ // into the stream implementation itself so that the caller
+ // does not need to pass it at all. We might also be able to
+ // eliminate the SetConnectionReused() below.
+ virtual void Close(bool not_reusable) = 0;
+
// Indicates if the response body has been completely read.
virtual bool IsResponseBodyComplete() const = 0;
@@ -85,6 +98,23 @@ class HttpStream {
// as part of the next pipelined response) has been read from the socket.
virtual bool IsMoreDataBuffered() const = 0;
+ // A stream exists on top of a connection. If the connection has been used
+ // to successfully exchange data in the past, error handling for the
+ // stream is done differently. This method returns true if the underlying
+ // connection is reused or has been connected and idle for some time.
+ virtual bool IsConnectionReused() const = 0;
+ virtual void SetConnectionReused() = 0;
+
+ // Get the SSLInfo associated with this stream's connection. This should
+ // only be called for streams over SSL sockets, otherwise the behavior is
+ // undefined.
+ virtual void GetSSLInfo(SSLInfo* ssl_info) = 0;
+
+ // Get the SSLCertRequestInfo associated with this stream's connection.
+ // This should only be called for streams over SSL sockets, otherwise the
+ // behavior is undefined.
+ virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) = 0;
+
private:
DISALLOW_COPY_AND_ASSIGN(HttpStream);
};