Browse Source

Fixed compile error when message digest is not available.

Tatsuhiro Tsujikawa 18 years ago
parent
commit
800bc3a6c3
17 changed files with 197 additions and 88 deletions
  1. 2 0
      Makefile.in
  2. 3 0
      TODO
  3. 40 1
      configure
  4. 3 0
      configure.ac
  5. 2 0
      doc/Makefile.in
  6. 2 0
      m4/Makefile.in
  7. 2 0
      src/ConsoleDownloadEngine.cc
  8. 5 1
      src/DownloadCommand.cc
  9. 6 2
      src/DownloadEngine.cc
  10. 5 1
      src/DownloadEngine.h
  11. 5 2
      src/DownloadEngineFactory.cc
  12. 13 10
      src/Makefile.am
  13. 50 44
      src/Makefile.in
  14. 23 14
      src/RequestGroup.cc
  15. 23 12
      src/RequestGroup.h
  16. 11 1
      src/main.cc
  17. 2 0
      test/Makefile.in

+ 2 - 0
Makefile.in

@@ -118,6 +118,8 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
 ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
 ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
 ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
+ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
+ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
 ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
 ENABLE_METALINK_TRUE = @ENABLE_METALINK_TRUE@
 EXEEXT = @EXEEXT@

+ 3 - 0
TODO

@@ -25,3 +25,6 @@
 * consider life cycle of requestGroup and segmentMan
 * exit status: all downloads have been successful-> EXIT_SUCCESS,
 		some of downloads have been failed -> EXIT_FAILURE
+
+
+* Replace MetalinkChunkChecksum with ChunkChecksum

+ 40 - 1
configure

@@ -716,6 +716,8 @@ LIBCARES_LIBS
 LIBCARES_CPPFLAGS
 LIBARES_LIBS
 LIBARES_CPPFLAGS
+ENABLE_MESSAGE_DIGEST_TRUE
+ENABLE_MESSAGE_DIGEST_FALSE
 ENABLE_BITTORRENT_TRUE
 ENABLE_BITTORRENT_FALSE
 ENABLE_METALINK_TRUE
@@ -5439,7 +5441,28 @@ cat >>confdefs.h <<\_ACEOF
 #define ENABLE_MESSAGE_DIGEST 1
 _ACEOF
 
+
+
+if true; then
+  ENABLE_MESSAGE_DIGEST_TRUE=
+  ENABLE_MESSAGE_DIGEST_FALSE='#'
+else
+  ENABLE_MESSAGE_DIGEST_TRUE='#'
+  ENABLE_MESSAGE_DIGEST_FALSE=
+fi
+
   enable_message_digest=yes
+else
+
+
+if false; then
+  ENABLE_MESSAGE_DIGEST_TRUE=
+  ENABLE_MESSAGE_DIGEST_FALSE='#'
+else
+  ENABLE_MESSAGE_DIGEST_TRUE='#'
+  ENABLE_MESSAGE_DIGEST_FALSE=
+fi
+
 fi
 
 if test "x$enable_bittorrent" = "xyes" && test "x$enable_message_digest" = "xyes"; then
@@ -12599,6 +12622,20 @@ echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." >&2;}
    { (exit 1); exit 1; }; }
 fi
