Commit Graph

2118 Commits (5d05ef0e756a7c52673fcf78b4ab8c9ccee2154d)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 5d05ef0e75 2010-03-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten SocketBuffer. Old implementation uses single std::string
	to store data and erase sent data, which is costly. New
	implementation uses deque to hold each data to avoid to mutate
	string.
	* src/SocketBuffer.cc
	* src/SocketBuffer.h
2010-03-03 14:29:40 +00:00
Tatsuhiro Tsujikawa 48c809d441 2010-03-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed unused FileEntry::extracted
	* src/FileEntry.cc
	* src/FileEntry.h
2010-03-02 16:09:03 +00:00
Tatsuhiro Tsujikawa c929e95ff0 2010-03-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Wait until data arrives.
	* test/LpdMessageReceiverTest.cc
2010-03-02 15:34:10 +00:00
Tatsuhiro Tsujikawa 3bb7855a56 2010-03-03 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
In Metalink4, if size element contains invalid size, discard whole
	document. Added strict hash value check for metalink3/4.
	* src/MetalinkParserController.cc
	* src/MetalinkParserStateMachine.cc
	* src/MetalinkParserStateMachine.h
	* src/MetalinkParserStateV3Impl.cc
	* src/MetalinkParserStateV4Impl.cc
	* src/util.cc
	* src/util.h
	* test/MetalinkParserControllerTest.cc
	* test/MetalinkProcessorTest.cc
	* test/metalink4.xml
2010-03-02 15:14:39 +00:00
Tatsuhiro Tsujikawa ba78b6f167 2010-03-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added strict attribute validation for metalink4. When
	specification violation is found, discard the whole document.
	* src/ExpatMetalinkProcessor.cc
	* src/MetalinkParserStateMachine.cc
	* src/MetalinkParserStateMachine.h
	* src/MetalinkParserStateV4Impl.cc
	* src/XML2SAXMetalinkProcessor.cc
	* test/Makefile.am
	* test/MetalinkProcessorTest.cc
	* test/metalink4-attrs.xml: Removed
	* test/metalink4-dirtraversal.xml: Removed
2010-03-02 14:07:30 +00:00
Tatsuhiro Tsujikawa eb32f56479 2010-03-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added test for Metaurl transaction.
	* src/MetalinkParserController.cc
	* test/MetalinkParserControllerTest.cc
2010-03-01 17:20:41 +00:00
Tatsuhiro Tsujikawa 94e306cec4 2010-03-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Avoid costly BtMessage::toString() if info level log is not
	required.
	* src/DefaultBtInteractive.cc
	* src/Logger.h
	* src/SimpleBtMessage.cc
2010-03-01 17:03:24 +00:00
Tatsuhiro Tsujikawa 18ea756a74 2010-03-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Reserved vector elements based on profiler results.
	* src/DefaultBtInteractive.cc
	* src/DefaultBtProgressInfoFile.cc
2010-03-01 16:13:42 +00:00
Tatsuhiro Tsujikawa 72e475dfde 2010-03-01 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Avoid to calculate end() iterator in each loop. std::deque is
	particularly slow. Make sure that recalculate end iterator if
	element is erased during loop.
2010-02-28 16:04:52 +00:00
Tatsuhiro Tsujikawa c342bde962 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use vector instead of deque for containers which is used for
	mostly read-only purpose.
2010-02-28 12:30:11 +00:00
Tatsuhiro Tsujikawa 135f0a2a8c 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed typo
	* test/Makefile.am
2010-02-27 15:30:48 +00:00
Tatsuhiro Tsujikawa 24158f5d25 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added metalink4-groupbymetaurl.xml to EXTRA_DIST
	* test/Makefile.am
2010-02-27 15:27:30 +00:00
Tatsuhiro Tsujikawa 96761a2572 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Small optimization: In updateTransferStatFor(), don't search peer
	ID twice.
	* src/DefaultPeerStorage.cc
