summaryrefslogtreecommitdiff
path: root/src/Xml2MetalinkProcessor.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-08-07 16:05:00 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-08-07 16:05:00 +0000
commit58dbaafc8502c9537972904aa5f4e42a73b9f066 (patch)
treeaf13c906fe21f5748431814d8af985700abfa43d /src/Xml2MetalinkProcessor.cc
parent9251b47f6cccc7cd5175ab6858c3330eb0752061 (diff)
2006-08-08 Tatsuhiro Tsujikawa <tujikawa@rednoah.com>
* src/FtpNegotiateCommand.cc (recvGreeting): Call disableWriteCheckSocket just after socket->setBlockingMode(). This avoids unnecessary CPU-hog loop. 2006-08-07 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com> * src/PeerChokeCommand.h (PeerChokeCommand): Rearranged the arguments. * src/PeerChokeCommand.cc (PeerChokeCommand): Rearranged the arguments. * src/MetalinkEntry.h (Checksum.h): Included. (md5): Removed. (sha1): Removed. (checksum): New variable. (operator=): Updated. (check): Removed. * src/prefs.h (PREF_LOWEST_SPEED_LIMIT): New definition. (PREF_FOLLOW_TORRENT): New definition. (PREF_SELECT_FILE): New definition. (PREF_FOLLOW_METALINK): New definition. * src/MetalinkResource.h (TYPE_HTTPS): Added to enum TYPE. * src/TorrentMan.cc (~TorrentMan): Rewritten. * src/MultiDiskWriter.cc (MultiDiskAdaptor): Updated according to the changes in MessageDigestContext. (~MultiDiskAdaptor): Updated according to the changes in MessageDigestContext. (hashUpdate): Updated according to the changes in MessageDigestContext. (sha1Sum): Updated according to the changes in MessageDigestContext. * src/Util.h (fileChecksum): Updated according to the changes in MessageDigestContext. * src/Util.cc (sha1Sum): Updated according to the changes in MessageDigestContext. (fileChecksum): Updated according to the changes in MessageDigestContext. * src/messageDigest.h: Rewritten. * src/MetalinkEntry.cc (check): Removed. (Supported): Updated. (dropUnsupportedResource): Fixed a memory leak. * src/ShaVisitor.cc (ShaVisitor): Updated according to the changes in MessageDigestContext. (~ShaVisitor): Updated according to the changes in MessageDigestContext. (visit): Updated according to the changes in MessageDigestContext. * src/main.cc (main): Rewritten the portion of download loop. --lowest-speed-limit command-line option added. * src/DownloadEngine.h (SocketEntry): New class. (SocketEntries): New definition. (PairFind): Removed. (SockCmdMap): Removed. * src/DownloadEngine.cc (DownloadEngine): Rewritten. (~DownloadEngine): Rewritten. (run): Renamed activeCommandUuids as activeUuids. (SetDescriptor): Rewritten. (AccumulateActiveCommandUuid): Removed. (AccumulateActiveUuid): New function object. (waitData): Rewritten. (updateFdSet): Rewritten. (addSocket): Rewritten. (deleteSocket): Rewritten. (addSocketForReadCheck): Rewritten. (deleteSocketForReadCheck): Rewritten. (addSocketForWriteCheck): Rewritten. (deleteSocketForWriteCheck): Rewritten. * src/Xml2MetalinkProcessor.cc (getEntry): Rewritten the portion of MetalinkEntry creation. * src/DownloadCommand.cc (executeInternal): Added the check routine for lowest speed limit. * src/AbstractDiskWriter.cc (AbstractDiskWriter): Updated according to the changes in MessageDigestContext. (~AbstractDiskWriter): Updated according to the changes in MessageDigestContext. (sha1Sum): Updated according to the changes in MessageDigestContext. * src/RequestInfo.h: New class. * src/UrlRequestInfo.h: New class. * src/UrlRequestInfo.cc: New class. * src/TorrentRequestInfo.h: New class. * src/TorrentRequestInfo.cc: New class. * src/MetalinkRequestInfo.h: New class. * src/MetalinkRequestInfo.cc: New class. * src/Checksum.h: New class. * src/DownloadEngineFactory.h: New class. * src/DownloadEngineFactory.cc: New class.
Diffstat (limited to 'src/Xml2MetalinkProcessor.cc')
-rw-r--r--src/Xml2MetalinkProcessor.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Xml2MetalinkProcessor.cc b/src/Xml2MetalinkProcessor.cc
index bb3281a9..f68f2da2 100644
--- a/src/Xml2MetalinkProcessor.cc
+++ b/src/Xml2MetalinkProcessor.cc
@@ -88,8 +88,20 @@ MetalinkEntry* Xml2MetalinkProcessor::getEntry(const string& xpath) {
entry->version = Util::trim(xpathContent(xpath+"/m:version"));
entry->language = Util::trim(xpathContent(xpath+"/m:language"));
entry->os = Util::trim(xpathContent(xpath+"/m:os"));
- entry->md5 = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"md5\"]")));
- entry->sha1 = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"sha1\"]")));
+#ifdef ENABLE_MESSAGE_DIGEST
+ string md;
+ md = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"sha1\"]")));
+ if(md.size() > 0) {
+ entry->checksum.setMessageDigest(md);
+ entry->checksum.setDigestAlgo(DIGEST_ALGO_SHA1);
+ } else {
+ md = Util::toLower(Util::trim(xpathContent(xpath+"/m:verification/m:hash[@type=\"md5\"]")));
+ if(md.size() > 0) {
+ entry->checksum.setMessageDigest(md);
+ entry->checksum.setDigestAlgo(DIGEST_ALGO_MD5);
+ }
+ }
+#endif // ENABLE_MESSAGE_DIGEST
for(int index = 1; 1; index++) {
MetalinkResource* resource =
getResource(xpath+"/m:resources/m:url["+Util::itos(index)+"]");
@@ -121,6 +133,8 @@ MetalinkResource* Xml2MetalinkProcessor::getResource(const string& xpath) {
resource->type = MetalinkResource::TYPE_FTP;
} else if(type == "http") {
resource->type = MetalinkResource::TYPE_HTTP;
+ } else if(type == "https") {
+ resource->type = MetalinkResource::TYPE_HTTPS;
} else if(type == "bittorrent") {
resource->type = MetalinkResource::TYPE_BITTORRENT;
} else {