+if test -z "${ENABLE_MESSAGE_DIGEST_TRUE}" && test -z "${ENABLE_MESSAGE_DIGEST_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MESSAGE_DIGEST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_MESSAGE_DIGEST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+if test -z "${ENABLE_MESSAGE_DIGEST_TRUE}" && test -z "${ENABLE_MESSAGE_DIGEST_FALSE}"; then
+  { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MESSAGE_DIGEST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_MESSAGE_DIGEST\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+   { (exit 1); exit 1; }; }
+fi
 if test -z "${ENABLE_BITTORRENT_TRUE}" && test -z "${ENABLE_BITTORRENT_FALSE}"; then
   { { echo "$as_me:$LINENO: error: conditional \"ENABLE_BITTORRENT\" was never defined.
 Usually this means the macro was only invoked conditionally." >&5
@@ -13328,6 +13365,8 @@ LIBCARES_LIBS!$LIBCARES_LIBS$ac_delim
 LIBCARES_CPPFLAGS!$LIBCARES_CPPFLAGS$ac_delim
 LIBARES_LIBS!$LIBARES_LIBS$ac_delim
 LIBARES_CPPFLAGS!$LIBARES_CPPFLAGS$ac_delim
+ENABLE_MESSAGE_DIGEST_TRUE!$ENABLE_MESSAGE_DIGEST_TRUE$ac_delim
+ENABLE_MESSAGE_DIGEST_FALSE!$ENABLE_MESSAGE_DIGEST_FALSE$ac_delim
 ENABLE_BITTORRENT_TRUE!$ENABLE_BITTORRENT_TRUE$ac_delim
 ENABLE_BITTORRENT_FALSE!$ENABLE_BITTORRENT_FALSE$ac_delim
 ENABLE_METALINK_TRUE!$ENABLE_METALINK_TRUE$ac_delim
@@ -13372,7 +13411,7 @@ LIBOBJS!$LIBOBJS$ac_delim
 LTLIBOBJS!$LTLIBOBJS$ac_delim
 _ACEOF
 
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 46; then
+  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 48; then
     break
   elif $ac_last_try; then
     { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5

+ 3 - 0
configure.ac

@@ -72,7 +72,10 @@ fi
 
 if test "x$have_libgcrypt" = "xyes" || test "x$have_openssl" = "xyes"; then
   AC_DEFINE([ENABLE_MESSAGE_DIGEST], [1], [Define to 1 if message digest support is enabled.])
+  AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], true)
   enable_message_digest=yes
+else
+  AM_CONDITIONAL([ENABLE_MESSAGE_DIGEST], false)
 fi
 
 if test "x$enable_bittorrent" = "xyes" && test "x$enable_message_digest" = "xyes"; then

+ 2 - 0
doc/Makefile.in

@@ -96,6 +96,8 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
 ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
 ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
 ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
+ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
+ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
 ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
 ENABLE_METALINK_TRUE = @ENABLE_METALINK_TRUE@
 EXEEXT = @EXEEXT@

+ 2 - 0
m4/Makefile.in

@@ -92,6 +92,8 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
 ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
 ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
 ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
+ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
+ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
 ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
 ENABLE_METALINK_TRUE = @ENABLE_METALINK_TRUE@
 EXEEXT = @EXEEXT@

+ 2 - 0
src/ConsoleDownloadEngine.cc

@@ -127,6 +127,7 @@ void ConsoleDownloadEngine::sendStatistics(long long int currentSize, long long
       }
     }
   }
+#ifdef ENABLE_MESSAGE_DIGEST
   {
     CheckIntegrityEntryHandle entry = _checkIntegrityMan->getFirstCheckIntegrityEntry();
     if(!entry.isNull()) {
@@ -149,6 +150,7 @@ void ConsoleDownloadEngine::sendStatistics(long long int currentSize, long long
       }
     }
   }
+#endif // ENABLE_MESSAGE_DIGEST
   cout << flush;
 }
 

+ 5 - 1
src/DownloadCommand.cc

@@ -40,7 +40,9 @@
 #include "InitiateConnectionCommandFactory.h"
 #include "message.h"
 #include "prefs.h"