2010-02-27 15:21:29 +00:00
Tatsuhiro Tsujikawa 88656eb14e 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use vector instead of deque for MetalinkEntry and MetalinkResource
	objects.
	* src/Metalink2RequestGroup.cc
	* src/Metalink2RequestGroup.h
	* src/MetalinkEntry.cc
	* src/MetalinkEntry.h
	* src/MetalinkHelper.cc
	* src/MetalinkHelper.h
	* src/Metalinker.cc
	* src/Metalinker.h
	* src/main.cc
	* test/MetalinkEntryTest.cc
	* test/MetalinkHelperTest.cc
	* test/MetalinkProcessorTest.cc
	* test/MetalinkerTest.cc
2010-02-27 15:14:40 +00:00
Tatsuhiro Tsujikawa 0c62e90730 2010-02-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that grouped FileEntry objects are not used but
	instead all FileEntry objects are used for each metaurl group.
	* src/Metalink2RequestGroup.cc
	* test/Metalink2RequestGroupTest.cc
	* test/metalink4-groupbymetaurl.xml
2010-02-27 15:04:48 +00:00
Tatsuhiro Tsujikawa 4bef54c8e9 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Use vector instead of deque for ChunkChecksum.
	* src/ChunkChecksum.h
	* src/MetalinkParserController.cc
	* src/MetalinkParserController.h
2010-02-27 14:32:02 +00:00
Tatsuhiro Tsujikawa 18d7eb5b77 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added MessageDigest::isStronger(). Now aria2 selects stronger hash
	algorithm in Metalink properly
	* src/MetalinkParserController.cc
	* src/MetalinkParserController.h
	* src/messageDigest.cc
	* src/messageDigest.h
	* test/MetalinkProcessorTest.cc
	* test/metalink4.xml
2010-02-27 14:24:15 +00:00
Tatsuhiro Tsujikawa e8d091af18 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Replaced null or control characters in file path with '_'.  For
	MinGW32 build, additional characters which is not allowed in
	Windows kernel are also replaced. util::detectDirTraversal() now
	returns true if given string contains null or control characters.
	* src/DownloadContext.cc
	* src/DownloadContext.h
	* src/Metalink2RequestGroup.cc
	* src/MetalinkParserController.cc
	* src/bittorrent_helper.cc
	* src/util.cc
	* src/util.h
	* test/UtilTest.cc
2010-02-27 10:06:40 +00:00
Tatsuhiro Tsujikawa 20d78285a8 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Discard metalink:file if its name attribute is empty string.
	Removed FileEntry instantiation in
	MetalinkParserController::setFileLengthOfEntry()
	* src/MetalinkParserController.cc
	* src/MetalinkParserStateV3Impl.cc
	* src/MetalinkParserStateV4Impl.cc
2010-02-27 08:42:13 +00:00
Tatsuhiro Tsujikawa dc2a51b54a 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Discard torrent file if path data in it contains directory
	traversal directives.  Discard metalink:file element in Metalink3
	format if its name attribute contains directory traversal
	directives.  Ignore name attribute of metalink:signature element
	in Metalink3 format if it contains directory traversal directives.
	* src/MetalinkParserStateV3Impl.cc
	* src/bittorrent_helper.cc
	* src/message.h
	* test/BittorrentHelperTest.cc
	* test/Makefile.am
	* test/MetalinkProcessorTest.cc
	* test/metalink3-dirtraversal.xml
	* test/test.xml
2010-02-27 08:22:58 +00:00
Tatsuhiro Tsujikawa 513a6bd12d 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed useless comment
	* src/MetalinkParserStateV4Impl.cc
