/* */ #include "HttpDownloadCommand.h" #include "DlRetryEx.h" #include "HttpRequestCommand.h" #include "Util.h" #include "ChunkedEncoding.h" #include "message.h" #include #include #include #include using namespace std; HttpDownloadCommand::HttpDownloadCommand(int cuid, const RequestHandle req, DownloadEngine* e, const SocketHandle& socket) :DownloadCommand(cuid, req, e, socket) { ChunkedEncoding* ce = new ChunkedEncoding(); transferEncodings["chunked"] = ce; } HttpDownloadCommand::~HttpDownloadCommand() { for(map::iterator itr = transferEncodings.begin(); itr != transferEncodings.end(); itr++) { delete((*itr).second); } } TransferEncoding* HttpDownloadCommand::getTransferEncoding(const string& name) { return transferEncodings[name]; } bool HttpDownloadCommand::prepareForNextSegment(const Segment& currentSegment) { if(e->segmentMan->finished()) { return true; } else { if(req->isKeepAlive()) { Command* command = new HttpRequestCommand(cuid, req, e, socket); e->commands.push_back(command); return true; } else { return DownloadCommand::prepareForNextSegment(currentSegment); } } }