mirror of https://github.com/aria2/aria2
2008-06-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added gzip, deflate decoding support in HTTP using libz. If compiled with this feature, aria2 sends "Accept-Encoding: deflate, gzip" header to a HTTP server. If a server returns "Content-Encoding: gzip" or "Content-Encoding: deflate" then, aria2 decodes the response body on the fly and writes decoded data to a local disk. * README * README.html * configure.ac * m4/aria2_arg.m4: Added ARIA2_ARG_WITH and ARIA2_ARG_ENABLE, they are wrapper function for AC_ARG_WITH and AC_ARG_ENABLE respectively. * m4/libz.m4 * src/Decoder.h * src/DownloadCommand.cc * src/DownloadCommand.h * src/Exception.h * src/GZipDecoder.cc * src/GZipDecoder.h * src/HttpHeader.cc * src/HttpHeader.h * src/HttpRequest.cc * src/HttpRequest.h * src/HttpResponse.cc * src/HttpResponse.h * src/HttpResponseCommand.cc * src/Makefile.am * test/GZipDecoderTest.cc * test/HttpRequestTest.cc * test/HttpResponseTest.cc * test/Makefile.am * test/Makefile.in * test/gzip_decode_test.gzpull/1/head
parent
6c4dd16c82
commit
d791807add
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2008-06-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Added gzip, deflate decoding support in HTTP using libz. If compiled
|
||||
with this feature, aria2 sends "Accept-Encoding: deflate, gzip" header
|
||||
to a HTTP server. If a server returns "Content-Encoding: gzip" or
|
||||
"Content-Encoding: deflate" then, aria2 decodes the response body on the
|
||||
fly and writes decoded data to a local disk.
|
||||
* README
|
||||
* README.html
|
||||
* configure.ac
|
||||
* m4/aria2_arg.m4: Added ARIA2_ARG_WITH and ARIA2_ARG_ENABLE, they are
|
||||
wrapper function for AC_ARG_WITH and AC_ARG_ENABLE respectively.
|
||||
* m4/libz.m4
|
||||
* src/Decoder.h
|
||||
* src/DownloadCommand.cc
|
||||
* src/DownloadCommand.h
|
||||
* src/Exception.h
|
||||
* src/GZipDecoder.cc
|
||||
* src/GZipDecoder.h
|
||||
* src/HttpHeader.cc
|
||||
* src/HttpHeader.h
|
||||
* src/HttpRequest.cc
|
||||
* src/HttpRequest.h
|
||||
* src/HttpResponse.cc
|
||||
* src/HttpResponse.h
|
||||
* src/HttpResponseCommand.cc
|
||||
* src/Makefile.am
|
||||
* test/GZipDecoderTest.cc
|
||||
* test/HttpRequestTest.cc
|
||||
* test/HttpResponseTest.cc
|
||||
* test/Makefile.am
|
||||
* test/Makefile.in
|
||||
* test/gzip_decode_test.gz
|
||||
|
||||
2008-06-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Clarified usage of -j option.
|
||||
|
|
30
Makefile.in
30
Makefile.in
|
@ -42,24 +42,24 @@ DIST_COMMON = README $(am__configure_deps) $(dist_doc_DATA) \
|
|||
config.guess config.rpath config.sub depcomp install-sh \
|
||||
missing mkinstalldirs
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
|
@ -175,6 +175,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
|
18
README
18
README
|
@ -39,14 +39,15 @@ Dependency
|
|||
|
||||
.External Library Dependency
|
||||
[frame="all", grid="all"]
|
||||
`---------`---------------------------
|
||||
features dependency
|
||||
--------------------------------------
|
||||
HTTPS GnuTLS or OpenSSL
|
||||
BitTorrent GnuTLS+Libgcrypt or OpenSSL
|
||||
Metalink libxml2 or Expat.
|
||||
Checksum GnuTLS+Libgcrypt or OpenSSL
|
||||
--------------------------------------
|
||||
`--------------------`---------------------------
|
||||
features dependency
|
||||
-------------------------------------------------
|
||||
HTTPS GnuTLS or OpenSSL
|
||||
BitTorrent GnuTLS+Libgcrypt or OpenSSL
|
||||
Metalink libxml2 or Expat.
|
||||
Checksum GnuTLS+Libgcrypt or OpenSSL
|
||||
gzip, deflate in HTTP zlib
|
||||
-------------------------------------------------
|
||||
|
||||
Note;;
|
||||
GNU TLS has precedence over OpenSSL if both libraries are installed.
|
||||
|
@ -74,6 +75,7 @@ packages(package name may vary depending on the distribution you use):
|
|||
* libgcrypt-dev (Required for BitTorrent, Checksum support)
|
||||
* libares-dev (Required for async DNS support)
|
||||
* libxml2-dev (Required for Metalink support)
|
||||
* libz1g-dev (Required for gzip, deflate decoding support in HTTP)
|
||||
|
||||
You can use libssl-dev instead of libgnutls-dev,libgpg-error-dev,libgcrypt-dev:
|
||||
|
||||
|
|
177
README.html
177
README.html
|
@ -3,7 +3,7 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<meta name="generator" content="AsciiDoc 8.2.2" />
|
||||
<meta name="generator" content="AsciiDoc 8.2.6" />
|
||||
<style type="text/css">
|
||||
/* Debug borders */
|
||||
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
|
||||
|
@ -26,10 +26,12 @@ a:visited {
|
|||
|
||||
em {
|
||||
font-style: italic;
|
||||
color: navy;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
color: #083194;
|
||||
}
|
||||
|
||||
tt {
|
||||
|
@ -44,13 +46,18 @@ h1, h2, h3, h4, h5, h6 {
|
|||
line-height: 1.3;
|
||||
}
|
||||
|
||||
h1 {
|
||||
h1, h2, h3 {
|
||||
border-bottom: 2px solid silver;
|
||||
}
|
||||
h2 {
|
||||
border-bottom: 2px solid silver;
|
||||
padding-top: 0.5em;
|
||||
}
|
||||
h3 {
|
||||
float: left;
|
||||
}
|
||||
h3 + * {
|
||||
clear: left;
|
||||
}
|
||||
|
||||
div.sectionbody {
|
||||
font-family: serif;
|
||||
|
@ -66,6 +73,10 @@ p {
|
|||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
ul, ol, li > p {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
pre {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
|
@ -118,6 +129,7 @@ div.content { /* Block element content. */
|
|||
|
||||
/* Block element titles. */
|
||||
div.title, caption.title {
|
||||
color: #527bbd;
|
||||
font-family: sans-serif;
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
|
@ -197,16 +209,19 @@ dl {
|
|||
dt {
|
||||
margin-top: 0.5em;
|
||||
margin-bottom: 0;
|
||||
font-style: italic;
|
||||
font-style: normal;
|
||||
}
|
||||
dd > *:first-child {
|
||||
margin-top: 0;
|
||||
margin-top: 0.1em;
|
||||
}
|
||||
|
||||
ul, ol {
|
||||
list-style-position: outside;
|
||||
}
|
||||
ol.olist2 {
|
||||
div.olist > ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
div.olist2 > ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
|
||||
|
@ -226,11 +241,11 @@ div.hlist {
|
|||
margin-bottom: 0.8em;
|
||||
}
|
||||
div.hlist td {
|
||||
padding-bottom: 5px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
td.hlist1 {
|
||||
vertical-align: top;
|
||||
font-style: italic;
|
||||
font-style: normal;
|
||||
padding-right: 0.8em;
|
||||
}
|
||||
td.hlist2 {
|
||||
|
@ -274,6 +289,7 @@ div.sidebar-content {
|
|||
padding: 0.5em;
|
||||
}
|
||||
div.sidebar-title, div.image-title {
|
||||
color: #527bbd;
|
||||
font-family: sans-serif;
|
||||
font-weight: bold;
|
||||
margin-top: 0.0em;
|
||||
|
@ -297,6 +313,14 @@ div.exampleblock-content {
|
|||
|
||||
/* IE6 sets dynamically generated links as visited. */
|
||||
div#toc a:visited { color: blue; }
|
||||
|
||||
/* Because IE6 child selector is broken. */
|
||||
div.olist2 ol {
|
||||
list-style-type: lower-alpha;
|
||||
}
|
||||
div.olist2 div.olist ol {
|
||||
list-style-type: decimal;
|
||||
}
|
||||
</style>
|
||||
<title>aria2 - The ultra fast download utility</title>
|
||||
</head>
|
||||
|
@ -306,16 +330,16 @@ div#toc a:visited { color: blue; }
|
|||
<span id="author">Tatsuhiro Tsujikawa</span><br />
|
||||
<span id="email"><tt><<a href="mailto:tujikawa_at_users_dot_sourceforge_dot_net">tujikawa_at_users_dot_sourceforge_dot_net</a>></tt></span><br />
|
||||
</div>
|
||||
<h2>1. Disclaimer</h2>
|
||||
<h2 id="_disclaimer">1. Disclaimer</h2>
|
||||
<div class="sectionbody">
|
||||
<p>This program comes with no warranty.
|
||||
You must use this program at your own risk.</p>
|
||||
<div class="para"><p>This program comes with no warranty.
|
||||
You must use this program at your own risk.</p></div>
|
||||
</div>
|
||||
<h2>2. Introduction</h2>
|
||||
<h2 id="_introduction">2. Introduction</h2>
|
||||
<div class="sectionbody">
|
||||
<p>aria2 is a utility for downloading files. The supported protocols are HTTP(S), FTP, BitTorrent, and Metalink. It has a powerful segmented downloading ability, downloading a file from multiple sources and multiple protocols and utilizing your download bandwidth to the maximum. It supports downloading a file from HTTP(S)/FTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using Metalink's chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent.</p>
|
||||
<p>Here is a list of features.</p>
|
||||
<ul>
|
||||
<div class="para"><p>aria2 is a utility for downloading files. The supported protocols are HTTP(S), FTP, BitTorrent, and Metalink. It has a powerful segmented downloading ability, downloading a file from multiple sources and multiple protocols and utilizing your download bandwidth to the maximum. It supports downloading a file from HTTP(S)/FTP and BitTorrent at the same time, while the data downloaded from HTTP(S)/FTP is uploaded to the BitTorrent swarm. Using Metalink's chunk checksums, aria2 automatically validates chunks of data while downloading a file like BitTorrent.</p></div>
|
||||
<div class="para"><p>Here is a list of features.</p></div>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
HTTP Proxy support
|
||||
|
@ -407,16 +431,16 @@ Integrates HTTP/FTP/BitTorrent downloads; downloading a file from several
|
|||
different sources.
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</ul></div>
|
||||
</div>
|
||||
<h2>3. Dependency</h2>
|
||||
<h2 id="_dependency">3. Dependency</h2>
|
||||
<div class="sectionbody">
|
||||
<div class="tableblock">
|
||||
<table rules="all"
|
||||
frame="border"
|
||||
cellspacing="0" cellpadding="4">
|
||||
<caption class="title">Table: External Library Dependency</caption>
|
||||
<col width="114" />
|
||||
<col width="240" />
|
||||
<col width="320" />
|
||||
<thead>
|
||||
<tr>
|
||||
|
@ -461,10 +485,18 @@ cellspacing="0" cellpadding="4">
|
|||
GnuTLS+Libgcrypt or OpenSSL
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">
|
||||
gzip, deflate in HTTP
|
||||
</td>
|
||||
<td align="left">
|
||||
zlib
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<dl>
|
||||
<div class="vlist"><dl>
|
||||
<dt>
|
||||
Note
|
||||
</dt>
|
||||
|
@ -483,11 +515,11 @@ Note
|
|||
If you prefer Expat, run configure with "—without-libxml2".
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>You can disable BitTorrent, Metalink support by providing —disable-bittorrent,
|
||||
—disable-metalink respectively to configure script.</p>
|
||||
<p>In order to enable async DNS support, you need c-ares or ares.</p>
|
||||
<ul>
|
||||
</dl></div>
|
||||
<div class="para"><p>You can disable BitTorrent, Metalink support by providing —disable-bittorrent,
|
||||
—disable-metalink respectively to configure script.</p></div>
|
||||
<div class="para"><p>In order to enable async DNS support, you need c-ares or ares.</p></div>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
c-ares: http://daniel.haxx.se/projects/c-ares/
|
||||
|
@ -498,13 +530,13 @@ c-ares: http://daniel.haxx.se/projects/c-ares/
|
|||
ares: ftp://athena-dist.mit.edu/pub/ATHENA/ares
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</ul></div>
|
||||
</div>
|
||||
<h2>4. How to build</h2>
|
||||
<h2 id="_how_to_build">4. How to build</h2>
|
||||
<div class="sectionbody">
|
||||
<p>In order to build aria2 from the source package, you need following development
|
||||
packages(package name may vary depending on the distribution you use):</p>
|
||||
<ul>
|
||||
<div class="para"><p>In order to build aria2 from the source package, you need following development
|
||||
packages(package name may vary depending on the distribution you use):</p></div>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
libgnutls-dev (Required for HTTPS, BitTorrent, Checksum support)
|
||||
|
@ -530,36 +562,41 @@ libares-dev (Required for async DNS support)
|
|||
libxml2-dev (Required for Metalink support)
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>You can use libssl-dev instead of libgnutls-dev,libgpg-error-dev,libgcrypt-dev:</p>
|
||||
<ul>
|
||||
<li>
|
||||
<p>
|
||||
libz1g-dev (Required for gzip, deflate decoding support in HTTP)
|
||||
</p>
|
||||
</li>
|
||||
</ul></div>
|
||||
<div class="para"><p>You can use libssl-dev instead of libgnutls-dev,libgpg-error-dev,libgcrypt-dev:</p></div>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
libssl-dev (Required for HTTPS, BitTorrent, Checksum support)
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>You can use libexpat1-dev instead of libxml2-dev:</p>
|
||||
<ul>
|
||||
</ul></div>
|
||||
<div class="para"><p>You can use libexpat1-dev instead of libxml2-dev:</p></div>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
libexpat1-dev (Required for Metalink support)
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
<p>The build process is fairly standard way for *nix programs:</p>
|
||||
</ul></div>
|
||||
<div class="para"><p>The build process is fairly standard way for *nix programs:</p></div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre><tt>$ ./configure
|
||||
$ make</tt></pre>
|
||||
</div></div>
|
||||
<p>The executable is aria2c in src directory.</p>
|
||||
<div class="para"><p>The executable is aria2c in src directory.</p></div>
|
||||
</div>
|
||||
<h2>5. BitTorrrent</h2>
|
||||
<h2 id="_bittorrrent">5. BitTorrrent</h2>
|
||||
<div class="sectionbody">
|
||||
<h3>5.1. About filename</h3>
|
||||
<p>The filename of the downloaded file is determined as follows:</p>
|
||||
<dl>
|
||||
<h3 id="_about_filename">5.1. About filename</h3><div style="clear:left"></div>
|
||||
<div class="para"><p>The filename of the downloaded file is determined as follows:</p></div>
|
||||
<div class="vlist"><dl>
|
||||
<dt>
|
||||
single-file mode
|
||||
</dt>
|
||||
|
@ -583,25 +620,25 @@ multi-file mode
|
|||
specified by -d option.
|
||||
</p>
|
||||
</dd>
|
||||
</dl>
|
||||
<p>In the default behavior, before download starts, complete directory structure
|
||||
</dl></div>
|
||||
<div class="para"><p>In the default behavior, before download starts, complete directory structure
|
||||
is created if needed. Then aria2 opens all files mentioned in .torrent file,
|
||||
directly writes to and reads from these files.
|
||||
NOTE: Even in selective download, all files are opened.</p>
|
||||
<p>If "—direct-file-mapping" option set to be false, aria2 creates temporary
|
||||
NOTE: Even in selective download, all files are opened.</p></div>
|
||||
<div class="para"><p>If "—direct-file-mapping" option set to be false, aria2 creates temporary
|
||||
file in the store directory. The length of this file is the sum of length of
|
||||
the files in .torrent file, so at least 2 times more disk space than the file
|
||||
size itself is required. Writing and reading is done against this file.
|
||||
After download completes, aria2 creates complete directory structure if needed,
|
||||
and copies whole file or a part of it to the destination.</p>
|
||||
<h3>5.2. DHT</h3>
|
||||
<p>As of release 0.13.0, aria2 supports DHT. The routing table is saved to $HOME/.aria2/dht.dat.</p>
|
||||
<dl>
|
||||
and copies whole file or a part of it to the destination.</p></div>
|
||||
<h3 id="_dht">5.2. DHT</h3><div style="clear:left"></div>
|
||||
<div class="para"><p>As of release 0.13.0, aria2 supports DHT. The routing table is saved to $HOME/.aria2/dht.dat.</p></div>
|
||||
<div class="vlist"><dl>
|
||||
<dt>
|
||||
Note
|
||||
</dt>
|
||||
<dd>
|
||||
<ul>
|
||||
<div class="ilist"><ul>
|
||||
<li>
|
||||
<p>
|
||||
-o option is used to change the filename of .torrent file itself, not a filename of a file in .torrent file.
|
||||
|
@ -629,36 +666,36 @@ As of release 0.10.0, aria2 stops sending request message after selective
|
|||
download completes,
|
||||
</p>
|
||||
</li>
|
||||
</ul>
|
||||
</ul></div>
|
||||
</dd>
|
||||
</dl>
|
||||
</dl></div>
|
||||
</div>
|
||||
<h2>6. Metalink</h2>
|
||||
<h2 id="_metalink">6. Metalink</h2>
|
||||
<div class="sectionbody">
|
||||
<p>The current implementation supports HTTP/FTP/BitTorrent.
|
||||
The other P2P protocols are ignored.</p>
|
||||
<p>For checksum checking, MD5, SHA1, SHA256 are supported. If multiple hash
|
||||
<div class="para"><p>The current implementation supports HTTP/FTP/BitTorrent.
|
||||
The other P2P protocols are ignored.</p></div>
|
||||
<div class="para"><p>For checksum checking, MD5, SHA1, SHA256 are supported. If multiple hash
|
||||
algorithms are provided, aria2 uses SHA1. If checksum checking is failed, aria2
|
||||
doesn't retry the download and just exits with non-zero return code.</p>
|
||||
<p>The supported user preferences are version, language, location, protocol and
|
||||
os.</p>
|
||||
<p>If chunk checksums are provided in Metalink file, aria2 automatically validate
|
||||
doesn't retry the download and just exits with non-zero return code.</p></div>
|
||||
<div class="para"><p>The supported user preferences are version, language, location, protocol and
|
||||
os.</p></div>
|
||||
<div class="para"><p>If chunk checksums are provided in Metalink file, aria2 automatically validate
|
||||
a chunk of file while downloading it. This behavior can be turned off by
|
||||
a command-line option.</p>
|
||||
a command-line option.</p></div>
|
||||
</div>
|
||||
<h2>7. netrc</h2>
|
||||
<h2 id="_netrc">7. netrc</h2>
|
||||
<div class="sectionbody">
|
||||
<p>netrc support is enabled by default in ftp.
|
||||
<div class="para"><p>netrc support is enabled by default in ftp.
|
||||
To disable netrc support, specify -n command-line option.
|
||||
Your .netrc file should have correct permissions(600).</p>
|
||||
Your .netrc file should have correct permissions(600).</p></div>
|
||||
</div>
|
||||
<h2>8. Configuration file</h2>
|
||||
<h2 id="_configuration_file">8. Configuration file</h2>
|
||||
<div class="sectionbody">
|
||||
<p>Configuration file must be placed under $HOME/.aria2 and must be named as aria2.conf.
|
||||
<div class="para"><p>Configuration file must be placed under $HOME/.aria2 and must be named as aria2.conf.
|
||||
In each line, there is 1 parameter whose syntax is name=value pair,
|
||||
where name is the long command-line option name without <em>—</em> prefix.
|
||||
The lines beginning <em>#</em> are treated as comments.</p>
|
||||
<p>Example:</p>
|
||||
The lines beginning <em>#</em> are treated as comments.</p></div>
|
||||
<div class="para"><p>Example:</p></div>
|
||||
<div class="listingblock">
|
||||
<div class="content">
|
||||
<pre><tt># sample configuration file for aria2c
|
||||
|
@ -671,7 +708,7 @@ ftp-pasv=true</tt></pre>
|
|||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 26-Feb-2008 21:34:01 JST
|
||||
Last updated 2008-06-29 22:45:02 JST
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -1418,6 +1418,7 @@ AC_SUBST([am__tar])
|
|||
AC_SUBST([am__untar])
|
||||
]) # _AM_PROG_TAR
|
||||
|
||||
m4_include([m4/aria2_arg.m4])
|
||||
m4_include([m4/codeset.m4])
|
||||
m4_include([m4/gettext.m4])
|
||||
m4_include([m4/glibc2.m4])
|
||||
|
@ -1436,6 +1437,7 @@ m4_include([m4/lib-prefix.m4])
|
|||
m4_include([m4/libares.m4])
|
||||
m4_include([m4/libcares.m4])
|
||||
m4_include([m4/libexpat.m4])
|
||||
m4_include([m4/libz.m4])
|
||||
m4_include([m4/lock.m4])
|
||||
m4_include([m4/longlong.m4])
|
||||
m4_include([m4/nls.m4])
|
||||
|
|
|
@ -220,6 +220,9 @@
|
|||
/* Define to 1 if you have libxml2. */
|
||||
#undef HAVE_LIBXML2
|
||||
|
||||
/* Define to 1 if you have libz. */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
|
|
|
@ -738,6 +738,8 @@ LIBCARES_LIBS
|
|||
LIBCARES_CPPFLAGS
|
||||
LIBARES_LIBS
|
||||
LIBARES_CPPFLAGS
|
||||
LIBZ_LIBS
|
||||
LIBZ_CPPFLAGS
|
||||
ENABLE_MESSAGE_DIGEST_TRUE
|
||||
ENABLE_MESSAGE_DIGEST_FALSE
|
||||
ENABLE_BITTORRENT_TRUE
|
||||
|
@ -750,6 +752,8 @@ ENABLE_LIBEXPAT_TRUE
|
|||
ENABLE_LIBEXPAT_FALSE
|
||||
ENABLE_ASYNC_DNS_TRUE
|
||||
ENABLE_ASYNC_DNS_FALSE
|
||||
HAVE_LIBZ_TRUE
|
||||
HAVE_LIBZ_FALSE
|
||||
ALLOCA
|
||||
USE_NLS
|
||||
GETTEXT_MACRO_VERSION
|
||||
|
@ -1436,6 +1440,7 @@ Optional Packages:
|
|||
--with-libexpat use libexpat library if installed. Default: yes
|
||||
--with-libares use ares library if installed. Default: yes
|
||||
--with-libcares use c-ares library if installed. Default: yes
|
||||
--with-libz use libz if it is installed.
|
||||
--with-xml-prefix=PFX Prefix where libxml is installed (optional)
|
||||
--with-xml-exec-prefix=PFX Exec prefix where libxml is installed (optional)
|
||||
--with-libexpat-prefix=PREFIX Prefix where libexpat installed (optional)
|
||||
|
@ -1445,6 +1450,7 @@ Optional Packages:
|
|||
--with-openssl-prefix=PREFIX Prefix where OpenSSL installed (optional)
|
||||
--with-libcares-prefix=PREFIX Prefix where libcares installed (optional)
|
||||
--with-libares-prefix=PREFIX Prefix where libares installed (optional)
|
||||
--with-libz-prefix=PREFIX Prefix where libz installed (optional)
|
||||
--with-gnu-ld assume the C compiler uses GNU ld default=no
|
||||
--with-libpth-prefix[=DIR] search for libpth in DIR/include and DIR/lib
|
||||
--without-libpth-prefix don't search for libpth in includedir and libdir
|
||||
|
@ -2727,6 +2733,15 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Check whether --with-libz was given.
|
||||
if test "${with_libz+set}" = set; then
|
||||
withval=$with_libz; with_libz=$withval
|
||||
else
|
||||
with_libz=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --enable-bittorrent was given.
|
||||
if test "${enable_bittorrent+set}" = set; then
|
||||
enableval=$enable_bittorrent; enable_bittorrent=$enableval
|
||||
|
@ -6982,6 +6997,113 @@ CPPFLAGS=$CPPFLAGS_save
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_libz" = "xyes"; then
|
||||
|
||||
|
||||
# Check whether --with-libz-prefix was given.
|
||||
if test "${with_libz_prefix+set}" = set; then
|
||||
withval=$with_libz_prefix; libz_prefix=$withval
|
||||
else
|
||||
libz_prefix=""
|
||||
fi
|
||||
|
||||
|
||||
if test "x$libz_prefix" = "x"; then
|
||||
libz_prefix="/usr"
|
||||
fi
|
||||
|
||||
libz_prefix_lib=$libz_prefix/lib
|
||||
libz_prefix_include=$libz_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$libz_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$libz_prefix_include $CPPFLAGS"
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for zlibVersion in -lz" >&5
|
||||
echo $ECHO_N "checking for zlibVersion in -lz... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_z_zlibVersion+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lz $LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
/* Override any GCC internal prototype to avoid an error.
|
||||
Use char because int might match the return type of a GCC
|
||||
builtin and then its argument prototype would still apply. */
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
#endif
|
||||
char zlibVersion ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return zlibVersion ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
rm -f conftest.$ac_objext conftest$ac_exeext
|
||||
if { (ac_try="$ac_link"
|
||||
case "(($ac_try" in
|
||||
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
|
||||
*) ac_try_echo=$ac_try;;
|
||||
esac
|
||||
eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
|
||||
(eval "$ac_link") 2>conftest.er1
|
||||
ac_status=$?
|
||||
grep -v '^ *+' conftest.er1 >conftest.err
|
||||
rm -f conftest.er1
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); } && {
|
||||
test -z "$ac_cxx_werror_flag" ||
|
||||
test ! -s conftest.err
|
||||
} && test -s conftest$ac_exeext &&
|
||||
$as_test_x conftest$ac_exeext; then
|
||||
ac_cv_lib_z_zlibVersion=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_z_zlibVersion=no
|
||||
fi
|
||||
|
||||
rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
LIBS=$ac_check_lib_save_LIBS
|
||||
fi
|
||||
{ echo "$as_me:$LINENO: result: $ac_cv_lib_z_zlibVersion" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_z_zlibVersion" >&6; }
|
||||
if test $ac_cv_lib_z_zlibVersion = yes; then
|
||||
have_libz=yes
|
||||
fi
|
||||
|
||||
if test "x$have_libz" = "xyes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIBZ 1
|
||||
_ACEOF
|
||||
|
||||
LIBZ_LIBS="-L$libz_prefix_lib -lz"
|
||||
LIBZ_CPPFLAGS="-I$libz_prefix_include"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
|
||||
fi
|
||||
|
||||
# Define variables based on the result of the checks for libraries.
|
||||
if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
|
||||
|
||||
|
@ -7111,6 +7233,15 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
if test "x$have_libz" = "xyes"; then
|
||||
HAVE_LIBZ_TRUE=
|
||||
HAVE_LIBZ_FALSE='#'
|
||||
else
|
||||
HAVE_LIBZ_TRUE='#'
|
||||
HAVE_LIBZ_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
||||
# for constant arguments. Useless!
|
||||
|
@ -21306,6 +21437,13 @@ echo "$as_me: error: conditional \"ENABLE_ASYNC_DNS\" was never defined.
|
|||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${HAVE_LIBZ_TRUE}" && test -z "${HAVE_LIBZ_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_LIBZ\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"HAVE_LIBZ\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${HAVE_ASCTIME_R_TRUE}" && test -z "${HAVE_ASCTIME_R_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_ASCTIME_R\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
|
@ -22154,6 +22292,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
|
||||
LIBZ_LIBS!$LIBZ_LIBS$ac_delim
|
||||
LIBZ_CPPFLAGS!$LIBZ_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
|
||||
|
@ -22166,6 +22306,8 @@ ENABLE_LIBEXPAT_TRUE!$ENABLE_LIBEXPAT_TRUE$ac_delim
|
|||
ENABLE_LIBEXPAT_FALSE!$ENABLE_LIBEXPAT_FALSE$ac_delim
|
||||
ENABLE_ASYNC_DNS_TRUE!$ENABLE_ASYNC_DNS_TRUE$ac_delim
|
||||
ENABLE_ASYNC_DNS_FALSE!$ENABLE_ASYNC_DNS_FALSE$ac_delim
|
||||
HAVE_LIBZ_TRUE!$HAVE_LIBZ_TRUE$ac_delim
|
||||
HAVE_LIBZ_FALSE!$HAVE_LIBZ_FALSE$ac_delim
|
||||
ALLOCA!$ALLOCA$ac_delim
|
||||
USE_NLS!$USE_NLS$ac_delim
|
||||
GETTEXT_MACRO_VERSION!$GETTEXT_MACRO_VERSION$ac_delim
|
||||
|
@ -22224,10 +22366,6 @@ HAVE_GETADDRINFO_TRUE!$HAVE_GETADDRINFO_TRUE$ac_delim
|
|||
HAVE_GETADDRINFO_FALSE!$HAVE_GETADDRINFO_FALSE$ac_delim
|
||||
HAVE_GETTIMEOFDAY_TRUE!$HAVE_GETTIMEOFDAY_TRUE$ac_delim
|
||||
HAVE_GETTIMEOFDAY_FALSE!$HAVE_GETTIMEOFDAY_FALSE$ac_delim
|
||||
HAVE_INET_ATON_TRUE!$HAVE_INET_ATON_TRUE$ac_delim
|
||||
HAVE_INET_ATON_FALSE!$HAVE_INET_ATON_FALSE$ac_delim
|
||||
HAVE_LOCALTIME_R_TRUE!$HAVE_LOCALTIME_R_TRUE$ac_delim
|
||||
HAVE_LOCALTIME_R_FALSE!$HAVE_LOCALTIME_R_FALSE$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
|
@ -22269,6 +22407,10 @@ _ACEOF
|
|||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
HAVE_INET_ATON_TRUE!$HAVE_INET_ATON_TRUE$ac_delim
|
||||
HAVE_INET_ATON_FALSE!$HAVE_INET_ATON_FALSE$ac_delim
|
||||
HAVE_LOCALTIME_R_TRUE!$HAVE_LOCALTIME_R_TRUE$ac_delim
|
||||
HAVE_LOCALTIME_R_FALSE!$HAVE_LOCALTIME_R_FALSE$ac_delim
|
||||
HAVE_STRPTIME_TRUE!$HAVE_STRPTIME_TRUE$ac_delim
|
||||
HAVE_STRPTIME_FALSE!$HAVE_STRPTIME_FALSE$ac_delim
|
||||
HAVE_TIMEGM_TRUE!$HAVE_TIMEGM_TRUE$ac_delim
|
||||
|
@ -22276,7 +22418,7 @@ HAVE_TIMEGM_FALSE!$HAVE_TIMEGM_FALSE$ac_delim
|
|||
LTLIBOBJS!$LTLIBOBJS$ac_delim
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 5; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 9; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
@ -23003,5 +23145,6 @@ echo "LibXML2: $have_libxml2"
|
|||
echo "LibExpat: $have_libexpat"
|
||||
echo "LibAres: $have_libares"
|
||||
echo "LibCares: $have_libcares"
|
||||
echo "Libz: $have_libz"
|
||||
echo "Bittorrent: $enable_bittorrent"
|
||||
echo "Metalink: $enable_metalink"
|
||||
|
|
|
@ -30,6 +30,7 @@ AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if inst
|
|||
AC_ARG_WITH([libexpat], [ --with-libexpat use libexpat library if installed. Default: yes], [with_libexpat=$withval], [with_libexpat=yes])
|
||||
AC_ARG_WITH([libares], [ --with-libares use ares library if installed. Default: yes], [with_libares=$withval], [with_libares=yes])
|
||||
AC_ARG_WITH([libcares], [ --with-libcares use c-ares library if installed. Default: yes], [with_libcares=$withval], [with_libcares=yes])
|
||||
ARIA2_ARG_WITH([libz])
|
||||
|
||||
AC_ARG_ENABLE([bittorrent], [ --enable-bittorrent enable BitTorrent support. Default: yes], [enable_bittorrent=$enableval], [enable_bittorrent=yes])
|
||||
AC_ARG_ENABLE([metalink], [ --enable-metalink enable Metalink support. Default: yes], [enable_metalink=$enableval], [enable_metalink=yes])
|
||||
|
@ -92,6 +93,10 @@ if test "x$have_libcares" = "x"; then
|
|||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_libz" = "xyes"; then
|
||||
AM_PATH_LIBZ
|
||||
fi
|
||||
|
||||
# Define variables based on the result of the checks for libraries.
|
||||
if test "x$have_libgnutls" = "xyes" || test "x$have_openssl" = "xyes"; then
|
||||
AC_DEFINE([ENABLE_SSL], [1], [Define to 1 if ssl support is enabled.])
|
||||
|
@ -131,6 +136,8 @@ else
|
|||
AM_CONDITIONAL([ENABLE_ASYNC_DNS], false)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([HAVE_LIBZ], [test "x$have_libz" = "xyes"])
|
||||
|
||||
# Checks for header files.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_STDC
|
||||
|
@ -249,5 +256,6 @@ echo "LibXML2: $have_libxml2"
|
|||
echo "LibExpat: $have_libexpat"
|
||||
echo "LibAres: $have_libares"
|
||||
echo "LibCares: $have_libcares"
|
||||
echo "Libz: $have_libz"
|
||||
echo "Bittorrent: $enable_bittorrent"
|
||||
echo "Metalink: $enable_metalink"
|
||||
|
|
|
@ -37,24 +37,24 @@ subdir = doc
|
|||
DIST_COMMON = $(dist_doc_DATA) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -149,6 +149,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
|
|
@ -35,24 +35,24 @@ target_triplet = @target@
|
|||
subdir = lib
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -135,6 +135,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
|
|
@ -35,24 +35,24 @@ target_triplet = @target@
|
|||
subdir = m4
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -135,6 +135,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
dnl ARIA2_ARG_WITH(PACKAGE)
|
||||
dnl wrapper for AC_ARG_WITH with default value 'yes'.
|
||||
AC_DEFUN([ARIA2_ARG_WITH],
|
||||
[AC_ARG_WITH([$1],
|
||||
AC_HELP_STRING([--with-$1], [use $1 if it is installed.]),
|
||||
[with_$1=$withval], [with_$1=yes])]
|
||||
)
|
||||
|
||||
dnl ARIA2_ARG_ENABLE(FEATURE)
|
||||
dnl wrapper for AC_ARG_ENABLE with default value 'yes'.
|
||||
AC_DEFUN([ARIA2_ARG_ENABLE],
|
||||
[AC_ARG_ENABLE([$1],
|
||||
AC_HELP_STRING([--enable-$1], [enable $1 support.]),
|
||||
[enable_$1=$withval], [enable_$1=yes])]
|
||||
)
|
|
@ -0,0 +1,33 @@
|
|||
AC_DEFUN([AM_PATH_LIBZ],
|
||||
[
|
||||
AC_ARG_WITH([libz-prefix],
|
||||
[ --with-libz-prefix=PREFIX Prefix where libz installed (optional)],
|
||||
[libz_prefix=$withval],
|
||||
[libz_prefix=""])
|
||||
|
||||
if test "x$libz_prefix" = "x"; then
|
||||
libz_prefix="/usr"
|
||||
fi
|
||||
|
||||
libz_prefix_lib=$libz_prefix/lib
|
||||
libz_prefix_include=$libz_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$libz_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$libz_prefix_include $CPPFLAGS"
|
||||
|
||||
AC_CHECK_LIB([z], [zlibVersion], [have_libz=yes])
|
||||
if test "x$have_libz" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBZ], [1], [Define to 1 if you have libz.])
|
||||
LIBZ_LIBS="-L$libz_prefix_lib -lz"
|
||||
LIBZ_CPPFLAGS="-I$libz_prefix_include"
|
||||
AC_SUBST(LIBZ_LIBS)
|
||||
AC_SUBST(LIBZ_CPPFLAGS)
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
])
|
|
@ -0,0 +1,60 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_DECODER_H_
|
||||
#define _D_DECODER_H_
|
||||
|
||||
#include "common.h"
|
||||
#include <string>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class Decoder {
|
||||
public:
|
||||
virtual ~Decoder() {}
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
virtual std::string decode(const unsigned char* inbuf, size_t inlen) = 0;
|
||||
|
||||
virtual bool finished() = 0;
|
||||
|
||||
virtual void release() = 0;
|
||||
|
||||
virtual const std::string& getName() const = 0;
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // _D_DECODER_H_
|
|
@ -55,6 +55,7 @@
|
|||
#include "message.h"
|
||||
#include "prefs.h"
|
||||
#include "StringFormat.h"
|
||||
#include "Decoder.h"
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
# include "MessageDigestHelper.h"
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
|
@ -119,46 +120,47 @@ bool DownloadCommand::executeInternal() {
|
|||
}
|
||||
socket->readData(buf, bufSize);
|
||||
|
||||
const SharedHandle<DiskAdaptor>& diskAdaptor =
|
||||
_requestGroup->getPieceStorage()->getDiskAdaptor();
|
||||
|
||||
unsigned char* bufFinal;
|
||||
size_t bufSizeFinal;
|
||||
|
||||
if(transferDecoder.isNull()) {
|
||||
_requestGroup->getPieceStorage()->getDiskAdaptor()->writeData(buf, bufSize,
|
||||
segment->getPositionToWrite());
|
||||
//logger->debug("bufSize = %d, posToWrite = %lld", bufSize, segment->getPositionToWrite());
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
||||
if(_pieceHashValidationEnabled) {
|
||||
segment->updateHash(segment->getWrittenLength(), buf, bufSize);
|
||||
}
|
||||
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
|
||||
segment->updateWrittenLength(bufSize);
|
||||
|
||||
|
||||
//logger->debug("overflow length = %d, next posToWrite = %lld", segment->getOverflowLength(), segment->getPositionToWrite());
|
||||
//logger->debug("%s", Util::toHex(segment->getPiece()->getBitfield(),
|
||||
//segment->getPiece()->getBitfieldLength()).c_str());
|
||||
//segment->writtenLength += bufSize;
|
||||
peerStat->updateDownloadLength(bufSize);
|
||||
bufFinal = buf;
|
||||
bufSizeFinal = bufSize;
|
||||
} else {
|
||||
size_t infbufSize = 16*1024;
|
||||
unsigned char infbuf[infbufSize];
|
||||
transferDecoder->inflate(infbuf, infbufSize, buf, bufSize);
|
||||
_requestGroup->getPieceStorage()->getDiskAdaptor()->writeData(infbuf, infbufSize,
|
||||
segment->getPositionToWrite());
|
||||
|
||||
bufFinal = infbuf;
|
||||
bufSizeFinal = infbufSize;
|
||||
}
|
||||
|
||||
if(_contentEncodingDecoder.isNull()) {
|
||||
diskAdaptor->writeData(bufFinal, bufSizeFinal,
|
||||
segment->getPositionToWrite());
|
||||
} else {
|
||||
std::string out = _contentEncodingDecoder->decode(bufFinal, bufSizeFinal);
|
||||
diskAdaptor->writeData(reinterpret_cast<const unsigned char*>(out.data()),
|
||||
out.size(),
|
||||
segment->getPositionToWrite());
|
||||
bufSizeFinal = out.size();
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
||||
if(_pieceHashValidationEnabled) {
|
||||
segment->updateHash(segment->getWrittenLength(), infbuf, infbufSize);
|
||||
}
|
||||
if(_pieceHashValidationEnabled) {
|
||||
segment->updateHash(segment->getWrittenLength(), bufFinal, bufSizeFinal);
|
||||
}
|
||||
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
|
||||
segment->updateWrittenLength(infbufSize);
|
||||
segment->updateWrittenLength(bufSizeFinal);
|
||||
|
||||
peerStat->updateDownloadLength(bufSize);
|
||||
|
||||
//segment->writtenLength += infbufSize;
|
||||
peerStat->updateDownloadLength(infbufSize);
|
||||
}
|
||||
if(_requestGroup->getTotalLength() != 0 && bufSize == 0) {
|
||||
throw DlRetryEx(EX_GOT_EOF);
|
||||
}
|
||||
|
@ -168,6 +170,13 @@ bool DownloadCommand::executeInternal() {
|
|||
if(!transferDecoder.isNull()) transferDecoder->end();
|
||||
logger->info(MSG_SEGMENT_DOWNLOAD_COMPLETED, cuid);
|
||||
|
||||
if(!_contentEncodingDecoder.isNull() &&
|
||||
!_contentEncodingDecoder->finished()) {
|
||||
logger->warn("CUID#%d - Transfer was completed, but inflate operation"
|
||||
" have not finished. Maybe the file is broken in the server"
|
||||
" side.", cuid);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
|
||||
{
|
||||
|
@ -280,4 +289,10 @@ void DownloadCommand::setTransferDecoder(const TransferEncodingHandle& transferD
|
|||
this->transferDecoder = transferDecoder;
|
||||
}
|
||||
|
||||
void DownloadCommand::setContentEncodingDecoder
|
||||
(const SharedHandle<Decoder>& decoder)
|
||||
{
|
||||
_contentEncodingDecoder = decoder;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
namespace aria2 {
|
||||
|
||||
class TransferEncoding;
|
||||
class Decoder;
|
||||
class PeerStat;
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
class MessageDigestContext;
|
||||
|
@ -68,6 +69,8 @@ private:
|
|||
protected:
|
||||
SharedHandle<TransferEncoding> transferDecoder;
|
||||
|
||||
SharedHandle<Decoder> _contentEncodingDecoder;
|
||||
|
||||
virtual bool executeInternal();
|
||||
|
||||
virtual bool prepareForNextSegment();
|
||||
|
@ -82,6 +85,8 @@ public:
|
|||
|
||||
void setTransferDecoder(const SharedHandle<TransferEncoding>& transferDecoder);
|
||||
|
||||
void setContentEncodingDecoder(const SharedHandle<Decoder>& decoder);
|
||||
|
||||
void setMaxDownloadSpeedLimit(unsigned int maxDownloadSpeedLimit) {
|
||||
this->maxDownloadSpeedLimit = maxDownloadSpeedLimit;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
virtual SharedHandle<Exception> copy() const = 0;
|
||||
|
||||
public:
|
||||
Exception(const std::string& msg);
|
||||
explicit Exception(const std::string& msg);
|
||||
|
||||
Exception(const std::string& msg, const Exception& cause);
|
||||
|
||||
|
|
|
@ -0,0 +1,119 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#include "GZipDecoder.h"
|
||||
#include "StringFormat.h"
|
||||
#include "DlAbortEx.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
const std::string GZipDecoder::NAME("GZipDecoder");
|
||||
|
||||
GZipDecoder::GZipDecoder():_strm(0), _finished(false) {}
|
||||
|
||||
GZipDecoder::~GZipDecoder()
|
||||
{
|
||||
release();
|
||||
}
|
||||
|
||||
void GZipDecoder::init()
|
||||
{
|
||||
_strm = new z_stream();
|
||||
_strm->zalloc = Z_NULL;
|
||||
_strm->zfree = Z_NULL;
|
||||
_strm->opaque = Z_NULL;
|
||||
_strm->avail_in = 0;
|
||||
_strm->next_in = Z_NULL;
|
||||
|
||||
// initalize z_stream with gzip/zlib format auto detection enabled.
|
||||
if(Z_OK != inflateInit2(_strm, 47)) {
|
||||
throw DlAbortEx("Initializing z_stream failed.");
|
||||
}
|
||||
}
|
||||
|
||||
void GZipDecoder::release()
|
||||
{
|
||||
if(_strm) {
|
||||
inflateEnd(_strm);
|
||||
_strm = 0;
|
||||
}
|
||||
}
|
||||
|
||||
std::string GZipDecoder::decode(const unsigned char* in, size_t length)
|
||||
{
|
||||
std::string out;
|
||||
|
||||
if(length == 0) {
|
||||
return out;
|
||||
}
|
||||
|
||||
_strm->avail_in = length;
|
||||
_strm->next_in = const_cast<unsigned char*>(in);
|
||||
|
||||
unsigned char outbuf[OUTBUF_LENGTH];
|
||||
while(1) {
|
||||
_strm->avail_out = OUTBUF_LENGTH;
|
||||
_strm->next_out = outbuf;
|
||||
|
||||
int ret = ::inflate(_strm, Z_NO_FLUSH);
|
||||
|
||||
if(ret == Z_STREAM_END) {
|
||||
_finished = true;
|
||||
} else if(ret != Z_OK) {
|
||||
throw DlAbortEx(StringFormat("libz::inflate() failed. cause:%s",
|
||||
_strm->msg).str());
|
||||
}
|
||||
|
||||
size_t produced = OUTBUF_LENGTH-_strm->avail_out;
|
||||
|
||||
out.insert(out.end(), &outbuf[0], &outbuf[produced]);
|
||||
|
||||
if(_strm->avail_out > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
bool GZipDecoder::finished()
|
||||
{
|
||||
return _finished;
|
||||
}
|
||||
|
||||
const std::string& GZipDecoder::getName() const
|
||||
{
|
||||
return NAME;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
|
@ -0,0 +1,72 @@
|
|||
/* <!-- copyright */
|
||||
/*
|
||||
* aria2 - The high speed download utility
|
||||
*
|
||||
* Copyright (C) 2006 Tatsuhiro Tsujikawa
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give
|
||||
* permission to link the code of portions of this program with the
|
||||
* OpenSSL library under certain conditions as described in each
|
||||
* individual source file, and distribute linked combinations
|
||||
* including the two.
|
||||
* You must obey the GNU General Public License in all respects
|
||||
* for all of the code used other than OpenSSL. If you modify
|
||||
* file(s) with this exception, you may extend this exception to your
|
||||
* version of the file(s), but you are not obligated to do so. If you
|
||||
* do not wish to do so, delete this exception statement from your
|
||||
* version. If you delete this exception statement from all source
|
||||
* files in the program, then also delete it here.
|
||||
*/
|
||||
/* copyright --> */
|
||||
#ifndef _D_GZIP_DECODER_H_
|
||||
#define _D_GZIP_DECODER_H_
|
||||
|
||||
#include "Decoder.h"
|
||||
#include <zlib.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
// GZipDecoder can decode both gzip and deflate format.
|
||||
class GZipDecoder : public Decoder {
|
||||
private:
|
||||
z_stream* _strm;
|
||||
|
||||
bool _finished;
|
||||
|
||||
static const size_t OUTBUF_LENGTH = 16*1024;
|
||||
|
||||
static const std::string NAME;
|
||||
public:
|
||||
GZipDecoder();
|
||||
|
||||
virtual ~GZipDecoder();
|
||||
|
||||
virtual void init();
|
||||
|
||||
virtual std::string decode(const unsigned char* inbuf, size_t inlen);
|
||||
|
||||
virtual bool finished();
|
||||
|
||||
virtual void release();
|
||||
|
||||
virtual const std::string& getName() const;
|
||||
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // _D_GZIP_DECODER_H_
|
|
@ -44,12 +44,18 @@ const std::string HttpHeader::LOCATION("Location");
|
|||
|
||||
const std::string HttpHeader::TRANSFER_ENCODING("Transfer-Encoding");
|
||||
|
||||
const std::string HttpHeader::CONTENT_ENCODING("Content-Encoding");
|
||||
|
||||
const std::string HttpHeader::CONTENT_DISPOSITION("Content-Disposition");
|
||||
|
||||
const std::string HttpHeader::SET_COOKIE("Set-Cookie");
|
||||
|
||||
const std::string HttpHeader::CHUNKED("chunked");
|
||||
|
||||
const std::string HttpHeader::GZIP("gzip");
|
||||
|
||||
const std::string HttpHeader::DEFLATE("deflate");
|
||||
|
||||
const std::string HttpHeader::CONTENT_TYPE("Content-Type");
|
||||
|
||||
const std::string HttpHeader::RETRY_AFTER("Retry-After");
|
||||
|
|
|
@ -83,12 +83,18 @@ public:
|
|||
|
||||
static const std::string TRANSFER_ENCODING;
|
||||
|
||||
static const std::string CONTENT_ENCODING;
|
||||
|
||||
static const std::string CONTENT_DISPOSITION;
|
||||
|
||||
static const std::string SET_COOKIE;
|
||||
|
||||
static const std::string CHUNKED;
|
||||
|
||||
static const std::string GZIP;
|
||||
|
||||
static const std::string DEFLATE;
|
||||
|
||||
static const std::string CONTENT_TYPE;
|
||||
|
||||
static const std::string RETRY_AFTER;
|
||||
|
|
|
@ -55,6 +55,7 @@ HttpRequest::HttpRequest():entityLength(0),
|
|||
authEnabled(false),
|
||||
proxyEnabled(false),
|
||||
proxyAuthEnabled(false),
|
||||
_contentEncodingEnabled(true),
|
||||
userAgent(USER_AGENT)
|
||||
{}
|
||||
|
||||
|
@ -155,6 +156,16 @@ std::string HttpRequest::createRequest() const
|
|||
}
|
||||
requestLine += "\r\n";
|
||||
|
||||
if(_contentEncodingEnabled) {
|
||||
std::string acceptableEncodings;
|
||||
#ifdef HAVE_LIBZ
|
||||
acceptableEncodings += "deflate, gzip";
|
||||
#endif // HAVE_LIBZ
|
||||
if(!acceptableEncodings.empty()) {
|
||||
requestLine += "Accept-Encoding: "+acceptableEncodings+"\r\n";
|
||||
}
|
||||
}
|
||||
|
||||
requestLine +=
|
||||
"Host: "+getHostText(getHost(), getPort())+"\r\n"+
|
||||
"Pragma: no-cache\r\n"+
|
||||
|
@ -235,6 +246,16 @@ std::string HttpRequest::getProxyAuthString() const {
|
|||
Base64::encode(AuthConfigFactorySingleton::instance()->createAuthConfigForHttpProxy(request)->getAuthText())+"\r\n";
|
||||
}
|
||||
|
||||
void HttpRequest::enableContentEncoding()
|
||||
{
|
||||
_contentEncodingEnabled = true;
|
||||
}
|
||||
|
||||
void HttpRequest::disableContentEncoding()
|
||||
{
|
||||
_contentEncodingEnabled = false;
|
||||
}
|
||||
|
||||
void HttpRequest::addHeader(const std::string& headersString)
|
||||
{
|
||||
std::deque<std::string> headers;
|
||||
|
|
|
@ -64,6 +64,8 @@ private:
|
|||
|
||||
bool proxyAuthEnabled;
|
||||
|
||||
bool _contentEncodingEnabled;
|
||||
|
||||
std::string userAgent;
|
||||
|
||||
std::deque<std::string> _headers;
|
||||
|
@ -166,6 +168,10 @@ public:
|
|||
this->authEnabled = authEnabled;
|
||||
}
|
||||
|
||||
void enableContentEncoding();
|
||||
|
||||
void disableContentEncoding();
|
||||
|
||||
void setUserAgent(const std::string& userAgent)
|
||||
{
|
||||
this->userAgent = userAgent;
|
||||
|
|
|
@ -47,6 +47,10 @@
|
|||
#include "DlAbortEx.h"
|
||||
#include "StringFormat.h"
|
||||
#include "A2STR.h"
|
||||
#include "Decoder.h"
|
||||
#ifdef HAVE_LIBZ
|
||||
# include "GZipDecoder.h"
|
||||
#endif // HAVE_LIBZ
|
||||
#include <deque>
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -150,6 +154,27 @@ TransferEncodingHandle HttpResponse::getTransferDecoder() const
|
|||
return SharedHandle<TransferEncoding>();
|
||||
}
|
||||
|
||||
bool HttpResponse::isContentEncodingSpecified() const
|
||||
{
|
||||
return httpHeader->defined(HttpHeader::CONTENT_ENCODING);
|
||||
}
|
||||
|
||||
const std::string& HttpResponse::getContentEncoding() const
|
||||
{
|
||||
return httpHeader->getFirst(HttpHeader::CONTENT_ENCODING);
|
||||
}
|
||||
|
||||
SharedHandle<Decoder> HttpResponse::getContentEncodingDecoder() const
|
||||
{
|
||||
#ifdef HAVE_LIBZ
|
||||
if(getContentEncoding() == HttpHeader::GZIP ||
|
||||
getContentEncoding() == HttpHeader::DEFLATE) {
|
||||
return SharedHandle<Decoder>(new GZipDecoder());
|
||||
}
|
||||
#endif // HAVE_LIBZ
|
||||
return SharedHandle<Decoder>();
|
||||
}
|
||||
|
||||
uint64_t HttpResponse::getContentLength() const
|
||||
{
|
||||
if(httpHeader.isNull()) {
|
||||
|
|
|
@ -46,6 +46,7 @@ class HttpRequest;
|
|||
class HttpHeader;
|
||||
class TransferEncoding;
|
||||
class Logger;
|
||||
class Decoder;
|
||||
|
||||
class HttpResponse {
|
||||
private:
|
||||
|
@ -85,6 +86,12 @@ public:
|
|||
|
||||
SharedHandle<TransferEncoding> getTransferDecoder() const;
|
||||
|
||||
bool isContentEncodingSpecified() const;
|
||||
|
||||
const std::string& getContentEncoding() const;
|
||||
|
||||
SharedHandle<Decoder> getContentEncodingDecoder() const;
|
||||
|
||||
uint64_t getContentLength() const;
|
||||
|
||||
uint64_t getEntityLength() const;
|
||||
|
|
|
@ -62,6 +62,8 @@
|
|||
#include "StringFormat.h"
|
||||
#include "HttpSkipResponseCommand.h"
|
||||
#include "HttpHeader.h"
|
||||
#include "Decoder.h"
|
||||
#include "LogFactory.h"
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
|
@ -194,10 +196,32 @@ static SharedHandle<TransferEncoding> getTransferEncoding
|
|||
return enc;
|
||||
}
|
||||
|
||||
static SharedHandle<Decoder> getContentEncodingDecoder
|
||||
(const SharedHandle<HttpResponse>& httpResponse)
|
||||
{
|
||||
SharedHandle<Decoder> decoder;
|
||||
if(httpResponse->isContentEncodingSpecified()) {
|
||||
decoder = httpResponse->getContentEncodingDecoder();
|
||||
if(decoder.isNull()) {
|
||||
LogFactory::getInstance()->info
|
||||
("Content-Encoding %s is specified, but the current implementation"
|
||||
"doesn't support it. The decoding process is skipped and the"
|
||||
"downloaded content will be still encoded.",
|
||||
httpResponse->getContentEncoding().c_str());
|
||||
} else {
|
||||
decoder->init();
|
||||
}
|
||||
}
|
||||
return decoder;
|
||||
}
|
||||
|
||||
bool HttpResponseCommand::skipResponseBody
|
||||
(const SharedHandle<HttpResponse>& httpResponse)
|
||||
{
|
||||
SharedHandle<TransferEncoding> enc(getTransferEncoding(httpResponse));
|
||||
// We don't use Content-Encoding here because this response body is just
|
||||
// thrown away.
|
||||
|
||||
HttpSkipResponseCommand* command = new HttpSkipResponseCommand
|
||||
(cuid, req, _requestGroup, httpConnection, httpResponse, e, socket);
|
||||
command->setTransferDecoder(enc);
|
||||
|
@ -216,7 +240,10 @@ bool HttpResponseCommand::skipResponseBody
|
|||
|
||||
HttpDownloadCommand* HttpResponseCommand::createHttpDownloadCommand(const HttpResponseHandle& httpResponse)
|
||||
{
|
||||
TransferEncodingHandle enc(getTransferEncoding(httpResponse));
|
||||
TransferEncodingHandle enc = getTransferEncoding(httpResponse);
|
||||
SharedHandle<Decoder> contentEncodingDecoder =
|
||||
getContentEncodingDecoder(httpResponse);
|
||||
|
||||
HttpDownloadCommand* command =
|
||||
new HttpDownloadCommand(cuid, req, _requestGroup, httpConnection, e, socket);
|
||||
command->setMaxDownloadSpeedLimit(e->option->getAsInt(PREF_MAX_DOWNLOAD_LIMIT));
|
||||
|
@ -224,6 +251,14 @@ HttpDownloadCommand* HttpResponseCommand::createHttpDownloadCommand(const HttpRe
|
|||
command->setLowestDownloadSpeedLimit(e->option->getAsInt(PREF_LOWEST_SPEED_LIMIT));
|
||||
command->setTransferDecoder(enc);
|
||||
|
||||
if(!contentEncodingDecoder.isNull()) {
|
||||
command->setContentEncodingDecoder(contentEncodingDecoder);
|
||||
// Since the compressed file's length are returned in the response header
|
||||
// and the decompressed file size is unknown at this point, disable file
|
||||
// allocation here.
|
||||
_requestGroup->setFileAllocationEnabled(false);
|
||||
}
|
||||
|
||||
return command;
|
||||
}
|
||||
|
||||
|
|
|
@ -188,7 +188,12 @@ SRCS = Socket.h\
|
|||
InitiateConnectionCommand.cc InitiateConnectionCommand.h\
|
||||
FtpFinishDownloadCommand.cc FtpFinishDownloadCommand.h\
|
||||
A2STR.cc A2STR.h\
|
||||
RarestPieceSelector.cc RarestPieceSelector.h
|
||||
RarestPieceSelector.cc RarestPieceSelector.h\
|
||||
Decoder.h
|
||||
|
||||
if HAVE_LIBZ
|
||||
SRCS += GZipDecoder.cc GZipDecoder.h
|
||||
endif # HAVE_LIBZ
|
||||
|
||||
if ENABLE_ASYNC_DNS
|
||||
SRCS += AsyncNameResolver.cc AsyncNameResolver.h
|
||||
|
@ -462,10 +467,10 @@ 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@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@ #-lprofiler
|
||||
#aria2c_LDFLAGS = -pg
|
||||
AM_CPPFLAGS = -Wall\
|
||||
-I../lib -I../intl -I$(top_srcdir)/intl\
|
||||
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
|
||||
@LIBARES_CPPFLAGS@ @LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
112
src/Makefile.in
112
src/Makefile.in
|
@ -35,8 +35,9 @@ build_triplet = @build@
|
|||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
bin_PROGRAMS = aria2c$(EXEEXT)
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__append_1 = AsyncNameResolver.cc AsyncNameResolver.h
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_2 = IteratableChunkChecksumValidator.cc IteratableChunkChecksumValidator.h\
|
||||
@HAVE_LIBZ_TRUE@am__append_1 = GZipDecoder.cc GZipDecoder.h
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__append_2 = AsyncNameResolver.cc AsyncNameResolver.h
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_3 = IteratableChunkChecksumValidator.cc IteratableChunkChecksumValidator.h\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidator.cc IteratableChecksumValidator.h\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ CheckIntegrityCommand.cc CheckIntegrityCommand.h\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ ChecksumCheckIntegrityEntry.cc ChecksumCheckIntegrityEntry.h\
|
||||
|
@ -45,7 +46,7 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_MESSAGE_DIGEST_TRUE@ Checksum.h\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ ChunkChecksum.h
|
||||
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_3 = MetaEntry.h\
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_4 = MetaEntry.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ Data.cc Data.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ Dictionary.cc Dictionary.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ List.cc List.h\
|
||||
|
@ -222,7 +223,7 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_BITTORRENT_TRUE@ BtLeecherStateChoke.cc BtLeecherStateChoke.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtSeederStateChoke.cc BtSeederStateChoke.h
|
||||
|
||||
@ENABLE_METALINK_TRUE@am__append_4 = Metalinker.cc Metalinker.h\
|
||||
@ENABLE_METALINK_TRUE@am__append_5 = Metalinker.cc Metalinker.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.cc MetalinkEntry.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.cc MetalinkResource.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessor.h\
|
||||
|
@ -250,38 +251,38 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandler.cc MetalinkPostDownloadHandler.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelper.cc MetalinkHelper.h
|
||||
|
||||
@ENABLE_LIBXML2_TRUE@am__append_5 = XML2SAXMetalinkProcessor.cc XML2SAXMetalinkProcessor.h
|
||||
@ENABLE_LIBEXPAT_TRUE@am__append_6 = ExpatMetalinkProcessor.cc ExpatMetalinkProcessor.h
|
||||
@HAVE_ASCTIME_R_FALSE@am__append_7 = asctime_r.c asctime_r.h
|
||||
@HAVE_BASENAME_FALSE@am__append_8 = libgen.c libgen.h
|
||||
@HAVE_GETADDRINFO_FALSE@am__append_9 = getaddrinfo.c getaddrinfo.h
|
||||
@HAVE_GAI_STRERROR_FALSE@am__append_10 = gai_strerror.c gai_strerror.h
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__append_11 = gettimeofday.c gettimeofday.h
|
||||
@HAVE_INET_ATON_FALSE@am__append_12 = inet_aton.c inet_aton.h
|
||||
@HAVE_LOCALTIME_R_FALSE@am__append_13 = localtime_r.c localtime_r.h
|
||||
@HAVE_STRPTIME_FALSE@am__append_14 = strptime.c strptime.h
|
||||
@HAVE_TIMEGM_FALSE@am__append_15 = timegm.c timegm.h
|
||||
@ENABLE_LIBXML2_TRUE@am__append_6 = XML2SAXMetalinkProcessor.cc XML2SAXMetalinkProcessor.h
|
||||
@ENABLE_LIBEXPAT_TRUE@am__append_7 = ExpatMetalinkProcessor.cc ExpatMetalinkProcessor.h
|
||||
@HAVE_ASCTIME_R_FALSE@am__append_8 = asctime_r.c asctime_r.h
|
||||
@HAVE_BASENAME_FALSE@am__append_9 = libgen.c libgen.h
|
||||
@HAVE_GETADDRINFO_FALSE@am__append_10 = getaddrinfo.c getaddrinfo.h
|
||||
@HAVE_GAI_STRERROR_FALSE@am__append_11 = gai_strerror.c gai_strerror.h
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__append_12 = gettimeofday.c gettimeofday.h
|
||||
@HAVE_INET_ATON_FALSE@am__append_13 = inet_aton.c inet_aton.h
|
||||
@HAVE_LOCALTIME_R_FALSE@am__append_14 = localtime_r.c localtime_r.h
|
||||
@HAVE_STRPTIME_FALSE@am__append_15 = strptime.c strptime.h
|
||||
@HAVE_TIMEGM_FALSE@am__append_16 = timegm.c timegm.h
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -406,8 +407,8 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
InitiateConnectionCommand.cc InitiateConnectionCommand.h \
|
||||
FtpFinishDownloadCommand.cc FtpFinishDownloadCommand.h \
|
||||
A2STR.cc A2STR.h RarestPieceSelector.cc RarestPieceSelector.h \
|
||||
AsyncNameResolver.cc AsyncNameResolver.h \
|
||||
IteratableChunkChecksumValidator.cc \
|
||||
Decoder.h GZipDecoder.cc GZipDecoder.h AsyncNameResolver.cc \
|
||||
AsyncNameResolver.h IteratableChunkChecksumValidator.cc \
|
||||
IteratableChunkChecksumValidator.h \
|
||||
IteratableChecksumValidator.cc IteratableChecksumValidator.h \
|
||||
CheckIntegrityCommand.cc CheckIntegrityCommand.h \
|
||||
|
@ -563,14 +564,15 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
gai_strerror.h gettimeofday.c gettimeofday.h inet_aton.c \
|
||||
inet_aton.h localtime_r.c localtime_r.h strptime.c strptime.h \
|
||||
timegm.c timegm.h
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__objects_1 = AsyncNameResolver.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_2 = IteratableChunkChecksumValidator.$(OBJEXT) \
|
||||
@HAVE_LIBZ_TRUE@am__objects_1 = GZipDecoder.$(OBJEXT)
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__objects_2 = AsyncNameResolver.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_3 = IteratableChunkChecksumValidator.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidator.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ CheckIntegrityCommand.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ ChecksumCheckIntegrityEntry.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ messageDigest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ MessageDigestHelper.$(OBJEXT)
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_3 = Data.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_4 = Data.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ Dictionary.$(OBJEXT) List.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ MetaFileUtil.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BencodeVisitor.$(OBJEXT) \
|
||||
|
@ -683,7 +685,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
@ENABLE_BITTORRENT_TRUE@ MSEHandshake.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtLeecherStateChoke.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtSeederStateChoke.$(OBJEXT)
|
||||
@ENABLE_METALINK_TRUE@am__objects_4 = Metalinker.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@am__objects_5 = Metalinker.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorFactory.$(OBJEXT) \
|
||||
|
@ -708,20 +710,20 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroup.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandler.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelper.$(OBJEXT)
|
||||
@ENABLE_LIBXML2_TRUE@am__objects_5 = \
|
||||
@ENABLE_LIBXML2_TRUE@am__objects_6 = \
|
||||
@ENABLE_LIBXML2_TRUE@ XML2SAXMetalinkProcessor.$(OBJEXT)
|
||||
@ENABLE_LIBEXPAT_TRUE@am__objects_6 = \
|
||||
@ENABLE_LIBEXPAT_TRUE@am__objects_7 = \
|
||||
@ENABLE_LIBEXPAT_TRUE@ ExpatMetalinkProcessor.$(OBJEXT)
|
||||
@HAVE_ASCTIME_R_FALSE@am__objects_7 = asctime_r.$(OBJEXT)
|
||||
@HAVE_BASENAME_FALSE@am__objects_8 = libgen.$(OBJEXT)
|
||||
@HAVE_GETADDRINFO_FALSE@am__objects_9 = getaddrinfo.$(OBJEXT)
|
||||
@HAVE_GAI_STRERROR_FALSE@am__objects_10 = gai_strerror.$(OBJEXT)
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__objects_11 = gettimeofday.$(OBJEXT)
|
||||
@HAVE_INET_ATON_FALSE@am__objects_12 = inet_aton.$(OBJEXT)
|
||||
@HAVE_LOCALTIME_R_FALSE@am__objects_13 = localtime_r.$(OBJEXT)
|
||||
@HAVE_STRPTIME_FALSE@am__objects_14 = strptime.$(OBJEXT)
|
||||
@HAVE_TIMEGM_FALSE@am__objects_15 = timegm.$(OBJEXT)
|
||||
am__objects_16 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
@HAVE_ASCTIME_R_FALSE@am__objects_8 = asctime_r.$(OBJEXT)
|
||||
@HAVE_BASENAME_FALSE@am__objects_9 = libgen.$(OBJEXT)
|
||||
@HAVE_GETADDRINFO_FALSE@am__objects_10 = getaddrinfo.$(OBJEXT)
|
||||
@HAVE_GAI_STRERROR_FALSE@am__objects_11 = gai_strerror.$(OBJEXT)
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__objects_12 = gettimeofday.$(OBJEXT)
|
||||
@HAVE_INET_ATON_FALSE@am__objects_13 = inet_aton.$(OBJEXT)
|
||||
@HAVE_LOCALTIME_R_FALSE@am__objects_14 = localtime_r.$(OBJEXT)
|
||||
@HAVE_STRPTIME_FALSE@am__objects_15 = strptime.$(OBJEXT)
|
||||
@HAVE_TIMEGM_FALSE@am__objects_16 = timegm.$(OBJEXT)
|
||||
am__objects_17 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
AbstractCommand.$(OBJEXT) \
|
||||
InitiateConnectionCommandFactory.$(OBJEXT) \
|
||||
DownloadCommand.$(OBJEXT) \
|
||||
|
@ -797,8 +799,8 @@ am__objects_16 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
|||
$(am__objects_5) $(am__objects_6) $(am__objects_7) \
|
||||
$(am__objects_8) $(am__objects_9) $(am__objects_10) \
|
||||
$(am__objects_11) $(am__objects_12) $(am__objects_13) \
|
||||
$(am__objects_14) $(am__objects_15)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_16)
|
||||
$(am__objects_14) $(am__objects_15) $(am__objects_16)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_17)
|
||||
libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS)
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
|
@ -898,6 +900,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
@ -1113,23 +1117,24 @@ SRCS = Socket.h SocketCore.cc SocketCore.h BinaryStream.h Command.cc \
|
|||
InitiateConnectionCommand.cc InitiateConnectionCommand.h \
|
||||
FtpFinishDownloadCommand.cc FtpFinishDownloadCommand.h \
|
||||
A2STR.cc A2STR.h RarestPieceSelector.cc RarestPieceSelector.h \
|
||||
$(am__append_1) $(am__append_2) $(am__append_3) \
|
||||
Decoder.h $(am__append_1) $(am__append_2) $(am__append_3) \
|
||||
$(am__append_4) $(am__append_5) $(am__append_6) \
|
||||
$(am__append_7) $(am__append_8) $(am__append_9) \
|
||||
$(am__append_10) $(am__append_11) $(am__append_12) \
|
||||
$(am__append_13) $(am__append_14) $(am__append_15)
|
||||
$(am__append_13) $(am__append_14) $(am__append_15) \
|
||||
$(am__append_16)
|
||||
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@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@ #-lprofiler
|
||||
|
||||
#aria2c_LDFLAGS = -pg
|
||||
AM_CPPFLAGS = -Wall\
|
||||
-I../lib -I../intl -I$(top_srcdir)/intl\
|
||||
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
|
||||
@LIBARES_CPPFLAGS@ @LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
|
||||
all: all-am
|
||||
|
||||
|
@ -1365,6 +1370,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FtpNegotiationCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FtpTunnelRequestCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FtpTunnelResponseCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GZipDecoder.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrowSegment.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HandshakeExtensionMessage.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HashMetalinkParserState.Po@am__quote@
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
#include "GZipDecoder.h"
|
||||
#include "Exception.h"
|
||||
#include "Util.h"
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
# include "MessageDigestHelper.h"
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class GZipDecoderTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(GZipDecoderTest);
|
||||
CPPUNIT_TEST(testDecode);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
public:
|
||||
void setUp() {}
|
||||
|
||||
void tearDown() {}
|
||||
|
||||
void testDecode();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(GZipDecoderTest);
|
||||
|
||||
void GZipDecoderTest::testDecode()
|
||||
{
|
||||
GZipDecoder decoder;
|
||||
decoder.init();
|
||||
|
||||
std::string outfile("/tmp/aria2_GZipDecoderTest_testDecode");
|
||||
|
||||
char buf[4096];
|
||||
std::ifstream in("gzip_decode_test.gz");
|
||||
std::ofstream out(outfile.c_str());
|
||||
while(in) {
|
||||
in.read(buf, sizeof(buf));
|
||||
|
||||
std::string r = decoder.decode
|
||||
(reinterpret_cast<const unsigned char*>(buf), in.gcount());
|
||||
|
||||
out.write(r.data(), r.size());
|
||||
}
|
||||
CPPUNIT_ASSERT(decoder.finished());
|
||||
decoder.release();
|
||||
|
||||
out.close();
|
||||
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("8b577b33c0411b2be9d4fa74c7402d54a8d21f96"),
|
||||
MessageDigestHelper::digest(MessageDigestContext::SHA1,
|
||||
outfile));
|
||||
#endif // ENABLE_MESSAGE_DIGEST
|
||||
}
|
||||
|
||||
} // namespace aria2
|
|
@ -26,6 +26,7 @@ class HttpRequestTest : public CppUnit::TestFixture {
|
|||
CPPUNIT_TEST(testUserAgent);
|
||||
CPPUNIT_TEST(testAddHeader);
|
||||
CPPUNIT_TEST(testAddAcceptType);
|
||||
CPPUNIT_TEST(testEnableAcceptEncoding);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
|
||||
|
@ -43,6 +44,7 @@ public:
|
|||
void testUserAgent();
|
||||
void testAddHeader();
|
||||
void testAddAcceptType();
|
||||
void testEnableAcceptEncoding();
|
||||
};
|
||||
|
||||
|
||||
|
@ -119,6 +121,7 @@ void HttpRequestTest::testCreateRequest()
|
|||
SharedHandle<Segment> segment(new PiecedSegment(1024, p));
|
||||
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.setSegment(segment);
|
||||
|
||||
|
@ -344,6 +347,7 @@ void HttpRequestTest::testCreateRequest_ftp()
|
|||
SharedHandle<Piece> p(new Piece(0, 1024*1024));
|
||||
SharedHandle<Segment> segment
|
||||
(new PiecedSegment(1024*1024, p));
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.setSegment(segment);
|
||||
|
||||
|
@ -402,6 +406,7 @@ void HttpRequestTest::testCreateRequest_with_cookie()
|
|||
|
||||
HttpRequest httpRequest;
|
||||
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.setSegment(segment);
|
||||
|
||||
|
@ -466,6 +471,7 @@ void HttpRequestTest::testCreateRequest_query()
|
|||
SharedHandle<Request> request(new Request());
|
||||
request->setUrl("http://localhost/wiki?id=9ad5109a-b8a5-4edf-9373-56a1c34ae138");
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
|
||||
std::string expectedText =
|
||||
|
@ -596,6 +602,7 @@ void HttpRequestTest::testUserAgent()
|
|||
SharedHandle<Segment> segment(new PiecedSegment(1024, p));
|
||||
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.setSegment(segment);
|
||||
httpRequest.setUserAgent("aria2 (Linux)");
|
||||
|
@ -626,6 +633,7 @@ void HttpRequestTest::testAddHeader()
|
|||
request->setUrl("http://localhost/archives/aria2-1.0.0.tar.bz2");
|
||||
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.addHeader("X-ARIA2: v0.13\nX-ARIA2-DISTRIBUTE: enabled\n");
|
||||
|
||||
|
@ -652,6 +660,7 @@ void HttpRequestTest::testAddAcceptType()
|
|||
request->setUrl("http://localhost/archives/aria2-1.0.0.tar.bz2");
|
||||
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.disableContentEncoding();
|
||||
httpRequest.setRequest(request);
|
||||
httpRequest.addAcceptType(&acceptTypes[0], &acceptTypes[arrayLength(acceptTypes)]);
|
||||
|
||||
|
@ -668,4 +677,34 @@ void HttpRequestTest::testAddAcceptType()
|
|||
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
|
||||
}
|
||||
|
||||
void HttpRequestTest::testEnableAcceptEncoding()
|
||||
{
|
||||
SharedHandle<Request> request(new Request());
|
||||
request->setUrl("http://localhost/archives/aria2-1.0.0.tar.bz2");
|
||||
|
||||
HttpRequest httpRequest;
|
||||
httpRequest.setRequest(request);
|
||||
|
||||
std::string acceptEncodings;
|
||||
#ifdef HAVE_LIBZ
|
||||
acceptEncodings += "deflate, gzip";
|
||||
#endif // HAVE_LIBZ
|
||||
|
||||
std::string expectedText =
|
||||
"GET /archives/aria2-1.0.0.tar.bz2 HTTP/1.1\r\n"
|
||||
"User-Agent: aria2\r\n"
|
||||
"Accept: */*\r\n";
|
||||
if(!acceptEncodings.empty()) {
|
||||
expectedText += "Accept-Encoding: "+acceptEncodings+"\r\n";
|
||||
}
|
||||
expectedText +=
|
||||
"Host: localhost\r\n"
|
||||
"Pragma: no-cache\r\n"
|
||||
"Cache-Control: no-cache\r\n"
|
||||
"Connection: close\r\n"
|
||||
"\r\n";
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(expectedText, httpRequest.createRequest());
|
||||
}
|
||||
|
||||
} // namespace aria2
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include "HttpHeader.h"
|
||||
#include "HttpRequest.h"
|
||||
#include "Exception.h"
|
||||
#include "A2STR.h"
|
||||
#include "Decoder.h"
|
||||
#include <iostream>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
|
@ -29,6 +31,9 @@ class HttpResponseTest : public CppUnit::TestFixture {
|
|||
CPPUNIT_TEST(testIsTransferEncodingSpecified);
|
||||
CPPUNIT_TEST(testGetTransferEncoding);
|
||||
CPPUNIT_TEST(testGetTransferDecoder);
|
||||
CPPUNIT_TEST(testIsContentEncodingSpecified);
|
||||
CPPUNIT_TEST(testGetContentEncoding);
|
||||
CPPUNIT_TEST(testGetContentEncodingDecoder);
|
||||
CPPUNIT_TEST(testValidateResponse);
|
||||
CPPUNIT_TEST(testValidateResponse_good_range);
|
||||
CPPUNIT_TEST(testValidateResponse_bad_range);
|
||||
|
@ -54,6 +59,9 @@ public:
|
|||
void testIsTransferEncodingSpecified();
|
||||
void testGetTransferEncoding();
|
||||
void testGetTransferDecoder();
|
||||
void testIsContentEncodingSpecified();
|
||||
void testGetContentEncoding();
|
||||
void testGetContentEncodingDecoder();
|
||||
void testValidateResponse();
|
||||
void testValidateResponse_good_range();
|
||||
void testValidateResponse_bad_range();
|
||||
|
@ -240,6 +248,68 @@ void HttpResponseTest::testGetTransferDecoder()
|
|||
CPPUNIT_ASSERT(!httpResponse.getTransferDecoder().isNull());
|
||||
}
|
||||
|
||||
void HttpResponseTest::testIsContentEncodingSpecified()
|
||||
{
|
||||
HttpResponse httpResponse;
|
||||
SharedHandle<HttpHeader> httpHeader(new HttpHeader());
|
||||
|
||||
httpResponse.setHttpHeader(httpHeader);
|
||||
|
||||
CPPUNIT_ASSERT(!httpResponse.isContentEncodingSpecified());
|
||||
|
||||
httpHeader->put("Content-Encoding", "gzip");
|
||||
|
||||
CPPUNIT_ASSERT(httpResponse.isContentEncodingSpecified());
|
||||
}
|
||||
|
||||
void HttpResponseTest::testGetContentEncoding()
|
||||
{
|
||||
HttpResponse httpResponse;
|
||||
SharedHandle<HttpHeader> httpHeader(new HttpHeader());
|
||||
|
||||
httpResponse.setHttpHeader(httpHeader);
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(A2STR::NIL, httpResponse.getContentEncoding());
|
||||
|
||||
httpHeader->put("Content-Encoding", "gzip");
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("gzip"), httpResponse.getContentEncoding());
|
||||
}
|
||||
|
||||
void HttpResponseTest::testGetContentEncodingDecoder()
|
||||
{
|
||||
HttpResponse httpResponse;
|
||||
SharedHandle<HttpHeader> httpHeader(new HttpHeader());
|
||||
|
||||
httpResponse.setHttpHeader(httpHeader);
|
||||
|
||||
CPPUNIT_ASSERT(httpResponse.getContentEncodingDecoder().isNull());
|
||||
|
||||
#ifdef HAVE_LIBZ
|
||||
httpHeader->put("Content-Encoding", "gzip");
|
||||
{
|
||||
SharedHandle<Decoder> decoder = httpResponse.getContentEncodingDecoder();
|
||||
CPPUNIT_ASSERT(!decoder.isNull());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("GZipDecoder"), decoder->getName());
|
||||
}
|
||||
httpHeader.reset(new HttpHeader());
|
||||
httpResponse.setHttpHeader(httpHeader);
|
||||
httpHeader->put("Content-Encoding", "deflate");
|
||||
{
|
||||
SharedHandle<Decoder> decoder = httpResponse.getContentEncodingDecoder();
|
||||
CPPUNIT_ASSERT(!decoder.isNull());
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("GZipDecoder"), decoder->getName());
|
||||
}
|
||||
#endif // HAVE_LIBZ
|
||||
httpHeader.reset(new HttpHeader());
|
||||
httpResponse.setHttpHeader(httpHeader);
|
||||
httpHeader->put("Content-Encoding", "bzip2");
|
||||
{
|
||||
SharedHandle<Decoder> decoder = httpResponse.getContentEncodingDecoder();
|
||||
CPPUNIT_ASSERT(decoder.isNull());
|
||||
}
|
||||
}
|
||||
|
||||
void HttpResponseTest::testValidateResponse()
|
||||
{
|
||||
HttpResponse httpResponse;
|
||||
|
|
|
@ -54,6 +54,10 @@ aria2c_SOURCES = AllTest.cc\
|
|||
ExceptionTest.cc\
|
||||
DownloadHandlerFactoryTest.cc
|
||||
|
||||
if HAVE_LIBZ
|
||||
aria2c_SOURCES += GZipDecoderTest.cc
|
||||
endif # HAVE_LIBZ
|
||||
|
||||
if ENABLE_MESSAGE_DIGEST
|
||||
aria2c_SOURCES += MessageDigestHelperTest.cc\
|
||||
IteratableChunkChecksumValidatorTest.cc\
|
||||
|
@ -170,7 +174,7 @@ endif # ENABLE_METALINK
|
|||
aria2c_LDADD = ../src/libaria2c.a\
|
||||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
AM_CPPFLAGS = -Wall\
|
||||
${CPPUNIT_CFLAGS}\
|
||||
|
@ -178,7 +182,7 @@ AM_CPPFLAGS = -Wall\
|
|||
-I../lib -I../intl -I$(top_srcdir)/intl\
|
||||
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
|
||||
@LIBARES_CPPFLAGS@ @LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
|
||||
EXTRA_DIST = 4096chunk.txt\
|
||||
chunkChecksumTestFile250.txt\
|
||||
|
@ -188,6 +192,7 @@ EXTRA_DIST = 4096chunk.txt\
|
|||
file2r.txt\
|
||||
file3r.txt\
|
||||
filelist1.txt\
|
||||
gzip_decode_test.gz\
|
||||
load-nonBt.aria2\
|
||||
load.aria2\
|
||||
malformed.netrc\
|
||||
|
|
|
@ -34,11 +34,12 @@ host_triplet = @host@
|
|||
target_triplet = @target@
|
||||
TESTS = aria2c$(EXEEXT)
|
||||
check_PROGRAMS = $(am__EXEEXT_1)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_1 = MessageDigestHelperTest.cc\
|
||||
@HAVE_LIBZ_TRUE@am__append_1 = GZipDecoderTest.cc
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_2 = MessageDigestHelperTest.cc\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChunkChecksumValidatorTest.cc\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidatorTest.cc
|
||||
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_2 = BtAllowedFastMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_3 = BtAllowedFastMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtBitfieldMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtCancelMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtChokeMessageTest.cc\
|
||||
|
@ -130,7 +131,7 @@ check_PROGRAMS = $(am__EXEEXT_1)
|
|||
@ENABLE_BITTORRENT_TRUE@ MockPieceStorage.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ RarestPieceSelectorTest.cc
|
||||
|
||||
@ENABLE_METALINK_TRUE@am__append_3 = MetalinkerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@am__append_4 = MetalinkerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntryTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroupTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.cc\
|
||||
|
@ -139,26 +140,26 @@ check_PROGRAMS = $(am__EXEEXT_1)
|
|||
@ENABLE_METALINK_TRUE@ MetalinkProcessorTest.cc
|
||||
|
||||
subdir = test
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ChangeLog
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \
|
||||
$(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc2.m4 \
|
||||
$(top_srcdir)/m4/glibc21.m4 $(top_srcdir)/m4/iconv.m4 \
|
||||
$(top_srcdir)/m4/intdiv0.m4 $(top_srcdir)/m4/intl.m4 \
|
||||
$(top_srcdir)/m4/intlmacosx.m4 $(top_srcdir)/m4/intmax.m4 \
|
||||
$(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.m4 \
|
||||
$(top_srcdir)/m4/codeset.m4 $(top_srcdir)/m4/gettext.m4 \
|
||||
$(top_srcdir)/m4/glibc2.m4 $(top_srcdir)/m4/glibc21.m4 \
|
||||
$(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \
|
||||
$(top_srcdir)/m4/intl.m4 $(top_srcdir)/m4/intlmacosx.m4 \
|
||||
$(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \
|
||||
$(top_srcdir)/m4/inttypes_h.m4 $(top_srcdir)/m4/lcmessage.m4 \
|
||||
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
|
||||
$(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libares.m4 \
|
||||
$(top_srcdir)/m4/libcares.m4 $(top_srcdir)/m4/libexpat.m4 \
|
||||
$(top_srcdir)/m4/lock.m4 $(top_srcdir)/m4/longlong.m4 \
|
||||
$(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/printf-posix.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/size_max.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/visibility.m4 $(top_srcdir)/m4/wchar_t.m4 \
|
||||
$(top_srcdir)/m4/wint_t.m4 $(top_srcdir)/m4/xsize.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libz.m4 $(top_srcdir)/m4/lock.m4 \
|
||||
$(top_srcdir)/m4/longlong.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/size_max.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/visibility.m4 \
|
||||
$(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \
|
||||
$(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
|
@ -186,7 +187,8 @@ am__aria2c_SOURCES_DIST = AllTest.cc SocketCoreTest.cc \
|
|||
FeatureConfigTest.cc SpeedCalcTest.cc MultiDiskAdaptorTest.cc \
|
||||
MultiFileAllocationIteratorTest.cc FixedNumberRandomizer.h \
|
||||
ProtocolDetectorTest.cc StringFormatTest.cc ExceptionTest.cc \
|
||||
DownloadHandlerFactoryTest.cc MessageDigestHelperTest.cc \
|
||||
DownloadHandlerFactoryTest.cc GZipDecoderTest.cc \
|
||||
MessageDigestHelperTest.cc \
|
||||
IteratableChunkChecksumValidatorTest.cc \
|
||||
IteratableChecksumValidatorTest.cc BtAllowedFastMessageTest.cc \
|
||||
BtBitfieldMessageTest.cc BtCancelMessageTest.cc \
|
||||
|
@ -235,11 +237,12 @@ am__aria2c_SOURCES_DIST = AllTest.cc SocketCoreTest.cc \
|
|||
MetalinkEntryTest.cc Metalink2RequestGroupTest.cc \
|
||||
MetalinkPostDownloadHandlerTest.cc MetalinkHelperTest.cc \
|
||||
MetalinkParserControllerTest.cc MetalinkProcessorTest.cc
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_1 = \
|
||||
@HAVE_LIBZ_TRUE@am__objects_1 = GZipDecoderTest.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_2 = \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ MessageDigestHelperTest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChunkChecksumValidatorTest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidatorTest.$(OBJEXT)
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_2 = \
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_3 = \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtAllowedFastMessageTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtBitfieldMessageTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtCancelMessageTest.$(OBJEXT) \
|
||||
|
@ -313,7 +316,7 @@ am__aria2c_SOURCES_DIST = AllTest.cc SocketCoreTest.cc \
|
|||
@ENABLE_BITTORRENT_TRUE@ MSEHandshakeTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ DHTUtilTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ RarestPieceSelectorTest.$(OBJEXT)
|
||||
@ENABLE_METALINK_TRUE@am__objects_3 = MetalinkerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@am__objects_4 = MetalinkerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntryTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroupTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.$(OBJEXT) \
|
||||
|
@ -349,7 +352,8 @@ am_aria2c_OBJECTS = AllTest.$(OBJEXT) SocketCoreTest.$(OBJEXT) \
|
|||
MultiFileAllocationIteratorTest.$(OBJEXT) \
|
||||
ProtocolDetectorTest.$(OBJEXT) StringFormatTest.$(OBJEXT) \
|
||||
ExceptionTest.$(OBJEXT) DownloadHandlerFactoryTest.$(OBJEXT) \
|
||||
$(am__objects_1) $(am__objects_2) $(am__objects_3)
|
||||
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_4)
|
||||
aria2c_OBJECTS = $(am_aria2c_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
aria2c_DEPENDENCIES = ../src/libaria2c.a $(am__DEPENDENCIES_1)
|
||||
|
@ -444,6 +448,8 @@ LIBPTH = @LIBPTH@
|
|||
LIBPTH_PREFIX = @LIBPTH_PREFIX@
|
||||
LIBS = @LIBS@
|
||||
LIBTHREAD = @LIBTHREAD@
|
||||
LIBZ_CPPFLAGS = @LIBZ_CPPFLAGS@
|
||||
LIBZ_LIBS = @LIBZ_LIBS@
|
||||
LTLIBC = @LTLIBC@
|
||||
LTLIBICONV = @LTLIBICONV@
|
||||
LTLIBINTL = @LTLIBINTL@
|
||||
|
@ -562,14 +568,14 @@ aria2c_SOURCES = AllTest.cc SocketCoreTest.cc array_funTest.cc \
|
|||
MultiFileAllocationIteratorTest.cc FixedNumberRandomizer.h \
|
||||
ProtocolDetectorTest.cc StringFormatTest.cc ExceptionTest.cc \
|
||||
DownloadHandlerFactoryTest.cc $(am__append_1) $(am__append_2) \
|
||||
$(am__append_3)
|
||||
$(am__append_3) $(am__append_4)
|
||||
|
||||
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
||||
#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
|
||||
aria2c_LDADD = ../src/libaria2c.a\
|
||||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
|
||||
AM_CPPFLAGS = -Wall\
|
||||
|
@ -578,7 +584,7 @@ AM_CPPFLAGS = -Wall\
|
|||
-I../lib -I../intl -I$(top_srcdir)/intl\
|
||||
@LIBGNUTLS_CFLAGS@ @LIBGCRYPT_CFLAGS@ @OPENSSL_CFLAGS@ @XML_CPPFLAGS@\
|
||||
@LIBARES_CPPFLAGS@ @LIBCARES_CPPFLAGS@ @LIBEXPAT_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
|
||||
EXTRA_DIST = 4096chunk.txt\
|
||||
chunkChecksumTestFile250.txt\
|
||||
|
@ -588,6 +594,7 @@ EXTRA_DIST = 4096chunk.txt\
|
|||
file2r.txt\
|
||||
file3r.txt\
|
||||
filelist1.txt\
|
||||
gzip_decode_test.gz\
|
||||
load-nonBt.aria2\
|
||||
load.aria2\
|
||||
malformed.netrc\
|
||||
|
@ -723,6 +730,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FeatureConfigTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileEntryTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GZipDecoderTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/GrowSegmentTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HandshakeExtensionMessageTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/HelpItemTest.Po@am__quote@
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue