summaryrefslogtreecommitdiff
path: root/src/HttpResponseCommand.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/HttpResponseCommand.cc')
-rw-r--r--src/HttpResponseCommand.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc
index adfb63a8..a7d62346 100644
--- a/src/HttpResponseCommand.cc
+++ b/src/HttpResponseCommand.cc
@@ -49,6 +49,8 @@
#include "DiskAdaptor.h"
#include "PieceStorage.h"
#include "DefaultBtProgressInfoFile.h"
+#include "RequestGroupMan.h"
+#include "DownloadFailureException.h"
#include <sys/types.h>
#include <unistd.h>
@@ -91,6 +93,10 @@ bool HttpResponseCommand::executeInternal()
SingleFileDownloadContextHandle dctx = _requestGroup->getDownloadContext();
dctx->setTotalLength(totalLength);
dctx->setFilename(httpResponse->determinFilename());
+ if(e->_requestGroupMan->isSameFileBeingDownloaded(_requestGroup)) {
+ throw new DownloadFailureException(EX_DUPLICATE_FILE_DOWNLOAD,
+ _requestGroup->getFilePath().c_str());
+ }
if(totalLength == 0 || httpResponse->isTransferEncodingSpecified()) {
// we ignore content-length when transfer-encoding is set
dctx->setTotalLength(0);