2010-02-27 07:46:12 +00:00
Tatsuhiro Tsujikawa 2a6775e80b 2010-02-27 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Supported name attribute of metalink::metaurl element and
	multi-file torrent with Metalink4.  Files with same metaurl are
	grouped and downloaded in one RequestGroup.
	* src/BtDependency.cc
	* src/FileEntry.h
	* src/Metalink2RequestGroup.cc
	* src/Metalink2RequestGroup.h
	* src/MetalinkEntry.cc
	* src/MetalinkEntry.h
	* src/MetalinkHelper.cc
	* src/MetalinkHelper.h
	* src/MetalinkMetaurl.cc
	* src/MetalinkMetaurl.h
	* src/MetalinkParserController.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/bittorrent_helper.cc
	* test/BittorrentHelperTest.cc
	* test/BtDependencyTest.cc
	* test/MetalinkHelperTest.cc
2010-02-26 15:37:08 +00:00
Tatsuhiro Tsujikawa 5032394c6a 2010-02-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Store name attribute of metalink:metaurl element in MetalinkMetaurl.
	* src/MetalinkMetaurl.h
	* src/MetalinkParserController.cc
	* src/MetalinkParserController.h
	* src/MetalinkParserStateMachine.cc
	* src/MetalinkParserStateMachine.h
	* src/MetalinkParserStateV4Impl.cc
	* test/MetalinkProcessorTest.cc
	* test/metalink4-dirtraversal.xml
2010-02-26 08:55:10 +00:00
Tatsuhiro Tsujikawa 15c1f64023 2010-02-26 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added MetalinkMetaurl class. It corresponds to metalink:metaurl
	element.
	* src/Makefile.am
	* src/Metalink2RequestGroup.cc
	* src/MetalinkEntry.cc
	* src/MetalinkEntry.h
	* src/MetalinkMetaurl.cc
	* src/MetalinkMetaurl.h
	* src/MetalinkParserController.cc
	* src/MetalinkParserController.h
	* src/MetalinkParserStateMachine.cc
	* src/MetalinkParserStateMachine.h
	* src/MetalinkParserStateV4Impl.cc
	* src/MetalinkParserStateV4Impl.h
	* test/MetalinkProcessorTest.cc
2010-02-25 16:00:24 +00:00
Tatsuhiro Tsujikawa 3880a5f71b 2010-02-25 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added Metalink4 support. Currently, name attribute of
	metalink::metaurl is ignored and multi-file torrent cannot be used
	with Metalink4.
	* doc/aria2c.1.txt
	* src/DownloadHandlerConstants.cc
	* src/ExpatMetalinkProcessor.cc
	* src/Makefile.am
	* src/Metalink2RequestGroup.cc
	* src/MetalinkEntry.cc
	* src/MetalinkEntry.h
	* src/MetalinkParserController.cc
	* src/MetalinkParserController.h
	* src/MetalinkParserState.h
	* src/MetalinkParserStateImpl.cc
	* src/MetalinkParserStateImpl.h
	* src/MetalinkParserStateMachine.cc
	* src/MetalinkParserStateMachine.h
	* src/MetalinkParserStateV3Impl.cc
	* src/MetalinkParserStateV3Impl.h
	* src/MetalinkParserStateV4Impl.cc
	* src/MetalinkParserStateV4Impl.h
	* src/MetalinkResource.cc
	* src/MetalinkResource.h
	* src/Metalinker.cc
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/XML2SAXMetalinkProcessor.cc
	* src/messageDigest.cc
	* src/util.cc
	* src/util.h
	* test/Makefile.am
	* test/MetalinkEntryTest.cc
	* test/MetalinkParserControllerTest.cc
	* test/MetalinkProcessorTest.cc
	* test/MetalinkerTest.cc
	* test/UtilTest.cc
	* test/metalink4-attrs.xml
	* test/metalink4-dirtraversal.xml
	* test/metalink4.xml
2010-02-25 14:40:18 +00:00
Tatsuhiro Tsujikawa fa6fd758af 2010-02-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added aiFlags argument to getInterfaceAddress(). Use
	AI_NUMERICHOST to find interface specified using
	--bt-lpd-interface option to avoid time-consuming address lookup.
	* src/BtSetup.cc
	* src/SocketCore.cc
	* src/SocketCore.h