-#include "ChecksumCommand.h"
+#ifdef ENABLE_MESSAGE_DIGEST
+# include "ChecksumCommand.h"
+#endif // ENABLE_MESSAGE_DIGEST
 #include <sys/time.h>
 
 DownloadCommand::DownloadCommand(int cuid,
@@ -126,12 +128,14 @@ bool DownloadCommand::executeInternal() {
 
 bool DownloadCommand::prepareForNextSegment() {
   if(_requestGroup->getSegmentMan()->finished()) {
+#ifdef ENABLE_MESSAGE_DIGEST
     if(!_requestGroup->getChecksum().isNull() &&
        !_requestGroup->getChecksum()->isEmpty()) {
       ChecksumCommand* command = new ChecksumCommand(cuid, _requestGroup, e);
       command->initValidator();
       e->commands.push_back(command);
     }
+#endif // ENABLE_MESSAGE_DIGEST
     return true;
   } else {
     // Merge segment with next segment, if segment.index+1 == nextSegment.index

+ 6 - 2
src/DownloadEngine.cc

@@ -48,8 +48,12 @@ using namespace std;
 DownloadEngine::DownloadEngine():logger(LogFactory::getInstance()),
 				 noWait(false),
 				 _requestGroupMan(0),
-				 _fileAllocationMan(0),
-				 _checkIntegrityMan(0) {}
+				 _fileAllocationMan(0)
+#ifdef ENABLE_MESSAGE_DIGEST
+				,
+				 _checkIntegrityMan(0)
+#endif // ENABLE_MESSAGE_DIGEST
+{}
 
 DownloadEngine::~DownloadEngine() {
   cleanQueue();

+ 5 - 1
src/DownloadEngine.h

@@ -44,7 +44,9 @@
 #include "NameResolver.h"
 #include "RequestGroupMan.h"
 #include "FileAllocationMan.h"
-#include "CheckIntegrityMan.h"
+#ifdef ENABLE_MESSAGE_DIGEST
+# include "CheckIntegrityMan.h"
+#endif // ENABLE_MESSAGE_DIGEST
 
 typedef deque<SocketHandle> Sockets;
 
@@ -121,7 +123,9 @@ public:
   Commands commands;
   RequestGroupManHandle _requestGroupMan;
   FileAllocationManHandle _fileAllocationMan;
+#ifdef ENABLE_MESSAGE_DIGEST
   CheckIntegrityManHandle _checkIntegrityMan;
+#endif // ENABLE_MESSAGE_DIGEST
   const Option* option;
   
   DownloadEngine();

+ 5 - 2
src/DownloadEngineFactory.cc

@@ -43,7 +43,9 @@
 #include "CUIDCounter.h"
 #include "FileAllocationDispatcherCommand.h"
 #include "FileAllocationMan.h"
-#include "CheckIntegrityMan.h"
+#ifdef ENABLE_MESSAGE_DIGEST
+# include "CheckIntegrityMan.h"
+#endif // ENABLE_MESSAGE_DIGEST
 #ifdef ENABLE_BITTORRENT
 # include "PeerListenCommand.h"
 # include "TrackerWatcherCommand.h"
@@ -87,8 +89,9 @@ DownloadEngineFactory::newConsoleEngine(const Option* op,
   requestGroupMan->addReservedGroup(reservedSet);
   e->_requestGroupMan = requestGroupMan;
   e->_fileAllocationMan = new FileAllocationMan();
+#ifdef ENABLE_MESSAGE_DIGEST
   e->_checkIntegrityMan = new CheckIntegrityMan();
-
+#endif // ENABLE_MESSAGE_DIGEST
   e->commands.push_back(new FillRequestGroupCommand(CUIDCounterSingletonHolder::instance()->newID(), e, 1));
   e->commands.push_back(new FileAllocationDispatcherCommand(CUIDCounterSingletonHolder::instance()->newID(), e));
   return e;

+ 13 - 10
src/Makefile.am

@@ -63,7 +63,6 @@ SRCS =  Socket.h\
 	FileAllocator.h\
 	FileAllocationMonitor.cc FileAllocationMonitor.h\
 	ConsoleFileAllocationMonitor.cc ConsoleFileAllocationMonitor.h\
-	ChunkChecksumValidator.cc ChunkChecksumValidator.h\
 	HttpResponse.cc HttpResponse.h\
 	HttpRequest.cc HttpRequest.h\
 	Range.h\
@@ -87,18 +86,12 @@ SRCS =  Socket.h\
 	FillRequestGroupCommand.cc FillRequestGroupCommand.h\
 	FileAllocationDispatcherCommand.cc FileAllocationDispatcherCommand.h\
 	FileAllocationEntry.cc FileAllocationEntry.h\
-	IteratableChunkChecksumValidator.cc IteratableChunkChecksumValidator.h\
-	CheckIntegrityCommand.cc CheckIntegrityCommand.h\
 	MultiUrlRequestInfo.cc MultiUrlRequestInfo.h\
 	UriFileListParser.cc UriFileListParser.h\
 	SegmentManFactory.h\
 	AbstractSegmentManFactory.h\
 	DefaultSegmentManFactory.cc DefaultSegmentManFactory.h\
 	RealtimeCommand.cc RealtimeCommand.h\
-	IteratableChecksumValidator.cc IteratableChecksumValidator.h\
-	ChecksumCommand.cc ChecksumCommand.h\
-	CheckIntegrityEntry.cc CheckIntegrityEntry.h\
-	CheckIntegrityMan.h\
 	ProgressAwareEntry.h\
 	RequestGroupEntry.cc RequestGroupEntry.h\
 	Cookie.cc Cookie.h\
@@ -108,6 +101,16 @@ SRCS =  Socket.h\
 	FileEntry.cc FileEntry.h
 #	debug_new.cpp
 
+if ENABLE_MESSAGE_DIGEST
+SRCS += ChunkChecksumValidator.cc ChunkChecksumValidator.h\
+	IteratableChunkChecksumValidator.cc IteratableChunkChecksumValidator.h\
+	IteratableChecksumValidator.cc IteratableChecksumValidator.h\
+	ChecksumCommand.cc ChecksumCommand.h\
+	CheckIntegrityCommand.cc CheckIntegrityCommand.h\
+	CheckIntegrityEntry.cc CheckIntegrityEntry.h\
+	CheckIntegrityMan.h
+endif # ENABLE_MESSAGE_DIGEST
+
 if ENABLE_BITTORRENT
 SRCS += MetaEntry.h\
 	Data.cc Data.h\
@@ -220,15 +223,15 @@ SRCS += Metalinker.cc Metalinker.h\
 	MetalinkResource.cc MetalinkResource.h\
 	MetalinkProcessor.h\
 	Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h\
-	MetalinkRequestInfo.cc MetalinkRequestInfo.h\
-	MetalinkChunkChecksum.h
+	MetalinkRequestInfo.cc MetalinkRequestInfo.h
+#	MetalinkChunkChecksum.h
 endif # ENABLE_METALINK
 
 noinst_LIBRARIES = libaria2c.a
 libaria2c_a_SOURCES = $(SRCS)
 aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\
 	@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
-	@LIBCARES_LIBS@ -lprofiler
+	@LIBCARES_LIBS@ # -lprofiler
 #aria2c_LDFLAGS =  #-pg
 AM_CPPFLAGS =  -Wall\
 	-I../lib -I../intl -I$(top_srcdir)/intl\

+ 50 - 44
src/Makefile.in

@@ -39,7 +39,15 @@ build_triplet = @build@
 host_triplet = @host@
 bin_PROGRAMS = aria2c$(EXEEXT)
 #	debug_new.cpp
-@ENABLE_BITTORRENT_TRUE@am__append_1 = MetaEntry.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@am__append_1 = ChunkChecksumValidator.cc ChunkChecksumValidator.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	IteratableChunkChecksumValidator.cc IteratableChunkChecksumValidator.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	IteratableChecksumValidator.cc IteratableChecksumValidator.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	ChecksumCommand.cc ChecksumCommand.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	CheckIntegrityCommand.cc CheckIntegrityCommand.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	CheckIntegrityEntry.cc CheckIntegrityEntry.h\
+@ENABLE_MESSAGE_DIGEST_TRUE@	CheckIntegrityMan.h
+
+@ENABLE_BITTORRENT_TRUE@am__append_2 = MetaEntry.h\
 @ENABLE_BITTORRENT_TRUE@	Data.cc Data.h\
 @ENABLE_BITTORRENT_TRUE@	Dictionary.cc Dictionary.h\
 @ENABLE_BITTORRENT_TRUE@	List.cc List.h\
@@ -143,13 +151,12 @@ bin_PROGRAMS = aria2c$(EXEEXT)
 @ENABLE_BITTORRENT_TRUE@	ActivePeerConnectionCommand.cc ActivePeerConnectionCommand.h\
 @ENABLE_BITTORRENT_TRUE@	TrackerSegmentManFactory.cc TrackerSegmentManFactory.h
 
-@ENABLE_METALINK_TRUE@am__append_2 = Metalinker.cc Metalinker.h\
+@ENABLE_METALINK_TRUE@am__append_3 = Metalinker.cc Metalinker.h\
 @ENABLE_METALINK_TRUE@	MetalinkEntry.cc MetalinkEntry.h\
 @ENABLE_METALINK_TRUE@	MetalinkResource.cc MetalinkResource.h\
 @ENABLE_METALINK_TRUE@	MetalinkProcessor.h\
 @ENABLE_METALINK_TRUE@	Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h\
-@ENABLE_METALINK_TRUE@	MetalinkRequestInfo.cc MetalinkRequestInfo.h\
-@ENABLE_METALINK_TRUE@	MetalinkChunkChecksum.h
+@ENABLE_METALINK_TRUE@	MetalinkRequestInfo.cc MetalinkRequestInfo.h
 
 subdir = src
 DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
@@ -212,8 +219,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 	Randomizer.h SimpleRandomizer.cc SimpleRandomizer.h \
 	FileAllocator.h FileAllocationMonitor.cc \
 	FileAllocationMonitor.h ConsoleFileAllocationMonitor.cc \
-	ConsoleFileAllocationMonitor.h ChunkChecksumValidator.cc \
-	ChunkChecksumValidator.h HttpResponse.cc HttpResponse.h \
+	ConsoleFileAllocationMonitor.h HttpResponse.cc HttpResponse.h \
 	HttpRequest.cc HttpRequest.h Range.h \
 	AbstractProxyRequestCommand.cc AbstractProxyRequestCommand.h \
 	AbstractProxyResponseCommand.cc AbstractProxyResponseCommand.h \
@@ -229,21 +235,23 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 	FileAllocationCommand.h FillRequestGroupCommand.cc \
 	FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
 	FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
-	FileAllocationEntry.h IteratableChunkChecksumValidator.cc \
-	IteratableChunkChecksumValidator.h CheckIntegrityCommand.cc \
-	CheckIntegrityCommand.h MultiUrlRequestInfo.cc \
+	FileAllocationEntry.h MultiUrlRequestInfo.cc \
 	MultiUrlRequestInfo.h UriFileListParser.cc UriFileListParser.h \
 	SegmentManFactory.h AbstractSegmentManFactory.h \
 	DefaultSegmentManFactory.cc DefaultSegmentManFactory.h \
-	RealtimeCommand.cc RealtimeCommand.h \
-	IteratableChecksumValidator.cc IteratableChecksumValidator.h \
-	ChecksumCommand.cc ChecksumCommand.h CheckIntegrityEntry.cc \
-	CheckIntegrityEntry.h CheckIntegrityMan.h ProgressAwareEntry.h \
+	RealtimeCommand.cc RealtimeCommand.h ProgressAwareEntry.h \
 	RequestGroupEntry.cc RequestGroupEntry.h Cookie.cc Cookie.h \
 	CookieParser.cc CookieParser.h CookieBoxFactory.cc \
 	CookieBoxFactory.h HttpHeaderProcessor.cc \
-	HttpHeaderProcessor.h FileEntry.cc FileEntry.h MetaEntry.h \
-	Data.cc Data.h Dictionary.cc Dictionary.h List.cc List.h \
+	HttpHeaderProcessor.h FileEntry.cc FileEntry.h \
+	ChunkChecksumValidator.cc ChunkChecksumValidator.h \
+	IteratableChunkChecksumValidator.cc \
+	IteratableChunkChecksumValidator.h \
+	IteratableChecksumValidator.cc IteratableChecksumValidator.h \
+	ChecksumCommand.cc ChecksumCommand.h CheckIntegrityCommand.cc \
+	CheckIntegrityCommand.h CheckIntegrityEntry.cc \
+	CheckIntegrityEntry.h CheckIntegrityMan.h MetaEntry.h Data.cc \
+	Data.h Dictionary.cc Dictionary.h List.cc List.h \
 	MetaFileUtil.cc MetaFileUtil.h MetaEntryVisitor.h \
 	ShaVisitor.cc ShaVisitor.h PeerConnection.cc PeerConnection.h \
 	PeerMessageUtil.cc PeerMessageUtil.h PeerAbstractCommand.cc \
@@ -311,9 +319,15 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 	Metalinker.cc Metalinker.h MetalinkEntry.cc MetalinkEntry.h \
 	MetalinkResource.cc MetalinkResource.h MetalinkProcessor.h \
 	Xml2MetalinkProcessor.cc Xml2MetalinkProcessor.h \
-	MetalinkRequestInfo.cc MetalinkRequestInfo.h \
-	MetalinkChunkChecksum.h
-@ENABLE_BITTORRENT_TRUE@am__objects_1 = Data.$(OBJEXT) \
+	MetalinkRequestInfo.cc MetalinkRequestInfo.h
+@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_1 =  \
+@ENABLE_MESSAGE_DIGEST_TRUE@	ChunkChecksumValidator.$(OBJEXT) \
+@ENABLE_MESSAGE_DIGEST_TRUE@	IteratableChunkChecksumValidator.$(OBJEXT) \
+@ENABLE_MESSAGE_DIGEST_TRUE@	IteratableChecksumValidator.$(OBJEXT) \
+@ENABLE_MESSAGE_DIGEST_TRUE@	ChecksumCommand.$(OBJEXT) \
+@ENABLE_MESSAGE_DIGEST_TRUE@	CheckIntegrityCommand.$(OBJEXT) \
+@ENABLE_MESSAGE_DIGEST_TRUE@	CheckIntegrityEntry.$(OBJEXT)
+@ENABLE_BITTORRENT_TRUE@am__objects_2 = Data.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	Dictionary.$(OBJEXT) List.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	MetaFileUtil.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	ShaVisitor.$(OBJEXT) \
@@ -377,12 +391,12 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
 @ENABLE_BITTORRENT_TRUE@	DefaultBtInteractive.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	ActivePeerConnectionCommand.$(OBJEXT) \
 @ENABLE_BITTORRENT_TRUE@	TrackerSegmentManFactory.$(OBJEXT)
-@ENABLE_METALINK_TRUE@am__objects_2 = Metalinker.$(OBJEXT) \
+@ENABLE_METALINK_TRUE@am__objects_3 = Metalinker.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	MetalinkEntry.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	MetalinkResource.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	Xml2MetalinkProcessor.$(OBJEXT) \
 @ENABLE_METALINK_TRUE@	MetalinkRequestInfo.$(OBJEXT)
-am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
+am__objects_4 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
 	AbstractCommand.$(OBJEXT) \
 	InitiateConnectionCommandFactory.$(OBJEXT) \
 	DownloadCommand.$(OBJEXT) \
@@ -406,8 +420,7 @@ am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
 	DownloadEngineFactory.$(OBJEXT) SpeedCalc.$(OBJEXT) \
 	BitfieldMan.$(OBJEXT) BitfieldManFactory.$(OBJEXT) \
 	SimpleRandomizer.$(OBJEXT) FileAllocationMonitor.$(OBJEXT) \
-	ConsoleFileAllocationMonitor.$(OBJEXT) \
-	ChunkChecksumValidator.$(OBJEXT) HttpResponse.$(OBJEXT) \
+	ConsoleFileAllocationMonitor.$(OBJEXT) HttpResponse.$(OBJEXT) \
 	HttpRequest.$(OBJEXT) AbstractProxyRequestCommand.$(OBJEXT) \
 	AbstractProxyResponseCommand.$(OBJEXT) Netrc.$(OBJEXT) \
 	AuthConfig.$(OBJEXT) DefaultAuthResolver.$(OBJEXT) \
@@ -418,18 +431,14 @@ am__objects_3 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
 	RequestGroupMan.$(OBJEXT) FileAllocationCommand.$(OBJEXT) \
 	FillRequestGroupCommand.$(OBJEXT) \
 	FileAllocationDispatcherCommand.$(OBJEXT) \
-	FileAllocationEntry.$(OBJEXT) \
-	IteratableChunkChecksumValidator.$(OBJEXT) \
-	CheckIntegrityCommand.$(OBJEXT) MultiUrlRequestInfo.$(OBJEXT) \
+	FileAllocationEntry.$(OBJEXT) MultiUrlRequestInfo.$(OBJEXT) \
 	UriFileListParser.$(OBJEXT) DefaultSegmentManFactory.$(OBJEXT) \
-	RealtimeCommand.$(OBJEXT) \
-	IteratableChecksumValidator.$(OBJEXT) \
-	ChecksumCommand.$(OBJEXT) CheckIntegrityEntry.$(OBJEXT) \
-	RequestGroupEntry.$(OBJEXT) Cookie.$(OBJEXT) \
-	CookieParser.$(OBJEXT) CookieBoxFactory.$(OBJEXT) \
-	HttpHeaderProcessor.$(OBJEXT) FileEntry.$(OBJEXT) \
-	$(am__objects_1) $(am__objects_2)
-am_libaria2c_a_OBJECTS = $(am__objects_3)
+	RealtimeCommand.$(OBJEXT) RequestGroupEntry.$(OBJEXT) \
+	Cookie.$(OBJEXT) CookieParser.$(OBJEXT) \
+	CookieBoxFactory.$(OBJEXT) HttpHeaderProcessor.$(OBJEXT) \
+	FileEntry.$(OBJEXT) $(am__objects_1) $(am__objects_2) \
+	$(am__objects_3)
+am_libaria2c_a_OBJECTS = $(am__objects_4)
 libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS)
 am__installdirs = "$(DESTDIR)$(bindir)"
 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
@@ -488,6 +497,8 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
 ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
 ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
 ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
+ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
+ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
 ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
 ENABLE_METALINK_TRUE = @ENABLE_METALINK_TRUE@
 EXEEXT = @EXEEXT@
@@ -633,8 +644,7 @@ SRCS = Socket.h SocketCore.cc SocketCore.h Command.cc Command.h \
 	Randomizer.h SimpleRandomizer.cc SimpleRandomizer.h \
 	FileAllocator.h FileAllocationMonitor.cc \
 	FileAllocationMonitor.h ConsoleFileAllocationMonitor.cc \
-	ConsoleFileAllocationMonitor.h ChunkChecksumValidator.cc \
-	ChunkChecksumValidator.h HttpResponse.cc HttpResponse.h \
+	ConsoleFileAllocationMonitor.h HttpResponse.cc HttpResponse.h \
 	HttpRequest.cc HttpRequest.h Range.h \
 	AbstractProxyRequestCommand.cc AbstractProxyRequestCommand.h \
 	AbstractProxyResponseCommand.cc AbstractProxyResponseCommand.h \
@@ -650,26 +660,22 @@ SRCS = Socket.h SocketCore.cc SocketCore.h Command.cc Command.h \
 	FileAllocationCommand.h FillRequestGroupCommand.cc \
 	FillRequestGroupCommand.h FileAllocationDispatcherCommand.cc \
 	FileAllocationDispatcherCommand.h FileAllocationEntry.cc \
-	FileAllocationEntry.h IteratableChunkChecksumValidator.cc \
-	IteratableChunkChecksumValidator.h CheckIntegrityCommand.cc \
-	CheckIntegrityCommand.h MultiUrlRequestInfo.cc \
+	FileAllocationEntry.h MultiUrlRequestInfo.cc \
 	MultiUrlRequestInfo.h UriFileListParser.cc UriFileListParser.h \
 	SegmentManFactory.h AbstractSegmentManFactory.h \
 	DefaultSegmentManFactory.cc DefaultSegmentManFactory.h \
-	RealtimeCommand.cc RealtimeCommand.h \
-	IteratableChecksumValidator.cc IteratableChecksumValidator.h \
-	ChecksumCommand.cc ChecksumCommand.h CheckIntegrityEntry.cc \
-	CheckIntegrityEntry.h CheckIntegrityMan.h ProgressAwareEntry.h \
+	RealtimeCommand.cc RealtimeCommand.h ProgressAwareEntry.h \
 	RequestGroupEntry.cc RequestGroupEntry.h Cookie.cc Cookie.h \
 	CookieParser.cc CookieParser.h CookieBoxFactory.cc \
 	CookieBoxFactory.h HttpHeaderProcessor.cc \
 	HttpHeaderProcessor.h FileEntry.cc FileEntry.h $(am__append_1) \
-	$(am__append_2)
+	$(am__append_2) $(am__append_3)
+#	MetalinkChunkChecksum.h
 noinst_LIBRARIES = libaria2c.a
 libaria2c_a_SOURCES = $(SRCS)
 aria2c_LDADD = libaria2c.a @LIBINTL@ @ALLOCA@ @LIBGNUTLS_LIBS@\
 	@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
-	@LIBCARES_LIBS@ -lprofiler
+	@LIBCARES_LIBS@ # -lprofiler
 
 #aria2c_LDFLAGS =  #-pg
 AM_CPPFLAGS = -Wall\

+ 23 - 14
src/RequestGroup.cc

@@ -44,10 +44,12 @@
 #include "message.h"
 #include "DlAbortEx.h"
 #include "Util.h"
-#include "CheckIntegrityCommand.h"
 #include "FatalException.h"
-#include "CheckIntegrityEntry.h"
 #include "DownloadCommand.h"
+#ifdef ENABLE_MESSAGE_DIGEST
+#include "CheckIntegrityCommand.h"
+#include "CheckIntegrityEntry.h"
+#endif // ENABLE_MESSAGE_DIGEST
 #include <cerrno>
 
 SegmentManHandle RequestGroup::initSegmentMan()
@@ -188,11 +190,15 @@ void RequestGroup::loadAndOpenFile()
   } else {
     shouldCancelDownloadForSafety();
     initBitfield();
+#ifdef ENABLE_MESSAGE_DIGEST
     if(fileExists() && _option->get(PREF_CHECK_INTEGRITY) == V_TRUE) {
       openExistingFile();
     } else {
       initAndOpenFile();
     }
+#else // ENABLE_MESSAGE_DIGEST
+    initAndOpenFile();
+#endif // ENABLE_MESSAGE_DIGEST
   }
 }
 
@@ -216,6 +222,7 @@ bool RequestGroup::downloadFinishedByFileLength()
 void RequestGroup::prepareForNextAction(int cuid, const RequestHandle& req, DownloadEngine* e, DownloadCommand* downloadCommand)
 {
   File existingFile(getFilePath());
+#ifdef ENABLE_MESSAGE_DIGEST
   if(existingFile.size() > 0 && _option->get(PREF_CHECK_INTEGRITY) == V_TRUE) {
     // purge SegmentEntries
     _segmentMan->purgeSegmentEntry();
@@ -225,20 +232,22 @@ void RequestGroup::prepareForNextAction(int cuid, const RequestHandle& req, Down
     entry->initValidator();
     CheckIntegrityCommand* command = new CheckIntegrityCommand(cuid, this, e, entry);
     e->commands.push_back(command);
-  } else if(needsFileAllocation()) {
-    FileAllocationEntryHandle entry = new FileAllocationEntry(cuid, req, this, existingFile.size());
-    entry->setNextDownloadCommand(downloadCommand);
-    e->_fileAllocationMan->pushFileAllocationEntry(entry);
-  } else {
-    if(downloadCommand) {
-      e->commands.push_back(downloadCommand);
+  } else
+#endif // ENABLE_MESSAGE_DIGEST
+    if(needsFileAllocation()) {
+      FileAllocationEntryHandle entry = new FileAllocationEntry(cuid, req, this, existingFile.size());
+      entry->setNextDownloadCommand(downloadCommand);
+      e->_fileAllocationMan->pushFileAllocationEntry(entry);
     } else {
-      Commands commands = createNextCommandWithAdj(e, -1);
-      Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, this, e);
-      commands.push_front(command);
-      e->addCommand(commands);
+      if(downloadCommand) {
+	e->commands.push_back(downloadCommand);
+      } else {
+	Commands commands = createNextCommandWithAdj(e, -1);
+	Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(cuid, req, this, e);
+	commands.push_front(command);
+	e->addCommand(commands);
+      }
     }
-  }
 }
 
 void RequestGroup::validateFilename(const string& expectedFilename,

+ 23 - 12
src/RequestGroup.h

@@ -39,10 +39,12 @@
 #include "SegmentMan.h"
 #include "LogFactory.h"
 #include "Command.h"
-#include "ChunkChecksum.h"
-#include "Checksum.h"
 #include "SegmentManFactory.h"
 #include "DefaultSegmentManFactory.h"
+#ifdef ENABLE_MESSAGE_DIGEST
+# include "ChunkChecksum.h"
+# include "Checksum.h"
+#endif // ENABLE_MESSAGE_DIGEST
 
 class DownloadCommand;
 
@@ -61,8 +63,10 @@ private:
   SegmentManFactoryHandle _segmentManFactory;
   const Option* _option;
   const Logger* logger;
+#ifdef ENABLE_MESSAGE_DIGEST
   ChunkChecksumHandle _chunkChecksum;
   ChecksumHandle _checksum;
+#endif // ENABLE_MESSAGE_DIGEST
   int32_t _numConcurrentCommand;
 
   void validateFilename(const string& expectedFilename,
@@ -85,8 +89,10 @@ public:
     _segmentManFactory(new DefaultSegmentManFactory(option)),
     _option(option),
     logger(LogFactory::getInstance()),
+#ifdef ENABLE_MESSAGE_DIGEST
     _chunkChecksum(0),
     _checksum(0),
+#endif // ENABLE_MESSAGE_DIGEST
     _numConcurrentCommand(0),
     numConnection(0),
     isTorrent(false) {}
@@ -98,7 +104,10 @@ public:
     _segmentManFactory(new DefaultSegmentManFactory(option)),
     _option(option),
     logger(LogFactory::getInstance()),
+#ifdef ENABLE_MESSAGE_DIGEST
     _chunkChecksum(0),
+    _checksum(0),
+#endif // ENABLE_MESSAGE_DIGEST
     _numConcurrentCommand(0),
     numConnection(0),
     isTorrent(false)
@@ -126,6 +135,7 @@ public:
     _uris.push_back(uri);
   }
 
+#ifdef ENABLE_MESSAGE_DIGEST
   void setChunkChecksum(const ChunkChecksumHandle& chunkChecksum)
   {
     _chunkChecksum = chunkChecksum;
@@ -136,6 +146,17 @@ public:
     return _chunkChecksum;
   }
 
+  void setChecksum(const ChecksumHandle& checksum)
+  {
+    _checksum = checksum;
+  }
+
+  ChecksumHandle getChecksum() const
+  {
+    return _checksum;
+  }
+#endif // ENABLE_MESSAGE_DIGEST
+
   void initBitfield();
 
   void openExistingFile();
@@ -207,16 +228,6 @@ public:
 
   bool downloadFinishedByFileLength();
 
-  void setChecksum(const ChecksumHandle& checksum)
-  {
-    _checksum = checksum;
-  }
-
-  ChecksumHandle getChecksum() const
-  {
-    return _checksum;
-  }
-
   const string& getHintFilename() const
   {
     return _hintFilename;

+ 11 - 1
src/main.cc

@@ -187,6 +187,7 @@ void showUsage() {
 	    "                              system but its corresponding .aria2 file doesn't\n"
 	    "                              exist.\n"
             "                              Default: false") << endl;
+#ifdef ENABLE_MESSAGE_DIGEST
   cout << _(" --check-integrity=true|false  Check file integrity by validating piece hash.\n"
 	    "                              This option makes effect in BitTorrent download\n"
 	    "                              and Metalink with chunk checksums.\n"
@@ -199,6 +200,7 @@ void showUsage() {
 	    "                              a file in Metalink mode. This option makes effect\n"
 	    "                              in Metalink with chunk checksums.\n"
 	    "                              Default: true") << endl;
+#endif // ENABLE_MESSAGE_DIGEST
   cout << _(" -c, --continue               Continue downloading a partially downloaded\n"
 	    "                              file. Use this option to resume a download started\n"
 	    "                              by web browsers or another programs\n"
@@ -403,8 +405,10 @@ int main(int argc, char* argv[]) {
       { "max-download-limit", required_argument, &lopt, 201 },
       { "file-allocation", required_argument, 0, 'a' },
       { "allow-overwrite", required_argument, &lopt, 202 },
+#ifdef ENABLE_MESSAGE_DIGEST
       { "check-integrity", required_argument, &lopt, 203 },
       { "realtime-chunk-checksum", required_argument, &lopt, 204 },
+#endif // ENABLE_MESSAGE_DIGEST
       { "continue", no_argument, 0, 'c' },
       { "user-agent", required_argument, 0, 'U' },
       { "no-netrc", no_argument, 0, 'n' },
@@ -641,7 +645,13 @@ int main(int argc, char* argv[]) {
   if(op->defined(PREF_HTTP_PROXY_USER)) {
     op->put(PREF_HTTP_PROXY_AUTH_ENABLED, V_TRUE);
   }
-  if(!op->defined(PREF_TORRENT_FILE) && !op->defined(PREF_METALINK_FILE) &&
+  if(
+#ifdef ENABLE_BITTORRENT
+     !op->defined(PREF_TORRENT_FILE) &&
+#endif // ENABLE_BITTORRENT
+#ifdef ENABLE_METALINK
+     !op->defined(PREF_METALINK_FILE) &&
+#endif // ENABLE_METALINK
      !op->defined(PREF_INPUT_FILE)) {
     if(optind == argc) {
       cerr << _("specify at least one URL") << endl;

+ 2 - 0
test/Makefile.in

@@ -159,6 +159,8 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
 ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
 ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
 ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
+ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
+ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
 ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
 ENABLE_METALINK_TRUE = @ENABLE_METALINK_TRUE@
 EXEEXT = @EXEEXT@