From a533437be6fa9d4e563b91bf117e5644f6f0a7c9 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 27 Jul 2011 20:54:21 +0900 Subject: Implemented Metalink/HTTP in HTTP download. Link header fields from first Metalink server is utilized as described in rfc6249. We only set digest from Digest header field to DownloadContext only when PieceStorage is not initialized(in other words, before file size is known). After PieceStorage is initialized, Digest header field is used to check the value is the same in digest in DownloadContext. Current implementation only handles rel=duplicate. --- src/HttpResponseCommand.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/HttpResponseCommand.h') diff --git a/src/HttpResponseCommand.h b/src/HttpResponseCommand.h index 6d341154..6c691e0e 100644 --- a/src/HttpResponseCommand.h +++ b/src/HttpResponseCommand.h @@ -45,6 +45,9 @@ class HttpDownloadCommand; class HttpResponse; class SocketCore; class StreamFilter; +#ifdef ENABLE_MESSAGE_DIGEST +class Checksum; +#endif // ENABLE_MESSAGE_DIGEST // HttpResponseCommand receives HTTP response header from remote // server. Because network I/O is non-blocking, execute() returns @@ -74,6 +77,14 @@ private: void poolConnection(); void onDryRunFileFound(); +#ifdef ENABLE_MESSAGE_DIGEST + // Returns true if dctx and checksum has same hash type and hash + // value. If they have same hash type but different hash value, + // throws exception. Otherwise returns false. + bool checkChecksum + (const SharedHandle& dctx, + const Checksum& checksum); +#endif // ENABLE_MESSAGE_DIGEST protected: bool executeInternal(); -- cgit