summaryrefslogtreecommitdiff
path: root/src/Platform.cc
Commit message (Collapse)AuthorAgeFilesLines
* mingw: Defer the falloc warning until falloc is specified by optionTatsuhiro Tsujikawa2016-04-181-82/+0
|
* mingw: Use SetFileValidData to make --file-allocation=falloc workTatsuhiro Tsujikawa2016-01-281-0/+83
|
* make clang-format using clang-format-3.6Tatsuhiro Tsujikawa2015-12-271-37/+28
|
* Cleanup for definesTatsuhiro Tsujikawa2015-06-211-7/+4
|
* Add basic ssh/sftp code to SocketCore and introduce SSHSessionTatsuhiro Tsujikawa2015-05-101-0/+17
| | | | | | | | | | We use libssh2 to implement sftp feature. SSHSession is closely designed to TLSSession, but it differs in several aspects. In this code, we only implements read part of sftp, since aria2 won't offer uploading feature. Adding SSH/sftp to SocketCore is a bit bloat. But by doing this we can reuse DownloadCommand, without mostly no modification. We can just create SSHDownloadCommand by inheriting it, just like existing ftp.
* Fixed some typos in code commentsDan Fandrich2015-01-161-1/+1
|
* Use _setmode to set binary mode in mingwNils Maier2014-05-291-1/+3
| | | | | The _CRT_fmode stuff was never working correctly anyway, and is entirely unsupported in mingw-w64 these days, it seems.
* Fix some warningsNils Maier2014-04-131-0/+2
|
* GnuTLS: Refine debug loggingNils Maier2014-01-061-1/+4
|
* Make GnuTLS log level dependent on the aria2 onesNils Maier2014-01-061-1/+1
| | | | Closes GH-180
* GnuTLS: Setup loggingNils Maier2014-01-061-0/+13
|
* Move OpenSSL_add_all_algorithms() to Platform::setUp()Tatsuhiro Tsujikawa2013-09-261-0/+2
|
* Include winsock2.h before windows.hTatsuhiro Tsujikawa2013-05-251-13/+1
|
* Release statically allocated resources for prefs and optionsTatsuhiro Tsujikawa2012-12-081-1/+7
| | | | | | | Not realeasing these resources does not hurt the correctness of the program, but memory leak detection tool, such as valgrind, reports it as potential memory leak. It is better to distinguish it from the real ones.
* Removed trailing spacesTatsuhiro Tsujikawa2012-10-011-2/+2
|
* Check libgcrypt version is greater or equal to required version.Tatsuhiro Tsujikawa2011-09-281-1/+3
| | | | This will fixes Debian bug#642989.
* Added libnettle and libgmp support.Tatsuhiro Tsujikawa2011-08-111-1/+6
| | | | | | | | | | libnettle and libgmp is used by default. Old implementation uses libgcrypt as default. If more and more Linux distributions offer libnettle linked GnuTLS, then this change decrease library dependency against libgcrypt and libgpg-error. The current library detection for libnettle and libgmp is very simple, just use AC_SEARCH_LIBS. util::generateRandomData() was written using SimpleRandomizer, thus no external library dependency from this function.
* global cout and cerr is now retrieved using global::cout() and global::cerr()Tatsuhiro Tsujikawa2011-08-101-4/+2
| | | | | This is necessary to avoid global variable initialization order problem.
* Added global::cerr. windows.h now included from common.hTatsuhiro Tsujikawa2011-08-101-3/+2
| | | | | | | We replaced most of std::cerr with global::cerr. windows.h is now included from common.h. Before including it, we define WINVER. We renamed some variable name because some macros in windows.h collide with them.
* Use global::cout to output string to stdout.Tatsuhiro Tsujikawa2011-08-091-0/+3
| | | | | | | In MinGW32 build, global::cout is WinConsoleFile. When outputing to console, it uses WriteConsoleW, so Unicode characters are written. Fixed memory leak in WChar<->MultiByte conversion functions. The portion of code which uses std::cout is rewritten to use global::cout.
* Initialize libgcrypt.Tatsuhiro Tsujikawa2011-07-301-0/+10
| | | | | | | | | We relied initialization of libgcrypt on gnutls_global_init(), but recent change in gnutls, which changes default crypto backend from libgcrypt to libnettle, leaves libgcrypt uninitialized if it uses libnettle as backend(and this is likely because libnettle is chosen by default). To fix this issue, we simply initialize libgcrypt on our own.
* Throw exception with error message if gnutls_global_init() failed.Tatsuhiro Tsujikawa2011-07-291-1/+8
|
* Replaced HAVE_LIBSSL with HAVE_OPENSSLTatsuhiro Tsujikawa2011-02-181-4/+4
|
* 2010-10-10 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-10-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Append 'u' to hex mask. * src/Base64.cc * src/BitfieldMan.cc * src/BtHandshakeMessage.cc * src/BtHandshakeMessage.h * src/DHTBucket.cc * src/DHTRoutingTableDeserializer.cc * src/DHTRoutingTableSerializer.cc * src/DefaultBtProgressInfoFile.cc * src/MSEHandshake.h * src/MultiUrlRequestInfo.cc * src/Platform.cc * src/SpeedCalc.cc * src/UTPexExtensionMessage.cc * src/a2netcompat.h * src/base32.cc * src/bitfield.h * src/bittorrent_helper.cc * src/cookie_helper.cc * src/util.h
* 2010-06-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-06-211-6/+6
| | | | | | | Changed naming standards for class member variable: now it looks like var_ instead of _var.
* 2010-02-19 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-02-191-0/+1
| | | | | | | | | Reverted changes in r1893. setlocale(LC_CTYPE, "") is needed because without it localized error messages are not printed correctly. * src/Platform.cc
* 2010-02-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-02-181-1/+0
| | | | | | | | Removed setlocale() for LC_CTYPE. It may affect isxdigit in util.cc * src/Platform.cc
* 2010-02-02 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-02-021-11/+32
| | | | | | | | Call ares_library_init and ares_library_cleanup if they are available. Some code cleanups. * src/Platform.cc
* 2010-01-06 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-01-051-1/+1
| | | | | | | | | Untabify. Fixed one line in copyright which is longer than 80 columns. * src * test
* 2009-11-15 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2009-11-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Use C++ style cast * src/AsyncNameResolver.cc * src/Base64.h * src/BtBitfieldMessage.cc * src/BtHandshakeMessage.cc * src/DefaultBtMessageFactory.cc * src/DefaultBtProgressInfoFile.cc * src/EpollEventPoll.cc * src/ExpatMetalinkProcessor.cc * src/IteratableChecksumValidator.cc * src/IteratableChunkChecksumValidator.cc * src/MessageDigestHelper.cc * src/Platform.cc * src/RequestGroupMan.cc * src/SingleFileAllocationIterator.cc * src/Sqlite3MozCookieParser.cc * src/XML2SAXMetalinkProcessor.cc * src/Xml2XmlRpcRequestProcessor.cc * src/util.cc * src/util.h
* 2009-05-18 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2009-05-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added source filename(__FILE__) and line number(__LINE__) to exception message. * src/AbstractCommand.cc * src/AbstractDiskWriter.cc * src/AbstractProxyResponseCommand.cc * src/BDE.h * src/BtAllowedFastMessage.cc * src/BtHandshakeMessageValidator.h * src/BtHaveAllMessage.cc * src/BtHaveNoneMessage.cc * src/BtPieceMessage.cc * src/BtRejectMessage.cc * src/ChunkedDecoder.cc * src/CookieStorage.cc * src/DHTAnnouncePeerMessage.cc * src/DHTEntryPointNameResolveCommand.cc * src/DHTMessageFactoryImpl.cc * src/DHTMessageTracker.cc * src/DHTRoutingTableDeserializer.cc * src/DHTRoutingTableSerializer.cc * src/DHTSetup.cc * src/DHTTokenTracker.cc * src/DefaultBtAnnounce.cc * src/DefaultBtContext.cc * src/DefaultBtInteractive.cc * src/DefaultBtMessageFactory.cc * src/DefaultBtProgressInfoFile.cc * src/DefaultExtensionMessageFactory.cc * src/DlAbortEx.h * src/DlRetryEx.h * src/DownloadCommand.cc * src/DownloadEngineFactory.cc * src/DownloadFailureException.h * src/Exception.cc * src/Exception.h * src/ExpatMetalinkProcessor.cc * src/ExpatXmlRpcRequestProcessor.cc * src/FallocFileAllocationIterator.cc * src/FatalException.h * src/FtpConnection.cc * src/FtpFinishDownloadCommand.cc * src/FtpInitiateConnectionCommand.cc * src/FtpNegotiationCommand.cc * src/GZipDecoder.cc * src/HandshakeExtensionMessage.cc * src/HttpConnection.cc * src/HttpHeaderProcessor.cc * src/HttpInitiateConnectionCommand.cc * src/HttpResponse.cc * src/HttpResponseCommand.cc * src/HttpServer.cc * src/HttpSkipResponseCommand.cc * src/InitiateConnectionCommandFactory.cc * src/IteratableChunkChecksumValidator.cc * src/LibgcryptARC4Context.h * src/LibgcryptARC4Decryptor.h * src/LibgcryptARC4Encryptor.h * src/LibgcryptDHKeyExchange.h * src/LibgnutlsTLSContext.cc * src/LibsslARC4Context.h * src/LibsslARC4Decryptor.h * src/LibsslARC4Encryptor.h * src/LibsslDHKeyExchange.h * src/LibsslTLSContext.cc * src/MSEHandshake.cc * src/MessageDigestHelper.cc * src/MetalinkHelper.cc * src/MultiDiskAdaptor.cc * src/NameMatchOptionHandler.h * src/NameResolver.cc * src/Netrc.cc * src/NsCookieParser.cc * src/OptionHandlerException.cc * src/OptionHandlerException.h * src/OptionHandlerImpl.h * src/OptionParser.cc * src/ParameterizedStringParser.cc * src/PeerAbstractCommand.cc * src/PeerConnection.cc * src/PeerMessageUtil.cc * src/PeerReceiveHandshakeCommand.cc * src/Platform.cc * src/ReceiverMSEHandshakeCommand.cc * src/RecoverableException.h * src/RequestGroup.cc * src/SimpleLogger.cc * src/SocketCore.cc * src/Sqlite3MozCookieParser.cc * src/UTPexExtensionMessage.cc * src/Util.cc * src/XML2SAXMetalinkProcessor.cc * src/Xml2XmlRpcRequestProcessor.cc * src/XmlRpcMethodImpl.cc * src/bencode.cc * src/download_helper.cc * src/messageDigest.h * test/ExceptionTest.cc * test/TestUtil.cc
* 2008-06-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2008-06-161-5/+75
| | | | | | | | | | | | | | | | | | | | Applied Ross's aria2-0.13.2+1-mingw-4.patch. In this commit, only the follow sources are applied. * src/Platform.h: I removed HAVE_WINSOCK2_H directive from Platform.h. * src/Platform.cc: Moved common setup/teardown code to Platform class. I moved #endif // HAVE_WINSOCK2_H to the front of #include "DlAbortEx.h" I included locale.h from Platform.cc. * src/main.cc: Moved common setup/teardown code to Platform class. * test/AllTest.cc: Use Platform class. Set locale to C in AllTest.cc to prevent the messages to be localized.
* 2008-04-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2008-04-271-1/+1
| | | | | | | | | | | | | Rewritten Exception class. Throw exception object, not its pointer and catch by reference, so that remove problematic delete operator for catched exception. * src/Exception.cc * src/Exception.h * test/ExceptionTest.cc * src/*: All files throwing/catching exception. * test/*: All files throwing/catching exception.
* 2008-03-04 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2008-03-031-0/+4
| | | | | | | | | | | | | | | | | | | | | Merged Ross's mingw patch. * src/DHTRoutingTableDeserializer.cc * src/DHTRoutingTableSerializer.cc * src/Platform.{h, cc} * src/timegm.h * src/gettimeofday.h * src/getaddrinfo.h * src/SocketCore.h * src/common.h * src/inet_aton.h * src/DownloadEngine.h * src/gai_strerror.h * src/a2netcompat.h * configure.ac * configure * aclocal.m4
* 2008-02-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2008-02-021-6/+1
| | | | | | | | | | | | | | | | | | | | Fixed compiler warning about redefinition of SIZE_MAX. Use common.h instead of config.h directly here. * src/Platform.{h, cc} The check of ENABLE_NLS is made in gettext.h, so it is not required here. * common.h 2008-02-02 gettextize <bug-gnu-gettext@gnu.org> Updated gettext related files. * configure.ac (AC_CONFIG_FILES): Add intl/Makefile. * configure.ac (AM_GNU_GETTEXT_VERSION): Bump to 0.17.
* 2008-01-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2008-01-111-1/+2
| | | | | | | | Externalize message to message.h * src/Platform.cc * src/message.h
* 2007-08-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2007-08-261-0/+3
| | | | | | | | | | | | | | Merged Ross's patch: Removed setmode(). Use _CRT_fmode to enable binary IO. * src/DefaultBtProgressInfoFile.cc * src/MetaFileUtil.cc * src/SimpleLogger.cc * src/SegmentMan.cc * src/Util.cc * src/Platform.cc
* 2007-08-10 Ross Smith II <aria2spam at smithii dot com>Tatsuhiro Tsujikawa2007-08-141-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move sleep functions to Util class: * src/Util.cc (sleep): New function. (usleep): New function. * src/DownloadCommand.cc: sleep -> Util::sleep * test/TimeSeedCriteriaTest.cc: sleep -> Util::sleep MinGW build enhancements. The following files are added: * src/timegm.{c,h} Changes to support the above new files: * configure.ac * src/Makefile.am * src/a2time.h * src/Util.cc: * src/strptime.c: Added support for %Z option. Miscellenous build fixes/enhancements. * configure.ac: Added summary report. * src/Platform.h: Tweaked #include's. * src/a2netcompat.h: Tweaked #include's. * src/strptime.h: Tweaked #include's. * src/gai_strerror.c: Tweaked #include's. * src/gai_strerror.h: _D_GETADDRINFO_H -> _D_GAI_STRERROR_H * src/getaddrinfo.h: Moved #ifndef __MINGW32__ * src/gettimeofday.h: Added HAVE_CONFIG_H
* 2007-08-01 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2007-07-311-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make a2netcompat.h include a2io.h to fix compilation error: * src/a2netcompat.h * src/SocketCore.cc: Removed include of a2io.h * src/Util.cc: Removed include of a2io.h Gather time related functions to a2time.h: * src/a2time.h: New file. * src/DefaultPeerStorage.cc * src/SimpleLogger.cc * src/Util.{h, cc} * src/SimpleRandomizer.h * src/TimeA2.{h,cc} * src/DownloadCommand.cc * src/main.cc Removed #ifdef __MINGW32__ since gai_strerror is included in a2netcompat.h: * src/NameResolver.cc Fixed compilation error without openssl: * src/SocketCore.{h,cc}: Moved include of openssl/err.h to SocketCore.h Added default block to suppress compiler warnings: * src/MetalinkRequestInfo.cc (AccumulateNonP2PUrl::operator()) 2007-07-26 Ross Smith II <aria2spam at smithii dot com> MinGW build enhancements. The following files are added: * src/gai_strerror.{c,h} * src/gettimeofday.{c,h} Changes to support the above new files: * configure.ac * src/Makefile.am * src/a2netcompat.h * src/TimeA2.cc * src/DefaultPeerStorage.cc * src/NameResolver.cc: removed mingw_strerror() function. * src/SocketCore.cc: removed mingw_strerror() function. Miscellaneous MinGW build fixes. * src/a2io.h: Use _lseeki64() instead of lseek() * src/common.h * src/DefaultFileAllocator.cc * src/GlowFileAllocator.cc * src/main.cc: Moved #include "prefs.h" to quiet compile error. * src/NameResolver.cc (callback): Changed int32_t to int. (resolve): Changed int32_t to int. * src/Platform.cc * src/Platform.h * test/MultiDiskWriterTest.cc * test/PeerMessageUtilTest.cc * src/localtime_r.c: Add DeleteCriticalSection() and at exit(). Other enhancements and fixes. * src/HttpRequestCommand.cc (executeInternal) Use non-blocking socket for HTTPS (MinGW only). * src/SocketCore.cc: (error): New function to abstract errno/WSAGetLastError(). (errorMsg): New function to abstract errno/WSAGetLastError(). (initiateSecureConnection): Added more detailed error reporting. * src/SocketCore.h: Added private variable blocking, to allow proper handling of OpenSSL psuedo-errors. * src/message.h (EX_SSL_INIT_FAILURE) (EX_SSL_IO_ERROR) (EX_SSL_PROTOCOL_ERROR) (EX_SSL_UNKNOWN_ERROR) (EX_SSL_CONNECT_ERROR) (EX_SOCKET_BLOCKING) (EX_SOCKET_NONBLOCKING) (EX_SOCKET_UNKNOWN_ERROR) * src/Util.cc (setGlobalSignalHandler): Renamed signal to sig as signal is a reserved name. (httpGMT): Fixed typo.
* 2007-07-23 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>Tatsuhiro Tsujikawa2007-07-231-0/+63
Merged Ross's win32 patch(manually) In the course of merging, following files are added. * src/strptime.{h,c} * src/libgen.{h,c} * src/inet_aton.{h,c} * src/Platform.{h,cc} * src/localtime_r.{h,c} * src/getaddrinfo.{h,c} I've gethered network related things, and put them to following file: * src/a2netcompat.h Also io related things are put to following file: * src/a2io.h Changed %lld to %s because mingw32 doesn't recognize %lld. * src/message.h (MSG_ALLOCATION_COMPLETED) (EX_TOO_LARGE_FILE) (EX_SIZE_MISMATCH) (EX_FILE_OFFSET_OUT_OF_RANGE) (EX_INVALID_CHUNK_CHECKSUM) (EX_INVALID_RANGE_HEADER) * src/FileAllocationCommand.cc * src/HttpResponse.cc * src/RequestGroup.cc * src/MultiDiskAdaptor.cc * src/OptionHandlerImpl.h * src/HttpResponseCommand.cc * src/FtpNegotiateCommand.cc * src/IteratableChecksumValidator.cc * src/SegmentMan.cc * src/ChunkChecksumValidator.cc Added Randomizer::getRandomNumber(long int) * src/Randomizer.h (getRandomNumber) * src/SimpleRandomizer.h (getRandomNumber) * src/BitfieldMan.cc (getMissingIndexRandomly): Use this new function. * src/Util.cc (randomAlpha): Use this new function.