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.
This commit is contained in:
Tatsuhiro Tsujikawa 2011-01-16 16:55:41 +09:00
parent 602a9d6ba3
commit ea1b4b3ee5
30 changed files with 412 additions and 143 deletions

View file

@ -71,6 +71,7 @@
#include "SinkStreamFilter.h"
#include "ChunkedDecodingStreamFilter.h"
#include "uri.h"
#include "SocketRecvBuffer.h"
#ifdef HAVE_LIBZ
# include "GZipDecodingStreamFilter.h"
#endif // HAVE_LIBZ
@ -134,9 +135,12 @@ HttpResponseCommand::HttpResponseCommand
const HttpConnectionHandle& httpConnection,
DownloadEngine* e,
const SocketHandle& s)
: AbstractCommand(cuid, req, fileEntry, requestGroup, e, s),
: AbstractCommand(cuid, req, fileEntry, requestGroup, e, s,
httpConnection->getSocketRecvBuffer()),
httpConnection_(httpConnection)
{}
{
checkSocketRecvBuffer();
}
HttpResponseCommand::~HttpResponseCommand() {}