diff options
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 7961f34d..dd27ab57 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -26,9 +26,6 @@ #include "HttpInitiateConnectionCommand.h" #include "message.h" #include "Util.h" -#include "TrackerDownloadCommand.h" -// TODO -#include "TorrentDownloadEngine.h" HttpResponseCommand::HttpResponseCommand(int cuid, Request* req, DownloadEngine* e, const Socket* s): AbstractCommand(cuid, req, e, s) { @@ -97,6 +94,7 @@ bool HttpResponseCommand::handleDefaultEncoding(const HttpHeader& headers) { long long int size = headers.getFirstAsLLInt("Content-Length"); e->segmentMan->totalSize = size; e->segmentMan->isSplittable = false; + e->segmentMan->downloadStarted = true; createHttpDownloadCommand(); return true; } @@ -138,22 +136,17 @@ bool HttpResponseCommand::handleOtherEncoding(string transferEncoding, const Htt } void HttpResponseCommand::createHttpDownloadCommand(string transferEncoding) { - if(!req->isTorrent) { - HttpDownloadCommand* command = new HttpDownloadCommand(cuid, req, e, socket); - TransferEncoding* enc = NULL; - if(transferEncoding.size() && (enc = command->getTransferEncoding(transferEncoding)) == NULL) { - delete(command); - throw new DlAbortEx(EX_TRANSFER_ENCODING_NOT_SUPPORTED, transferEncoding.c_str()); - } else { - if(enc != NULL) { - command->transferEncoding = transferEncoding; - enc->init(); - } - e->commands.push(command); - } + + HttpDownloadCommand* command = new HttpDownloadCommand(cuid, req, e, socket); + TransferEncoding* enc = NULL; + if(transferEncoding.size() && (enc = command->getTransferEncoding(transferEncoding)) == NULL) { + delete(command); + throw new DlAbortEx(EX_TRANSFER_ENCODING_NOT_SUPPORTED, transferEncoding.c_str()); } else { - // TODO - TrackerDownloadCommand* command = new TrackerDownloadCommand(cuid, req, (TorrentDownloadEngine*)e, socket); + if(enc != NULL) { + command->transferEncoding = transferEncoding; + enc->init(); + } e->commands.push(command); } } |