2010-02-23 13:50:35 +00:00
Tatsuhiro Tsujikawa 232deb47b5 2010-02-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Return SharedHandle<LpdMessage>(new LpdMessage()) if received data
	is bad in LpdMessageReceiver.
	* src/LpdMessage.h
	* src/LpdMessageReceiver.cc
	* src/LpdMessageReceiver.h
	* src/LpdReceiveMessageCommand.cc
	* test/LpdMessageReceiverTest.cc
2010-02-22 16:11:33 +00:00
Tatsuhiro Tsujikawa 6ae5882f3c 2010-02-23 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added --bt-lpd-interface option to specify the interface to use
	for Local Peer Discovery. LpdMessageDispatcher object now has its
	own socket. LpdMessageReceiver's socket is binded to multicast
	address to only receive multicast packets.
	* src/BtSetup.cc
	* src/LpdMessageDispatcher.cc
	* src/LpdMessageDispatcher.h
	* src/LpdMessageReceiver.cc
	* src/LpdMessageReceiver.h
	* src/LpdReceiveMessageCommand.cc
	* src/LpdReceiveMessageCommand.h
	* src/OptionHandlerFactory.cc
	* src/SocketCore.cc
	* src/SocketCore.h
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* test/LpdMessageDispatcherTest.cc
	* test/LpdMessageReceiverTest.cc
2010-02-22 15:58:05 +00:00
Tatsuhiro Tsujikawa 6f0fff2a5f 2010-02-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Put the portion of code to get interface addresses in
	SocketCore::bindAddress() into newly added getInterfaceAddress().
	* src/SocketCore.cc
	* src/SocketCore.h
2010-02-21 15:21:21 +00:00
Tatsuhiro Tsujikawa 8f9af67b99 2010-02-22 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewritten util::parseInt() and parseUInt()
	* src/util.cc
2010-02-21 15:04:14 +00:00
Tatsuhiro Tsujikawa aa2036a70d 2010-02-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed compile error with mingw32 cross compiler. Defined
	a2_sockopt_t as void* for the target systems other than mingw32.
	* src/SocketCore.cc
	* src/a2netcompat.h
2010-02-21 12:50:32 +00:00
Tatsuhiro Tsujikawa ab0662e580 2010-02-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed 'always true' condition
	* src/util.cc
2010-02-20 14:36:57 +00:00
Tatsuhiro Tsujikawa 8429dcf593 2010-02-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Documented --bt-enable-lpd option in man page.
	* doc/aria2c.1.txt
2010-02-20 14:26:23 +00:00
Tatsuhiro Tsujikawa 9281f11264 2010-02-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added Local Peer Discovery. It is disabled by default. Use
	--bt-enable-lpd to enable the function.
	* src/BtConstants.h
	* src/BtSetup.cc
	* src/LpdDispatchMessageCommand.cc
	* src/LpdDispatchMessageCommand.h
	* src/LpdMessage.h
	* src/LpdMessageDispatcher.cc
	* src/LpdMessageDispatcher.h
	* src/LpdMessageReceiver.cc
	* src/LpdMessageReceiver.h
	* src/LpdReceiveMessageCommand.cc
	* src/LpdReceiveMessageCommand.h
	* src/Makefile.am
	* src/OptionHandlerFactory.cc
	* src/Peer.cc
	* src/Peer.h
	* src/PeerInteractionCommand.cc
	* src/SocketCore.cc
	* src/SocketCore.h
	* src/prefs.cc
	* src/prefs.h
	* src/usage_text.h
	* src/util.cc
	* src/util.h
	* test/LpdMessageDispatcherTest.cc
	* test/LpdMessageReceiverTest.cc
	* test/Makefile.am
2010-02-20 14:23:25 +00:00
Tatsuhiro Tsujikawa aee471e52c 2010-02-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
User-defined custom request headers specified by --header option
	now override builtin headers if they have same name.
	* src/HttpRequest.cc
	* src/HttpRequest.h
	* test/HttpRequestTest.cc
2010-02-20 12:55:23 +00:00
Tatsuhiro Tsujikawa f1ee4045c2 2010-02-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Rewirtten util::isNumber()
	* src/util.cc
2010-02-19 14:33:39 +00:00
Tatsuhiro Tsujikawa f77ea4721c 2010-02-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Reverted changes in r1893. setlocale(LC_CTYPE, "") is needed
	because without it localized error messages are not printed
	correctly.
	* src/Platform.cc
2010-02-19 11:28:27 +00:00
Tatsuhiro Tsujikawa 780aaf9c80 2010-02-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added unit tests for util::getContentDispositionFilename() from
	http://greenbytes.de/tech/tc2231/ Fixed the function so that added
	tests are passed.
	* src/util.cc
	* test/UtilTest.cc
2010-02-19 10:54:40 +00:00
Tatsuhiro Tsujikawa cc056289e7 2010-02-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed setlocale() for LC_CTYPE. It may affect isxdigit in
	util.cc
	* src/Platform.cc
2010-02-18 13:55:08 +00:00
Tatsuhiro Tsujikawa 2da32876a2 2010-02-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Support RFC2231 "Parameter Value Character Set and Language
	Information" in Content-Disposition header.
	* src/HttpResponse.cc
	* src/util.cc
	* src/util.h
	* test/UtilTest.cc
2010-02-17 16:09:19 +00:00
Tatsuhiro Tsujikawa 674eff7da3 2010-02-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Print CXXFLAGS
	* configure.ac
2010-02-16 14:54:49 +00:00
Tatsuhiro Tsujikawa dfb40cb729 2010-02-16 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Small optimization for A2_WOULDBLOCK(e)
	* src/SocketCore.cc
2010-02-16 14:53:11 +00:00
Tatsuhiro Tsujikawa ca3c52a787 2010-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed test file
	* test/CookieStorageTest.cc
2010-02-15 14:01:11 +00:00
Tatsuhiro Tsujikawa 71d7a162d6 2010-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Check both EAGAIN and EWOULDBLOCK
	* src/SocketCore.cc
2010-02-15 13:57:51 +00:00
Tatsuhiro Tsujikawa 3842161f9b 2010-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed ret == 0 checking for SSL_read(), SSL_write() and
	SSL_peek() because the checks are done in the caller.  In
	SocketBuffer::send(), throw exception if nothing could be written
	and socket error was not EWOULDBLOCK
	* src/SocketBuffer.cc
	* src/SocketCore.cc
2010-02-15 13:02:14 +00:00
Tatsuhiro Tsujikawa a6a174a0b2 2010-02-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed error code handling so that it can handle Winsock2 error
	code.
	* src/SocketCore.cc
	* src/SocketCore.h
2010-02-15 12:47:10 +00:00
Tatsuhiro Tsujikawa 34916ad0ea 2010-02-14 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Bump up version number to 1.9.0a
	* configure.ac
	* doc/aria2c.1.txt
2010-02-14 08:40:02 +00:00
Tatsuhiro Tsujikawa 2097b5e29a 2010-02-12 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Fixed the bug that aria2 doesn't handle return value if error
	occurred before download begins.
	* src/MultiUrlRequestInfo.cc
	* src/main.cc
2010-02-12 13:53:52 +00:00
Tatsuhiro Tsujikawa 1a04d2913e 2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Removed SegmentManFactory class.
	* src/AbstractSegmentManFactory.h
	* src/DefaultSegmentManFactory.cc
	* src/DefaultSegmentManFactory.h
	* src/Makefile.am
	* src/RequestGroup.cc
	* src/RequestGroup.h
	* src/SegmentManFactory.h
2010-02-11 11:42:20 +00:00
Tatsuhiro Tsujikawa 4354c674ab 2010-02-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Destroyed digest context after getting calculated hash.
	* src/Piece.cc
	* src/Piece.h
2010-02-11 08:33:58 +00:00