diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-01-16 16:55:41 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-01-16 16:55:41 +0900 |
| commit | ea1b4b3ee533146763245ecbbb4a31e3ed791498 (patch) | |
| tree | 5dfda14ff291403bcee9b24380c1e47673b8a98b /src/HttpConnection.h | |
| parent | 602a9d6ba3f8ee38c25448796ad51992f971da8c (diff) | |
Eliminated SocketCore::peekData() form HTTP/FTP downloads.
We introduced SocketRecvBuffer which buffers received bytes. Since
HTTP response header and response body are divided with \r\n, we have
to buffer up several bytes to find this delimiter. We use
SocketRecvBuffer to hold these bytes and only consumes header and
passes SocketRecvBuffer, which may contain head of response body, to
next Command. Since FTPConnection doesn't use SocketCore::peekData(),
we left it as is.
Diffstat (limited to 'src/HttpConnection.h')
| -rw-r--r-- | src/HttpConnection.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/HttpConnection.h b/src/HttpConnection.h index 9c7facea..4467a4d2 100644 --- a/src/HttpConnection.h +++ b/src/HttpConnection.h @@ -52,6 +52,7 @@ class HttpHeaderProcessor; class Option; class Segment; class SocketCore; +class SocketRecvBuffer; class HttpRequestEntry { private: @@ -80,6 +81,7 @@ class HttpConnection { private: cuid_t cuid_; SharedHandle<SocketCore> socket_; + SharedHandle<SocketRecvBuffer> socketRecvBuffer_; SocketBuffer socketBuffer_; const Option* option_; @@ -87,7 +89,10 @@ private: std::string eraseConfidentialInfo(const std::string& request); public: - HttpConnection(cuid_t cuid, const SharedHandle<SocketCore>& socket); + HttpConnection + (cuid_t cuid, + const SharedHandle<SocketCore>& socket, + const SharedHandle<SocketRecvBuffer>& socketRecvBuffer); ~HttpConnection(); /** @@ -124,6 +129,11 @@ public: bool sendBufferIsEmpty() const; void sendPendingData(); + + const SharedHandle<SocketRecvBuffer>& getSocketRecvBuffer() const + { + return socketRecvBuffer_; + } }; typedef SharedHandle<HttpConnection> HttpConnectionHandle; |
