diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-07-27 22:44:30 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2011-07-27 22:44:30 +0900 |
| commit | 03f0774482075c9777ad5733e7e285d792a76360 (patch) | |
| tree | a671d34c6b95340040723a80485affed2c9b6e72 /src/HttpResponseCommand.cc | |
| parent | 7b86b294c97fbe3eba66b5b994a689598fa0879b (diff) | |
Consistent naming scheme for hash type and digest for DownloadContext.
Diffstat (limited to 'src/HttpResponseCommand.cc')
| -rw-r--r-- | src/HttpResponseCommand.cc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/HttpResponseCommand.cc b/src/HttpResponseCommand.cc index 60a393e3..0f25f757 100644 --- a/src/HttpResponseCommand.cc +++ b/src/HttpResponseCommand.cc @@ -213,12 +213,11 @@ bool HttpResponseCommand::executeInternal() httpResponse->getDigest(checksums); for(std::vector<Checksum>::iterator i = checksums.begin(), eoi = checksums.end(); i != eoi; ++i) { - if(getDownloadContext()->getChecksumHashAlgo().empty()) { + if(getDownloadContext()->getHashType().empty()) { A2_LOG_DEBUG(fmt("Setting digest: type=%s, digest=%s", (*i).getHashType().c_str(), (*i).getDigest().c_str())); - getDownloadContext()->setChecksumHashAlgo((*i).getHashType()); - getDownloadContext()->setChecksum((*i).getDigest()); + getDownloadContext()->setDigest((*i).getHashType(), (*i).getDigest()); break; } else { if(checkChecksum(getDownloadContext(), *i)) { @@ -282,7 +281,7 @@ bool HttpResponseCommand::executeInternal() } } else { #ifdef ENABLE_MESSAGE_DIGEST - if(!getDownloadContext()->getChecksumHashAlgo().empty() && + if(!getDownloadContext()->getHashType().empty() && httpHeader->defined(HttpHeader::DIGEST)) { std::vector<Checksum> checksums; httpResponse->getDigest(checksums); @@ -559,8 +558,8 @@ bool HttpResponseCommand::checkChecksum (const SharedHandle<DownloadContext>& dctx, const Checksum& checksum) { - if(dctx->getChecksumHashAlgo() == checksum.getHashType()) { - if(dctx->getChecksum() == checksum.getDigest()) { + if(dctx->getHashType() == checksum.getHashType()) { + if(dctx->getDigest() == checksum.getDigest()) { A2_LOG_INFO("Valid hash found in Digest header field."); return true; } else { |
