mirror of
https://github.com/aria2/aria2.git
synced 2024-11-24 02:23:38 +08:00
2007-12-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Fixed possible memory leak when an exception is thrown. * src/XML2SAXMetalinkProcessor.cc Added Expat support. If both libxml2 and Expat are installed, then libxml2 is used by default. MetalinkProcessorFactory chooses from XML2SAXMetalinkProcessor and ExpatMetalinkProcessor according to the configuration. * src/ExpatMetalinkProcessor.{h, cc} * src/main.cc: Removed libxml2 specific header and init/free function. * src/MetalinkProcessorFactory.{h, cc} * src/MetalinkHelper.cc * src/Metalinker.h: Removed unnecessary libxml2 header. * src/MetalinkProcessor.h * test/XML2SAXMetalinkProcessorTest.cc: Removed because MetalinkProcessorTest is used instead. * test/MetalinkProcessorTest.cc: Added. It is actually the same with XML2SAXMetalinkProcessor, replaced XML2SAXMetalinkProcessor with MetalinkProcessorFactory::newInstance(). * m4/libexpat.m4 * configure.ac: Added configuration options for libexpat.
This commit is contained in:
parent
e870ab2622
commit
3ea4fe447a
23
ChangeLog
23
ChangeLog
@ -1,3 +1,26 @@
|
||||
2007-12-14 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Fixed possible memory leak when an exception is thrown.
|
||||
* src/XML2SAXMetalinkProcessor.cc
|
||||
|
||||
Added Expat support. If both libxml2 and Expat are installed, then
|
||||
libxml2 is used by default.
|
||||
MetalinkProcessorFactory chooses from XML2SAXMetalinkProcessor and
|
||||
ExpatMetalinkProcessor according to the configuration.
|
||||
* src/ExpatMetalinkProcessor.{h, cc}
|
||||
* src/main.cc: Removed libxml2 specific header and init/free function.
|
||||
* src/MetalinkProcessorFactory.{h, cc}
|
||||
* src/MetalinkHelper.cc
|
||||
* src/Metalinker.h: Removed unnecessary libxml2 header.
|
||||
* src/MetalinkProcessor.h
|
||||
* test/XML2SAXMetalinkProcessorTest.cc: Removed because
|
||||
MetalinkProcessorTest is used instead.
|
||||
* test/MetalinkProcessorTest.cc: Added. It is actually the same with
|
||||
XML2SAXMetalinkProcessor, replaced XML2SAXMetalinkProcessor with
|
||||
MetalinkProcessorFactory::newInstance().
|
||||
* m4/libexpat.m4
|
||||
* configure.ac: Added configuration options for libexpat.
|
||||
|
||||
2007-12-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Disabled -s option in metalink download.
|
||||
|
15
Makefile.in
15
Makefile.in
@ -52,10 +52,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.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/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libexpat.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.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 \
|
||||
@ -119,6 +120,10 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
|
||||
ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
|
||||
ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
|
||||
ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
|
||||
ENABLE_LIBEXPAT_FALSE = @ENABLE_LIBEXPAT_FALSE@
|
||||
ENABLE_LIBEXPAT_TRUE = @ENABLE_LIBEXPAT_TRUE@
|
||||
ENABLE_LIBXML2_FALSE = @ENABLE_LIBXML2_FALSE@
|
||||
ENABLE_LIBXML2_TRUE = @ENABLE_LIBXML2_TRUE@
|
||||
ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
|
||||
ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
|
||||
ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
|
||||
@ -158,6 +163,8 @@ LIBARES_CPPFLAGS = @LIBARES_CPPFLAGS@
|
||||
LIBARES_LIBS = @LIBARES_LIBS@
|
||||
LIBCARES_CPPFLAGS = @LIBCARES_CPPFLAGS@
|
||||
LIBCARES_LIBS = @LIBCARES_LIBS@
|
||||
LIBEXPAT_CPPFLAGS = @LIBEXPAT_CPPFLAGS@
|
||||
LIBEXPAT_LIBS = @LIBEXPAT_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
|
26
README
26
README
@ -36,11 +36,17 @@ aria2 is in very early development stage. Currently it has following features:
|
||||
-------------
|
||||
In order to enable HTTPS support, you need GNU TLS or OpenSSL.
|
||||
In order to enable BitTorrent support, you need GNU TLS+libgcrypt or OpenSSL.
|
||||
In order to enable Metalink support, you need libxml2. Optionally GNU TLS+
|
||||
libgcrypt or OpenSSL are required for checksum checking support(MD5, SHA1).
|
||||
In order to enable Metalink support, you need libxml2 or Expat. Optionally
|
||||
GNU TLS+libgcrypt or OpenSSL are required for checksum checking support(MD5,
|
||||
SHA1, SHA256).
|
||||
|
||||
GNU TLS has precedence over OpenSSL if both libraries are installed.
|
||||
If you prefer OpenSSL, run configure with "--without-gnutls".
|
||||
Note;;
|
||||
GNU TLS has precedence over OpenSSL if both libraries are installed.
|
||||
If you prefer OpenSSL, run configure with "--without-gnutls".
|
||||
|
||||
Note;;
|
||||
libxml2 has precedence over Expat if both libraries are installed.
|
||||
If you prefer Expat, run configure with "--without-libxml2".
|
||||
|
||||
You can disable BitTorrent, Metalink support by providing --disable-bittorrent,
|
||||
--disable-metalink respectively to configure script.
|
||||
@ -63,6 +69,9 @@ packages(package name may vary depending on the distribution you use):
|
||||
You can use libssl-dev instead of libgnutls-dev,libgpg-error-dev,libgcrypt-dev:
|
||||
* libssl-dev (Required for HTTPS, BitTorrent support)
|
||||
|
||||
You can use libexpat1-dev instead of libxml2-dev:
|
||||
* libexpat1-dev (Required for Metalink support)
|
||||
|
||||
The build process is fairly standard way for *nix programs:
|
||||
|
||||
$ ./configure
|
||||
@ -111,11 +120,12 @@ rate is low.
|
||||
The current implementation supports HTTP/FTP/BitTorrent.
|
||||
The other P2P protocols are ignored.
|
||||
|
||||
For checksum checking, both MD5 and SHA1 are supported. If both values are
|
||||
provided, then aria2 uses SHA1. If checksum checking is failed, aria2 doesn't
|
||||
retry the download and just exits with non-zero return code.
|
||||
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.
|
||||
|
||||
The supported user preferences are version, language and os.
|
||||
The supported user preferences are version, language, location, protocol and
|
||||
os.
|
||||
|
||||
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
|
||||
|
1
aclocal.m4
vendored
1
aclocal.m4
vendored
@ -1415,6 +1415,7 @@ m4_include([m4/lib-link.m4])
|
||||
m4_include([m4/lib-prefix.m4])
|
||||
m4_include([m4/libares.m4])
|
||||
m4_include([m4/libcares.m4])
|
||||
m4_include([m4/libexpat.m4])
|
||||
m4_include([m4/nls.m4])
|
||||
m4_include([m4/openssl.m4])
|
||||
m4_include([m4/po.m4])
|
||||
|
@ -141,6 +141,9 @@
|
||||
/* Define 1 if ares_host_callback accepts timeouts(c-ares >= 1.5) */
|
||||
#undef HAVE_LIBCARES1_5
|
||||
|
||||
/* Define to 1 if you have libexpat. */
|
||||
#undef HAVE_LIBEXPAT
|
||||
|
||||
/* Define to 1 if you have libgcrypt. */
|
||||
#undef HAVE_LIBGCRYPT
|
||||
|
||||
@ -433,6 +436,11 @@
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
|
177
configure
vendored
177
configure
vendored
@ -717,6 +717,8 @@ YFLAGS
|
||||
XML2_CONFIG
|
||||
XML_CPPFLAGS
|
||||
XML_LIBS
|
||||
LIBEXPAT_LIBS
|
||||
LIBEXPAT_CPPFLAGS
|
||||
LIBGNUTLS_CONFIG
|
||||
LIBGNUTLS_CFLAGS
|
||||
LIBGNUTLS_LIBS
|
||||
@ -735,6 +737,10 @@ ENABLE_BITTORRENT_TRUE
|
||||
ENABLE_BITTORRENT_FALSE
|
||||
ENABLE_METALINK_TRUE
|
||||
ENABLE_METALINK_FALSE
|
||||
ENABLE_LIBXML2_TRUE
|
||||
ENABLE_LIBXML2_FALSE
|
||||
ENABLE_LIBEXPAT_TRUE
|
||||
ENABLE_LIBEXPAT_FALSE
|
||||
ENABLE_ASYNC_DNS_TRUE
|
||||
ENABLE_ASYNC_DNS_FALSE
|
||||
ALLOCA
|
||||
@ -1392,10 +1398,12 @@ Optional Packages:
|
||||
--with-gnutls use gnutls library if installed. Default: yes
|
||||
--with-openssl use openssl library if installed. Default: yes
|
||||
--with-libxml2 use libxml2 library if installed. Default: yes
|
||||
--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-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)
|
||||
--with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)
|
||||
--with-libgcrypt-prefix=PFX
|
||||
prefix where LIBGCRYPT is installed (optional)
|
||||
@ -2634,6 +2642,14 @@ else
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-libexpat was given.
|
||||
if test "${with_libexpat+set}" = set; then
|
||||
withval=$with_libexpat; with_libexpat=$withval
|
||||
else
|
||||
with_libexpat=yes
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --with-libares was given.
|
||||
if test "${with_libares+set}" = set; then
|
||||
withval=$with_libares; with_libares=$withval
|
||||
@ -4460,6 +4476,14 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
|
||||
# Check for GNU library
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define _GNU_SOURCE 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
|
||||
# Checks for libraries.
|
||||
if test "x$with_libxml2" = "xyes"; then
|
||||
|
||||
@ -4785,6 +4809,113 @@ _ACEOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
|
||||
|
||||
|
||||
# Check whether --with-libexpat-prefix was given.
|
||||
if test "${with_libexpat_prefix+set}" = set; then
|
||||
withval=$with_libexpat_prefix; libexpat_prefix=$withval
|
||||
else
|
||||
libexpat_prefix=""
|
||||
fi
|
||||
|
||||
|
||||
if test "x$libexpat_prefix" = "x"; then
|
||||
libexpat_prefix="/usr"
|
||||
fi
|
||||
|
||||
libexpat_prefix_lib=$libexpat_prefix/lib
|
||||
libexpat_prefix_include=$libexpat_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$libexpat_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$libexpat_prefix_include $CPPFLAGS"
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for XML_ParserCreate in -lexpat" >&5
|
||||
echo $ECHO_N "checking for XML_ParserCreate in -lexpat... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_expat_XML_ParserCreate+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lexpat $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 XML_ParserCreate ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return XML_ParserCreate ();
|
||||
;
|
||||
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_expat_XML_ParserCreate=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_expat_XML_ParserCreate=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_expat_XML_ParserCreate" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_expat_XML_ParserCreate" >&6; }
|
||||
if test $ac_cv_lib_expat_XML_ParserCreate = yes; then
|
||||
have_libexpat=yes
|
||||
fi
|
||||
|
||||
if test "x$have_libexpat" = "xyes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_LIBEXPAT 1
|
||||
_ACEOF
|
||||
|
||||
LIBEXPAT_LIBS="-L$libexpat_prefix_lib -lexpat"
|
||||
LIBEXPAT_CPPFLAGS="-I$libexpat_prefix_include"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if test "x$with_gnutls" = "xyes"; then
|
||||
|
||||
# Check whether --with-libgnutls-prefix was given.
|
||||
@ -5922,7 +6053,7 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
|
||||
if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") && test "x$enable_metalink" = "xyes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define ENABLE_METALINK 1
|
||||
@ -5952,6 +6083,27 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "x$enable_metalink" = "xyes" && test "x$have_libxml2" = "xyes"; then
|
||||
ENABLE_LIBXML2_TRUE=
|
||||
ENABLE_LIBXML2_FALSE='#'
|
||||
else
|
||||
ENABLE_LIBXML2_TRUE='#'
|
||||
ENABLE_LIBXML2_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if test "x$enable_metalink" = "xyes" && test "x$have_libexpat" = "xyes"; then
|
||||
ENABLE_LIBEXPAT_TRUE=
|
||||
ENABLE_LIBEXPAT_FALSE='#'
|
||||
else
|
||||
ENABLE_LIBEXPAT_TRUE='#'
|
||||
ENABLE_LIBEXPAT_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
if test "x$have_libcares" = "xyes" || test "x$have_libares" = "xyes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
@ -13963,6 +14115,20 @@ echo "$as_me: error: conditional \"ENABLE_METALINK\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${ENABLE_LIBXML2_TRUE}" && test -z "${ENABLE_LIBXML2_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"ENABLE_LIBXML2\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"ENABLE_LIBXML2\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${ENABLE_LIBEXPAT_TRUE}" && test -z "${ENABLE_LIBEXPAT_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"ENABLE_LIBEXPAT\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"ENABLE_LIBEXPAT\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&2;}
|
||||
{ (exit 1); exit 1; }; }
|
||||
fi
|
||||
if test -z "${ENABLE_ASYNC_DNS_TRUE}" && test -z "${ENABLE_ASYNC_DNS_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"ENABLE_ASYNC_DNS\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
@ -14791,6 +14957,8 @@ YFLAGS!$YFLAGS$ac_delim
|
||||
XML2_CONFIG!$XML2_CONFIG$ac_delim
|
||||
XML_CPPFLAGS!$XML_CPPFLAGS$ac_delim
|
||||
XML_LIBS!$XML_LIBS$ac_delim
|
||||
LIBEXPAT_LIBS!$LIBEXPAT_LIBS$ac_delim
|
||||
LIBEXPAT_CPPFLAGS!$LIBEXPAT_CPPFLAGS$ac_delim
|
||||
LIBGNUTLS_CONFIG!$LIBGNUTLS_CONFIG$ac_delim
|
||||
LIBGNUTLS_CFLAGS!$LIBGNUTLS_CFLAGS$ac_delim
|
||||
LIBGNUTLS_LIBS!$LIBGNUTLS_LIBS$ac_delim
|
||||
@ -14809,6 +14977,10 @@ ENABLE_BITTORRENT_TRUE!$ENABLE_BITTORRENT_TRUE$ac_delim
|
||||
ENABLE_BITTORRENT_FALSE!$ENABLE_BITTORRENT_FALSE$ac_delim
|
||||
ENABLE_METALINK_TRUE!$ENABLE_METALINK_TRUE$ac_delim
|
||||
ENABLE_METALINK_FALSE!$ENABLE_METALINK_FALSE$ac_delim
|
||||
ENABLE_LIBXML2_TRUE!$ENABLE_LIBXML2_TRUE$ac_delim
|
||||
ENABLE_LIBXML2_FALSE!$ENABLE_LIBXML2_FALSE$ac_delim
|
||||
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
|
||||
ALLOCA!$ALLOCA$ac_delim
|
||||
@ -14857,7 +15029,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` = 69; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 75; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
@ -15561,6 +15733,7 @@ echo "LIBS: $LIBS"
|
||||
echo "GnuTLS: $have_libgnutls"
|
||||
echo "OpenSSL: $have_openssl"
|
||||
echo "LibXML2: $have_libxml2"
|
||||
echo "LibExpat: $have_libexpat"
|
||||
echo "LibAres: $have_libares"
|
||||
echo "LibCares: $have_libcares"
|
||||
echo "Bittorrent: $enable_bittorrent"
|
||||
|
14
configure.ac
14
configure.ac
@ -27,6 +27,7 @@ AC_SUBST(localedir)
|
||||
AC_ARG_WITH([gnutls], [ --with-gnutls use gnutls library if installed. Default: yes], [with_gnutls=$withval], [with_gnutls=yes])
|
||||
AC_ARG_WITH([openssl], [ --with-openssl use openssl library if installed. Default: yes], [with_openssl=$withval], [with_openssl=yes])
|
||||
AC_ARG_WITH([libxml2], [ --with-libxml2 use libxml2 library if installed. Default: yes], [with_libxml2=$withval], [with_libxml2=yes])
|
||||
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])
|
||||
|
||||
@ -43,6 +44,9 @@ AC_PROG_YACC
|
||||
# Setting language choice
|
||||
AC_LANG([C++])
|
||||
|
||||
# Check for GNU library
|
||||
AC_GNU_SOURCE
|
||||
|
||||
# Checks for libraries.
|
||||
if test "x$with_libxml2" = "xyes"; then
|
||||
AM_PATH_XML2([2.6.24], [have_libxml2=yes])
|
||||
@ -51,6 +55,10 @@ if test "x$with_libxml2" = "xyes"; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
|
||||
AM_PATH_LIBEXPAT
|
||||
fi
|
||||
|
||||
if test "x$with_gnutls" = "xyes"; then
|
||||
AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
|
||||
if test "x$have_libgnutls" = "xyes"; then
|
||||
@ -100,7 +108,7 @@ else
|
||||
AM_CONDITIONAL([ENABLE_BITTORRENT], false)
|
||||
fi
|
||||
|
||||
if test "x$have_libxml2" = "xyes" && test "x$enable_metalink" = "xyes"; then
|
||||
if (test "x$have_libxml2" = "xyes" || test "x$have_libexpat" = "xyes") && test "x$enable_metalink" = "xyes"; then
|
||||
AC_DEFINE([ENABLE_METALINK], [1], [Define to 1 if Metalink support is enabled.])
|
||||
AM_CONDITIONAL([ENABLE_METALINK], true)
|
||||
else
|
||||
@ -108,6 +116,9 @@ else
|
||||
AM_CONDITIONAL([ENABLE_METALINK], false)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_LIBXML2], [test "x$enable_metalink" = "xyes" && test "x$have_libxml2" = "xyes"])
|
||||
AM_CONDITIONAL([ENABLE_LIBEXPAT], [test "x$enable_metalink" = "xyes" && test "x$have_libexpat" = "xyes"])
|
||||
|
||||
if test "x$have_libcares" = "xyes" || test "x$have_libares" = "xyes"; then
|
||||
AC_DEFINE([ENABLE_ASYNC_DNS], [1], [Define to 1 if asynchronous DNS support is enabled.])
|
||||
AM_CONDITIONAL([ENABLE_ASYNC_DNS], true)
|
||||
@ -204,6 +215,7 @@ echo "LIBS: $LIBS"
|
||||
echo "GnuTLS: $have_libgnutls"
|
||||
echo "OpenSSL: $have_openssl"
|
||||
echo "LibXML2: $have_libxml2"
|
||||
echo "LibExpat: $have_libexpat"
|
||||
echo "LibAres: $have_libares"
|
||||
echo "LibCares: $have_libcares"
|
||||
echo "Bittorrent: $enable_bittorrent"
|
||||
|
@ -47,10 +47,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.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/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libexpat.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@ -97,6 +98,10 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
|
||||
ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
|
||||
ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
|
||||
ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
|
||||
ENABLE_LIBEXPAT_FALSE = @ENABLE_LIBEXPAT_FALSE@
|
||||
ENABLE_LIBEXPAT_TRUE = @ENABLE_LIBEXPAT_TRUE@
|
||||
ENABLE_LIBXML2_FALSE = @ENABLE_LIBXML2_FALSE@
|
||||
ENABLE_LIBXML2_TRUE = @ENABLE_LIBXML2_TRUE@
|
||||
ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
|
||||
ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
|
||||
ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
|
||||
@ -136,6 +141,8 @@ LIBARES_CPPFLAGS = @LIBARES_CPPFLAGS@
|
||||
LIBARES_LIBS = @LIBARES_LIBS@
|
||||
LIBCARES_CPPFLAGS = @LIBCARES_CPPFLAGS@
|
||||
LIBCARES_LIBS = @LIBCARES_LIBS@
|
||||
LIBEXPAT_CPPFLAGS = @LIBEXPAT_CPPFLAGS@
|
||||
LIBEXPAT_LIBS = @LIBEXPAT_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
|
@ -47,10 +47,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.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/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libexpat.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@ -93,6 +94,10 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
|
||||
ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
|
||||
ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
|
||||
ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
|
||||
ENABLE_LIBEXPAT_FALSE = @ENABLE_LIBEXPAT_FALSE@
|
||||
ENABLE_LIBEXPAT_TRUE = @ENABLE_LIBEXPAT_TRUE@
|
||||
ENABLE_LIBXML2_FALSE = @ENABLE_LIBXML2_FALSE@
|
||||
ENABLE_LIBXML2_TRUE = @ENABLE_LIBXML2_TRUE@
|
||||
ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
|
||||
ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
|
||||
ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
|
||||
@ -132,6 +137,8 @@ LIBARES_CPPFLAGS = @LIBARES_CPPFLAGS@
|
||||
LIBARES_LIBS = @LIBARES_LIBS@
|
||||
LIBCARES_CPPFLAGS = @LIBCARES_CPPFLAGS@
|
||||
LIBCARES_LIBS = @LIBCARES_LIBS@
|
||||
LIBEXPAT_CPPFLAGS = @LIBEXPAT_CPPFLAGS@
|
||||
LIBEXPAT_LIBS = @LIBEXPAT_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
|
33
m4/libexpat.m4
Normal file
33
m4/libexpat.m4
Normal file
@ -0,0 +1,33 @@
|
||||
AC_DEFUN([AM_PATH_LIBEXPAT],
|
||||
[
|
||||
AC_ARG_WITH([libexpat-prefix],
|
||||
[ --with-libexpat-prefix=PREFIX Prefix where libexpat installed (optional)],
|
||||
[libexpat_prefix=$withval],
|
||||
[libexpat_prefix=""])
|
||||
|
||||
if test "x$libexpat_prefix" = "x"; then
|
||||
libexpat_prefix="/usr"
|
||||
fi
|
||||
|
||||
libexpat_prefix_lib=$libexpat_prefix/lib
|
||||
libexpat_prefix_include=$libexpat_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$libexpat_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$libexpat_prefix_include $CPPFLAGS"
|
||||
|
||||
AC_CHECK_LIB([expat], [XML_ParserCreate], [have_libexpat=yes])
|
||||
if test "x$have_libexpat" = "xyes"; then
|
||||
AC_DEFINE([HAVE_LIBEXPAT], [1], [Define to 1 if you have libexpat.])
|
||||
LIBEXPAT_LIBS="-L$libexpat_prefix_lib -lexpat"
|
||||
LIBEXPAT_CPPFLAGS="-I$libexpat_prefix_include"
|
||||
AC_SUBST(LIBEXPAT_LIBS)
|
||||
AC_SUBST(LIBEXPAT_CPPFLAGS)
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
])
|
133
src/ExpatMetalinkProcessor.cc
Normal file
133
src/ExpatMetalinkProcessor.cc
Normal file
@ -0,0 +1,133 @@
|
||||
/* <!-- 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 "ExpatMetalinkProcessor.h"
|
||||
#include "BinaryStream.h"
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
#include "Util.h"
|
||||
#include "message.h"
|
||||
#include "DefaultDiskWriter.h"
|
||||
|
||||
class SessionData {
|
||||
public:
|
||||
MetalinkParserStateMachineHandle _stm;
|
||||
|
||||
Strings _charactersStack;
|
||||
|
||||
SessionData(const MetalinkParserStateMachineHandle& stm):_stm(stm) {}
|
||||
};
|
||||
|
||||
typedef SharedHandle<SessionData> SessionDataHandle;
|
||||
|
||||
static void mlStartElement(void* userData, const char* name, const char** attrs)
|
||||
{
|
||||
((SessionData*)userData)->_charactersStack.push_front(string());
|
||||
map<string, string> attrmap;
|
||||
if(attrs) {
|
||||
const char** p = attrs;
|
||||
while(*p != 0) {
|
||||
string name = *p++;
|
||||
if(*p == 0) {
|
||||
break;
|
||||
}
|
||||
string value = Util::trim(*p++);
|
||||
attrmap[name] = value;
|
||||
}
|
||||
}
|
||||
((SessionData*)userData)->_stm->beginElement(name, attrmap);
|
||||
}
|
||||
|
||||
static void mlEndElement(void* userData, const char* name)
|
||||
{
|
||||
SessionData* sd = (SessionData*)userData;
|
||||
|
||||
sd->_stm->endElement(name, Util::trim(sd->_charactersStack.front()));
|
||||
sd->_charactersStack.pop_front();
|
||||
}
|
||||
|
||||
static void mlCharacters(void* userData, const char* ch, int len)
|
||||
{
|
||||
((SessionData*)userData)->_charactersStack.front() += string(&ch[0], &ch[len]);
|
||||
}
|
||||
|
||||
ExpatMetalinkProcessor::ExpatMetalinkProcessor():
|
||||
_stm(0)
|
||||
{}
|
||||
|
||||
|
||||
MetalinkerHandle ExpatMetalinkProcessor::parseFile(const string& filename)
|
||||
{
|
||||
DefaultDiskWriterHandle dw = new DefaultDiskWriter();
|
||||
dw->openExistingFile(filename);
|
||||
|
||||
return parseFromBinaryStream(dw);
|
||||
}
|
||||
|
||||
MetalinkerHandle ExpatMetalinkProcessor::parseFromBinaryStream(const BinaryStreamHandle& binaryStream)
|
||||
{
|
||||
_stm = new MetalinkParserStateMachine();
|
||||
int32_t bufSize = 4096;
|
||||
unsigned char buf[bufSize];
|
||||
|
||||
SessionDataHandle sessionData = new SessionData(_stm);
|
||||
XML_Parser parser = XML_ParserCreate(0);
|
||||
try {
|
||||
XML_SetUserData(parser, sessionData.get());
|
||||
XML_SetElementHandler(parser, &mlStartElement, &mlEndElement);
|
||||
XML_SetCharacterDataHandler(parser, &mlCharacters);
|
||||
|
||||
int64_t readOffset = 0;
|
||||
while(1) {
|
||||
int32_t res = binaryStream->readData(buf, bufSize, readOffset);
|
||||
if(res == 0) {
|
||||
break;
|
||||
}
|
||||
if(XML_Parse(parser, (const char*)buf, res, 0) == XML_STATUS_ERROR) {
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
readOffset += res;
|
||||
}
|
||||
if(XML_Parse(parser, 0, 0, 1) == XML_STATUS_ERROR) {
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
} catch(Exception* e) {
|
||||
XML_ParserFree(parser);
|
||||
throw;
|
||||
}
|
||||
XML_ParserFree(parser);
|
||||
if(!_stm->finished()) {
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
return _stm->getResult();
|
||||
}
|
58
src/ExpatMetalinkProcessor.h
Normal file
58
src/ExpatMetalinkProcessor.h
Normal file
@ -0,0 +1,58 @@
|
||||
/* <!-- 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_EXPAT_METALINK_PROCESSOR_H_
|
||||
#define _D_EXPAT_METALINK_PROCESSOR_H_
|
||||
|
||||
#include "MetalinkProcessor.h"
|
||||
#include <expat.h>
|
||||
|
||||
class MetalinkParserStateMachine;
|
||||
typedef SharedHandle<MetalinkParserStateMachine> MetalinkParserStateMachineHandle;
|
||||
|
||||
class ExpatMetalinkProcessor:public MetalinkProcessor {
|
||||
private:
|
||||
MetalinkParserStateMachineHandle _stm;
|
||||
|
||||
public:
|
||||
ExpatMetalinkProcessor();
|
||||
|
||||
virtual ~ExpatMetalinkProcessor() {}
|
||||
|
||||
virtual MetalinkerHandle parseFile(const string& filename);
|
||||
|
||||
virtual MetalinkerHandle parseFromBinaryStream(const BinaryStreamHandle& binaryStream);
|
||||
};
|
||||
|
||||
#endif // _D_EXPAT_METALINK_PROCESSOR_H_
|
@ -256,6 +256,7 @@ SRCS += Metalinker.cc Metalinker.h\
|
||||
MetalinkEntry.cc MetalinkEntry.h\
|
||||
MetalinkResource.cc MetalinkResource.h\
|
||||
MetalinkProcessor.h\
|
||||
MetalinkProcessorFactory.cc\
|
||||
MetalinkParserController.cc\
|
||||
MetalinkParserStateMachine.cc\
|
||||
InitialMetalinkParserState.cc\
|
||||
@ -274,12 +275,19 @@ SRCS += Metalinker.cc Metalinker.h\
|
||||
URLMetalinkParserState.cc\
|
||||
FinMetalinkParserState.cc\
|
||||
SkipTagMetalinkParserState.cc\
|
||||
XML2SAXMetalinkProcessor.cc\
|
||||
Metalink2RequestGroup.cc Metalink2RequestGroup.h\
|
||||
MetalinkPostDownloadHandler.cc MetalinkPostDownloadHandler.h\
|
||||
MetalinkHelper.cc MetalinkHelper.h
|
||||
endif # ENABLE_METALINK
|
||||
|
||||
if ENABLE_LIBXML2
|
||||
SRCS += XML2SAXMetalinkProcessor.cc
|
||||
endif # ENABLE_LIBXML2
|
||||
|
||||
if ENABLE_LIBEXPAT
|
||||
SRCS += ExpatMetalinkProcessor.cc
|
||||
endif # ENABLE_LIBEXPAT
|
||||
|
||||
if !HAVE_BASENAME
|
||||
SRCS += libgen.c libgen.h
|
||||
endif # !HAVE_BASENAME
|
||||
@ -320,7 +328,7 @@ 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@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ -lexpat #-lprofiler
|
||||
#aria2c_LDFLAGS = -pg
|
||||
AM_CPPFLAGS = -Wall\
|
||||
-I../lib -I../intl -I$(top_srcdir)/intl\
|
||||
|
100
src/Makefile.in
100
src/Makefile.in
@ -141,6 +141,7 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.cc MetalinkEntry.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.cc MetalinkResource.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessor.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorFactory.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserController.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserStateMachine.cc\
|
||||
@ENABLE_METALINK_TRUE@ InitialMetalinkParserState.cc\
|
||||
@ -159,20 +160,21 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
||||
@ENABLE_METALINK_TRUE@ URLMetalinkParserState.cc\
|
||||
@ENABLE_METALINK_TRUE@ FinMetalinkParserState.cc\
|
||||
@ENABLE_METALINK_TRUE@ SkipTagMetalinkParserState.cc\
|
||||
@ENABLE_METALINK_TRUE@ XML2SAXMetalinkProcessor.cc\
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroup.cc Metalink2RequestGroup.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandler.cc MetalinkPostDownloadHandler.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelper.cc MetalinkHelper.h
|
||||
|
||||
@HAVE_BASENAME_FALSE@am__append_4 = libgen.c libgen.h
|
||||
@HAVE_GETADDRINFO_FALSE@am__append_5 = getaddrinfo.c getaddrinfo.h
|
||||
@HAVE_GAI_STRERROR_FALSE@am__append_6 = gai_strerror.c gai_strerror.h
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__append_7 = gettimeofday.c gettimeofday.h \
|
||||
@ENABLE_LIBXML2_TRUE@am__append_4 = XML2SAXMetalinkProcessor.cc
|
||||
@ENABLE_LIBEXPAT_TRUE@am__append_5 = ExpatMetalinkProcessor.cc
|
||||
@HAVE_BASENAME_FALSE@am__append_6 = libgen.c libgen.h
|
||||
@HAVE_GETADDRINFO_FALSE@am__append_7 = getaddrinfo.c getaddrinfo.h
|
||||
@HAVE_GAI_STRERROR_FALSE@am__append_8 = gai_strerror.c gai_strerror.h
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__append_9 = gettimeofday.c gettimeofday.h \
|
||||
@HAVE_GETTIMEOFDAY_FALSE@ gettimeofday.c gettimeofday.h
|
||||
@HAVE_INET_ATON_FALSE@am__append_8 = inet_aton.c inet_aton.h
|
||||
@HAVE_LOCALTIME_R_FALSE@am__append_9 = localtime_r.c localtime_r.h
|
||||
@HAVE_STRPTIME_FALSE@am__append_10 = strptime.c strptime.h
|
||||
@HAVE_TIMEGM_FALSE@am__append_11 = timegm.c timegm.h
|
||||
@HAVE_INET_ATON_FALSE@am__append_10 = inet_aton.c inet_aton.h
|
||||
@HAVE_LOCALTIME_R_FALSE@am__append_11 = localtime_r.c localtime_r.h
|
||||
@HAVE_STRPTIME_FALSE@am__append_12 = strptime.c strptime.h
|
||||
@HAVE_TIMEGM_FALSE@am__append_13 = timegm.c timegm.h
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
@ -184,10 +186,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.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/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libexpat.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@ -355,22 +358,23 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||
BtCheckIntegrityEntry.cc BtCheckIntegrityEntry.h Metalinker.cc \
|
||||
Metalinker.h MetalinkEntry.cc MetalinkEntry.h \
|
||||
MetalinkResource.cc MetalinkResource.h MetalinkProcessor.h \
|
||||
MetalinkParserController.cc MetalinkParserStateMachine.cc \
|
||||
InitialMetalinkParserState.cc MetalinkMetalinkParserState.cc \
|
||||
FilesMetalinkParserState.cc FileMetalinkParserState.cc \
|
||||
SizeMetalinkParserState.cc VersionMetalinkParserState.cc \
|
||||
LanguageMetalinkParserState.cc OSMetalinkParserState.cc \
|
||||
VerificationMetalinkParserState.cc HashMetalinkParserState.cc \
|
||||
PiecesMetalinkParserState.cc PieceHashMetalinkParserState.cc \
|
||||
MetalinkProcessorFactory.cc MetalinkParserController.cc \
|
||||
MetalinkParserStateMachine.cc InitialMetalinkParserState.cc \
|
||||
MetalinkMetalinkParserState.cc FilesMetalinkParserState.cc \
|
||||
FileMetalinkParserState.cc SizeMetalinkParserState.cc \
|
||||
VersionMetalinkParserState.cc LanguageMetalinkParserState.cc \
|
||||
OSMetalinkParserState.cc VerificationMetalinkParserState.cc \
|
||||
HashMetalinkParserState.cc PiecesMetalinkParserState.cc \
|
||||
PieceHashMetalinkParserState.cc \
|
||||
ResourcesMetalinkParserState.cc URLMetalinkParserState.cc \
|
||||
FinMetalinkParserState.cc SkipTagMetalinkParserState.cc \
|
||||
XML2SAXMetalinkProcessor.cc Metalink2RequestGroup.cc \
|
||||
Metalink2RequestGroup.h MetalinkPostDownloadHandler.cc \
|
||||
MetalinkPostDownloadHandler.h MetalinkHelper.cc \
|
||||
MetalinkHelper.h libgen.c libgen.h getaddrinfo.c getaddrinfo.h \
|
||||
gai_strerror.c 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
|
||||
Metalink2RequestGroup.cc Metalink2RequestGroup.h \
|
||||
MetalinkPostDownloadHandler.cc MetalinkPostDownloadHandler.h \
|
||||
MetalinkHelper.cc MetalinkHelper.h XML2SAXMetalinkProcessor.cc \
|
||||
ExpatMetalinkProcessor.cc libgen.c libgen.h getaddrinfo.c \
|
||||
getaddrinfo.h gai_strerror.c 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_MESSAGE_DIGEST_TRUE@am__objects_1 = IteratableChunkChecksumValidator.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidator.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ CheckIntegrityCommand.$(OBJEXT) \
|
||||
@ -433,6 +437,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||
@ENABLE_METALINK_TRUE@am__objects_3 = Metalinker.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorFactory.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserController.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserStateMachine.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ InitialMetalinkParserState.$(OBJEXT) \
|
||||
@ -451,20 +456,23 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
||||
@ENABLE_METALINK_TRUE@ URLMetalinkParserState.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ FinMetalinkParserState.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ SkipTagMetalinkParserState.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ XML2SAXMetalinkProcessor.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroup.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandler.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelper.$(OBJEXT)
|
||||
@HAVE_BASENAME_FALSE@am__objects_4 = libgen.$(OBJEXT)
|
||||
@HAVE_GETADDRINFO_FALSE@am__objects_5 = getaddrinfo.$(OBJEXT)
|
||||
@HAVE_GAI_STRERROR_FALSE@am__objects_6 = gai_strerror.$(OBJEXT)
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__objects_7 = gettimeofday.$(OBJEXT) \
|
||||
@ENABLE_LIBXML2_TRUE@am__objects_4 = \
|
||||
@ENABLE_LIBXML2_TRUE@ XML2SAXMetalinkProcessor.$(OBJEXT)
|
||||
@ENABLE_LIBEXPAT_TRUE@am__objects_5 = \
|
||||
@ENABLE_LIBEXPAT_TRUE@ ExpatMetalinkProcessor.$(OBJEXT)
|
||||
@HAVE_BASENAME_FALSE@am__objects_6 = libgen.$(OBJEXT)
|
||||
@HAVE_GETADDRINFO_FALSE@am__objects_7 = getaddrinfo.$(OBJEXT)
|
||||
@HAVE_GAI_STRERROR_FALSE@am__objects_8 = gai_strerror.$(OBJEXT)
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__objects_9 = gettimeofday.$(OBJEXT) \
|
||||
@HAVE_GETTIMEOFDAY_FALSE@ gettimeofday.$(OBJEXT)
|
||||
@HAVE_INET_ATON_FALSE@am__objects_8 = inet_aton.$(OBJEXT)
|
||||
@HAVE_LOCALTIME_R_FALSE@am__objects_9 = localtime_r.$(OBJEXT)
|
||||
@HAVE_STRPTIME_FALSE@am__objects_10 = strptime.$(OBJEXT)
|
||||
@HAVE_TIMEGM_FALSE@am__objects_11 = timegm.$(OBJEXT)
|
||||
am__objects_12 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
@HAVE_INET_ATON_FALSE@am__objects_10 = inet_aton.$(OBJEXT)
|
||||
@HAVE_LOCALTIME_R_FALSE@am__objects_11 = localtime_r.$(OBJEXT)
|
||||
@HAVE_STRPTIME_FALSE@am__objects_12 = strptime.$(OBJEXT)
|
||||
@HAVE_TIMEGM_FALSE@am__objects_13 = timegm.$(OBJEXT)
|
||||
am__objects_14 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
AbstractCommand.$(OBJEXT) \
|
||||
InitiateConnectionCommandFactory.$(OBJEXT) \
|
||||
DownloadCommand.$(OBJEXT) \
|
||||
@ -528,8 +536,9 @@ am__objects_12 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_4) $(am__objects_5) $(am__objects_6) \
|
||||
$(am__objects_7) $(am__objects_8) $(am__objects_9) \
|
||||
$(am__objects_10) $(am__objects_11)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_12)
|
||||
$(am__objects_10) $(am__objects_11) $(am__objects_12) \
|
||||
$(am__objects_13)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_14)
|
||||
libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS)
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
@ -589,6 +598,10 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
|
||||
ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
|
||||
ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
|
||||
ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
|
||||
ENABLE_LIBEXPAT_FALSE = @ENABLE_LIBEXPAT_FALSE@
|
||||
ENABLE_LIBEXPAT_TRUE = @ENABLE_LIBEXPAT_TRUE@
|
||||
ENABLE_LIBXML2_FALSE = @ENABLE_LIBXML2_FALSE@
|
||||
ENABLE_LIBXML2_TRUE = @ENABLE_LIBXML2_TRUE@
|
||||
ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
|
||||
ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
|
||||
ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
|
||||
@ -628,6 +641,8 @@ LIBARES_CPPFLAGS = @LIBARES_CPPFLAGS@
|
||||
LIBARES_LIBS = @LIBARES_LIBS@
|
||||
LIBCARES_CPPFLAGS = @LIBCARES_CPPFLAGS@
|
||||
LIBCARES_LIBS = @LIBCARES_LIBS@
|
||||
LIBEXPAT_CPPFLAGS = @LIBEXPAT_CPPFLAGS@
|
||||
LIBEXPAT_LIBS = @LIBEXPAT_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
@ -820,12 +835,13 @@ SRCS = Socket.h SocketCore.cc SocketCore.h Command.cc Command.h \
|
||||
ServerHost.cc $(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_10) $(am__append_11) $(am__append_12) \
|
||||
$(am__append_13)
|
||||
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@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ -lexpat #-lprofiler
|
||||
|
||||
#aria2c_LDFLAGS = -pg
|
||||
AM_CPPFLAGS = -Wall\
|
||||
@ -987,6 +1003,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadHandlerConstants.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/DownloadHandlerFactory.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Exception.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ExpatMetalinkProcessor.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FeatureConfig.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/File.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileAllocationCommand.Po@am__quote@
|
||||
@ -1035,6 +1052,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkParserController.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkParserStateMachine.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkPostDownloadHandler.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkProcessorFactory.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkResource.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Metalinker.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiDiskAdaptor.Po@am__quote@
|
||||
|
@ -35,7 +35,7 @@
|
||||
#include "MetalinkHelper.h"
|
||||
#include "Option.h"
|
||||
#include "MetalinkEntry.h"
|
||||
#include "XML2SAXMetalinkProcessor.h"
|
||||
#include "MetalinkProcessorFactory.h"
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
#include "Metalinker.h"
|
||||
#include "prefs.h"
|
||||
@ -48,17 +48,17 @@ MetalinkHelper::~MetalinkHelper() {}
|
||||
|
||||
MetalinkEntries MetalinkHelper::parseAndQuery(const string& filename, const Option* option)
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
|
||||
MetalinkerHandle metalinker = proc.parseFile(filename);
|
||||
MetalinkerHandle metalinker = proc->parseFile(filename);
|
||||
return query(metalinker, option);
|
||||
}
|
||||
|
||||
MetalinkEntries MetalinkHelper::parseAndQuery(const BinaryStreamHandle& binaryStream, const Option* option)
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
|
||||
MetalinkerHandle metalinker = proc.parseFromBinaryStream(binaryStream);
|
||||
MetalinkerHandle metalinker = proc->parseFromBinaryStream(binaryStream);
|
||||
return query(metalinker, option);
|
||||
}
|
||||
|
||||
|
@ -50,4 +50,6 @@ public:
|
||||
virtual MetalinkerHandle parseFromBinaryStream(const BinaryStreamHandle& binaryStream) = 0;
|
||||
};
|
||||
|
||||
typedef SharedHandle<MetalinkProcessor> MetalinkProcessorHandle;
|
||||
|
||||
#endif // _D_METALINK_PROCESSOR_H_
|
||||
|
52
src/MetalinkProcessorFactory.cc
Normal file
52
src/MetalinkProcessorFactory.cc
Normal file
@ -0,0 +1,52 @@
|
||||
/* <!-- 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 "MetalinkProcessorFactory.h"
|
||||
#ifdef HAVE_LIBXML2
|
||||
# include "XML2SAXMetalinkProcessor.h"
|
||||
#elif HAVE_LIBEXPAT
|
||||
# include "ExpatMetalinkProcessor.h"
|
||||
#endif
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
|
||||
MetalinkProcessorHandle MetalinkProcessorFactory::newInstance()
|
||||
{
|
||||
#ifdef HAVE_LIBXML2
|
||||
return new XML2SAXMetalinkProcessor();
|
||||
#elif HAVE_LIBEXPAT
|
||||
return new ExpatMetalinkProcessor();
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
48
src/MetalinkProcessorFactory.h
Normal file
48
src/MetalinkProcessorFactory.h
Normal file
@ -0,0 +1,48 @@
|
||||
/* <!-- 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_METALINK_PROCESSOR_FACTORY_H_
|
||||
#define _D_METALINK_PROCESSOR_FACTORY_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "MetalinkProcessor.h"
|
||||
|
||||
class MetalinkProcessorFactory {
|
||||
private:
|
||||
MetalinkProcessorFactory() {}
|
||||
public:
|
||||
static MetalinkProcessorHandle newInstance();
|
||||
};
|
||||
|
||||
#endif // _D_METALINK_PROCESSOR_FACTORY_H__
|
@ -38,7 +38,6 @@
|
||||
#include "common.h"
|
||||
#include "MetalinkEntry.h"
|
||||
#include <deque>
|
||||
#include <libxml/xpath.h>
|
||||
|
||||
class Metalinker {
|
||||
public:
|
||||
|
@ -146,19 +146,23 @@ MetalinkerHandle XML2SAXMetalinkProcessor::parseFromBinaryStream(const BinaryStr
|
||||
|
||||
SessionDataHandle sessionData = new SessionData(_stm);
|
||||
xmlParserCtxtPtr ctx = xmlCreatePushParserCtxt(&mySAXHandler, sessionData.get(), (const char*)buf, res, 0);
|
||||
|
||||
int64_t readOffset = res;
|
||||
while(1) {
|
||||
int32_t res = binaryStream->readData(buf, bufSize, readOffset);
|
||||
if(res == 0) {
|
||||
break;
|
||||
try {
|
||||
int64_t readOffset = res;
|
||||
while(1) {
|
||||
int32_t res = binaryStream->readData(buf, bufSize, readOffset);
|
||||
if(res == 0) {
|
||||
break;
|
||||
}
|
||||
if(xmlParseChunk(ctx, (const char*)buf, res, 0) != 0) {
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
readOffset += res;
|
||||
}
|
||||
if(xmlParseChunk(ctx, (const char*)buf, res, 0) != 0) {
|
||||
throw new DlAbortEx(MSG_CANNOT_PARSE_METALINK);
|
||||
}
|
||||
readOffset += res;
|
||||
xmlParseChunk(ctx, (const char*)buf, 0, 1);
|
||||
} catch(Exception* e) {
|
||||
xmlFreeParserCtxt(ctx);
|
||||
throw e;
|
||||
}
|
||||
xmlParseChunk(ctx, (const char*)buf, 0, 1);
|
||||
xmlFreeParserCtxt(ctx);
|
||||
|
||||
if(!_stm->finished()) {
|
||||
|
@ -74,8 +74,6 @@ extern int optind, opterr, optopt;
|
||||
#ifdef ENABLE_METALINK
|
||||
# include "Metalink2RequestGroup.h"
|
||||
# include "MetalinkEntry.h"
|
||||
# include <libxml/parser.h>
|
||||
# include <libxml/xpath.h>
|
||||
#endif // ENABLE_METALINK
|
||||
|
||||
#ifdef HAVE_LIBSSL
|
||||
@ -241,9 +239,6 @@ int main(int argc, char* argv[]) {
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
gnutls_global_init();
|
||||
#endif // HAVE_LIBGNUTLS
|
||||
#ifdef ENABLE_METALINK
|
||||
xmlInitParser();
|
||||
#endif // ENABLE_METALINK
|
||||
SimpleRandomizer::init();
|
||||
BitfieldManFactory::setDefaultRandomizer(SimpleRandomizer::getInstance());
|
||||
if(op->getAsBool(PREF_STDOUT_LOG)) {
|
||||
@ -330,9 +325,6 @@ int main(int argc, char* argv[]) {
|
||||
#ifdef HAVE_LIBGNUTLS
|
||||
gnutls_global_deinit();
|
||||
#endif // HAVE_LIBGNUTLS
|
||||
#ifdef ENABLE_METALINK
|
||||
xmlCleanupParser();
|
||||
#endif // ENABLE_METALINK
|
||||
FeatureConfig::release();
|
||||
return exitStatus;
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ aria2c_SOURCES += MetalinkerTest.cc\
|
||||
MetalinkPostDownloadHandlerTest.cc\
|
||||
MetalinkHelperTest.cc\
|
||||
MetalinkParserControllerTest.cc\
|
||||
XML2SAXMetalinkProcessorTest.cc
|
||||
MetalinkProcessorTest.cc
|
||||
endif # ENABLE_METALINK
|
||||
|
||||
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
||||
@ -115,7 +115,7 @@ aria2c_LDADD = ../src/libaria2c.a\
|
||||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
${CPPUNIT_LIBS} -lexpat
|
||||
AM_CPPFLAGS = -Wall\
|
||||
${CPPUNIT_CFLAGS}\
|
||||
-I ../src\
|
||||
|
@ -91,7 +91,7 @@ check_PROGRAMS = $(am__EXEEXT_1)
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelperTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserControllerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ XML2SAXMetalinkProcessorTest.cc
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorTest.cc
|
||||
|
||||
subdir = test
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
@ -104,10 +104,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.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/nls.m4 $(top_srcdir)/m4/openssl.m4 \
|
||||
$(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \
|
||||
$(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/uintmax_t.m4 \
|
||||
$(top_srcdir)/m4/ulonglong.m4 $(top_srcdir)/configure.ac
|
||||
$(top_srcdir)/m4/libexpat.m4 $(top_srcdir)/m4/nls.m4 \
|
||||
$(top_srcdir)/m4/openssl.m4 $(top_srcdir)/m4/po.m4 \
|
||||
$(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/stdint_h.m4 \
|
||||
$(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@ -158,8 +159,7 @@ am__aria2c_SOURCES_DIST = AllTest.cc Base64Test.cc SequenceTest.cc \
|
||||
TimeSeedCriteriaTest.cc MetalinkerTest.cc MetalinkEntryTest.cc \
|
||||
Metalink2RequestGroupTest.cc \
|
||||
MetalinkPostDownloadHandlerTest.cc MetalinkHelperTest.cc \
|
||||
MetalinkParserControllerTest.cc \
|
||||
XML2SAXMetalinkProcessorTest.cc
|
||||
MetalinkParserControllerTest.cc MetalinkProcessorTest.cc
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_1 = \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ MessageDigestHelperTest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChunkChecksumValidatorTest.$(OBJEXT) \
|
||||
@ -210,7 +210,7 @@ am__aria2c_SOURCES_DIST = AllTest.cc Base64Test.cc SequenceTest.cc \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelperTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkParserControllerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ XML2SAXMetalinkProcessorTest.$(OBJEXT)
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorTest.$(OBJEXT)
|
||||
am_aria2c_OBJECTS = AllTest.$(OBJEXT) Base64Test.$(OBJEXT) \
|
||||
SequenceTest.$(OBJEXT) a2functionalTest.$(OBJEXT) \
|
||||
FileEntryTest.$(OBJEXT) PieceTest.$(OBJEXT) \
|
||||
@ -292,6 +292,10 @@ ENABLE_ASYNC_DNS_FALSE = @ENABLE_ASYNC_DNS_FALSE@
|
||||
ENABLE_ASYNC_DNS_TRUE = @ENABLE_ASYNC_DNS_TRUE@
|
||||
ENABLE_BITTORRENT_FALSE = @ENABLE_BITTORRENT_FALSE@
|
||||
ENABLE_BITTORRENT_TRUE = @ENABLE_BITTORRENT_TRUE@
|
||||
ENABLE_LIBEXPAT_FALSE = @ENABLE_LIBEXPAT_FALSE@
|
||||
ENABLE_LIBEXPAT_TRUE = @ENABLE_LIBEXPAT_TRUE@
|
||||
ENABLE_LIBXML2_FALSE = @ENABLE_LIBXML2_FALSE@
|
||||
ENABLE_LIBXML2_TRUE = @ENABLE_LIBXML2_TRUE@
|
||||
ENABLE_MESSAGE_DIGEST_FALSE = @ENABLE_MESSAGE_DIGEST_FALSE@
|
||||
ENABLE_MESSAGE_DIGEST_TRUE = @ENABLE_MESSAGE_DIGEST_TRUE@
|
||||
ENABLE_METALINK_FALSE = @ENABLE_METALINK_FALSE@
|
||||
@ -331,6 +335,8 @@ LIBARES_CPPFLAGS = @LIBARES_CPPFLAGS@
|
||||
LIBARES_LIBS = @LIBARES_LIBS@
|
||||
LIBCARES_CPPFLAGS = @LIBCARES_CPPFLAGS@
|
||||
LIBCARES_LIBS = @LIBCARES_LIBS@
|
||||
LIBEXPAT_CPPFLAGS = @LIBEXPAT_CPPFLAGS@
|
||||
LIBEXPAT_LIBS = @LIBEXPAT_LIBS@
|
||||
LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
|
||||
LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
|
||||
LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
|
||||
@ -451,7 +457,7 @@ aria2c_LDADD = ../src/libaria2c.a\
|
||||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
${CPPUNIT_LIBS} -lexpat
|
||||
|
||||
AM_CPPFLAGS = -Wall\
|
||||
${CPPUNIT_CFLAGS}\
|
||||
@ -570,6 +576,7 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkHelperTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkParserControllerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkPostDownloadHandlerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkProcessorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MetalinkerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiDiskAdaptorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/MultiFileAllocationIteratorTest.Po@am__quote@
|
||||
@ -598,7 +605,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamUriListParserTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TimeSeedCriteriaTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/UtilTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/XML2SAXMetalinkProcessorTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/a2functionalTest.Po@am__quote@
|
||||
|
||||
.cc.o:
|
||||
|
@ -1,13 +1,13 @@
|
||||
#include "XML2SAXMetalinkProcessor.h"
|
||||
#include "MetalinkProcessorFactory.h"
|
||||
#include "MetalinkParserStateMachine.h"
|
||||
#include "Exception.h"
|
||||
#include "DefaultDiskWriter.h"
|
||||
#include "ByteArrayDiskWriter.h"
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
class XML2SAXMetalinkProcessorTest:public CppUnit::TestFixture {
|
||||
class MetalinkProcessorTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(XML2SAXMetalinkProcessorTest);
|
||||
CPPUNIT_TEST_SUITE(MetalinkProcessorTest);
|
||||
CPPUNIT_TEST(testParseFile);
|
||||
CPPUNIT_TEST(testParseFromBinaryStream);
|
||||
CPPUNIT_TEST(testMalformedXML);
|
||||
@ -28,13 +28,6 @@ class XML2SAXMetalinkProcessorTest:public CppUnit::TestFixture {
|
||||
private:
|
||||
|
||||
public:
|
||||
void setUp() {
|
||||
xmlInitParser();
|
||||
}
|
||||
void tearDown() {
|
||||
xmlCleanupParser();
|
||||
}
|
||||
|
||||
void testParseFile();
|
||||
void testParseFromBinaryStream();
|
||||
void testMalformedXML();
|
||||
@ -54,13 +47,13 @@ public:
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( XML2SAXMetalinkProcessorTest );
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION( MetalinkProcessorTest );
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testParseFile()
|
||||
void MetalinkProcessorTest::testParseFile()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
try {
|
||||
MetalinkerHandle metalinker = proc.parseFile("test.xml");
|
||||
MetalinkerHandle metalinker = proc->parseFile("test.xml");
|
||||
|
||||
MetalinkEntries::iterator entryItr = metalinker->entries.begin();
|
||||
|
||||
@ -146,14 +139,14 @@ void XML2SAXMetalinkProcessorTest::testParseFile()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testParseFromBinaryStream()
|
||||
void MetalinkProcessorTest::testParseFromBinaryStream()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
DefaultDiskWriterHandle dw = new DefaultDiskWriter();
|
||||
dw->openExistingFile("test.xml");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
|
||||
MetalinkEntries::iterator entryItr = m->entries.begin();
|
||||
MetalinkEntryHandle entry1 = *entryItr;
|
||||
@ -164,14 +157,14 @@ void XML2SAXMetalinkProcessorTest::testParseFromBinaryStream()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testMalformedXML()
|
||||
void MetalinkProcessorTest::testMalformedXML()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink><files></file></metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception* e) {
|
||||
cerr << *e << endl;
|
||||
@ -179,14 +172,14 @@ void XML2SAXMetalinkProcessorTest::testMalformedXML()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testMalformedXML2()
|
||||
void MetalinkProcessorTest::testMalformedXML2()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink><files></files>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(Exception* e) {
|
||||
cerr << *e << endl;
|
||||
@ -194,9 +187,9 @@ void XML2SAXMetalinkProcessorTest::testMalformedXML2()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadSize()
|
||||
void MetalinkProcessorTest::testBadSize()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -210,7 +203,7 @@ void XML2SAXMetalinkProcessorTest::testBadSize()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
|
||||
MetalinkEntries::iterator entryItr = m->entries.begin();
|
||||
MetalinkEntryHandle e = *entryItr;
|
||||
@ -226,9 +219,9 @@ void XML2SAXMetalinkProcessorTest::testBadSize()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadMaxConn()
|
||||
void MetalinkProcessorTest::testBadMaxConn()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -243,7 +236,7 @@ void XML2SAXMetalinkProcessorTest::testBadMaxConn()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
|
||||
MetalinkEntries::iterator entryItr = m->entries.begin();
|
||||
MetalinkEntryHandle e = *entryItr;
|
||||
@ -254,9 +247,9 @@ void XML2SAXMetalinkProcessorTest::testBadMaxConn()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testNoName()
|
||||
void MetalinkProcessorTest::testNoName()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -276,7 +269,7 @@ void XML2SAXMetalinkProcessorTest::testNoName()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, m->entries.size());
|
||||
MetalinkEntries::iterator entryItr = m->entries.begin();
|
||||
MetalinkEntryHandle e = *entryItr;
|
||||
@ -287,9 +280,9 @@ void XML2SAXMetalinkProcessorTest::testNoName()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadURLPrefs()
|
||||
void MetalinkProcessorTest::testBadURLPrefs()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -306,7 +299,7 @@ void XML2SAXMetalinkProcessorTest::testBadURLPrefs()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
MetalinkResourceHandle r = e->resources[0];
|
||||
CPPUNIT_ASSERT_EQUAL(MetalinkResource::TYPE_FTP, r->type);
|
||||
@ -319,9 +312,9 @@ void XML2SAXMetalinkProcessorTest::testBadURLPrefs()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadURLMaxConn()
|
||||
void MetalinkProcessorTest::testBadURLMaxConn()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -338,7 +331,7 @@ void XML2SAXMetalinkProcessorTest::testBadURLMaxConn()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
MetalinkResourceHandle r = e->resources[0];
|
||||
CPPUNIT_ASSERT_EQUAL(MetalinkResource::TYPE_FTP, r->type);
|
||||
@ -352,9 +345,9 @@ void XML2SAXMetalinkProcessorTest::testBadURLMaxConn()
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MESSAGE_DIGEST
|
||||
void XML2SAXMetalinkProcessorTest::testUnsupportedType()
|
||||
void MetalinkProcessorTest::testUnsupportedType()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -373,7 +366,7 @@ void XML2SAXMetalinkProcessorTest::testUnsupportedType()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, e->resources.size());
|
||||
MetalinkResourceHandle r1 = e->resources[0];
|
||||
@ -388,9 +381,9 @@ void XML2SAXMetalinkProcessorTest::testUnsupportedType()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testMultiplePieces()
|
||||
void MetalinkProcessorTest::testMultiplePieces()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -409,7 +402,7 @@ void XML2SAXMetalinkProcessorTest::testMultiplePieces()
|
||||
|
||||
try {
|
||||
// aria2 prefers sha1
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
ChunkChecksumHandle c = e->chunkChecksum;
|
||||
|
||||
@ -421,9 +414,9 @@ void XML2SAXMetalinkProcessorTest::testMultiplePieces()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadPieceNo()
|
||||
void MetalinkProcessorTest::testBadPieceNo()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -442,7 +435,7 @@ void XML2SAXMetalinkProcessorTest::testBadPieceNo()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
ChunkChecksumHandle c = e->chunkChecksum;
|
||||
|
||||
@ -453,9 +446,9 @@ void XML2SAXMetalinkProcessorTest::testBadPieceNo()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testBadPieceLength()
|
||||
void MetalinkProcessorTest::testBadPieceLength()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -473,7 +466,7 @@ void XML2SAXMetalinkProcessorTest::testBadPieceLength()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
ChunkChecksumHandle c = e->chunkChecksum;
|
||||
|
||||
@ -484,9 +477,9 @@ void XML2SAXMetalinkProcessorTest::testBadPieceLength()
|
||||
}
|
||||
}
|
||||
|
||||
void XML2SAXMetalinkProcessorTest::testUnsupportedType_piece()
|
||||
void MetalinkProcessorTest::testUnsupportedType_piece()
|
||||
{
|
||||
XML2SAXMetalinkProcessor proc;
|
||||
MetalinkProcessorHandle proc = MetalinkProcessorFactory::newInstance();
|
||||
ByteArrayDiskWriterHandle dw = new ByteArrayDiskWriter();
|
||||
dw->setString("<metalink>"
|
||||
"<files>"
|
||||
@ -504,7 +497,7 @@ void XML2SAXMetalinkProcessorTest::testUnsupportedType_piece()
|
||||
"</metalink>");
|
||||
|
||||
try {
|
||||
MetalinkerHandle m = proc.parseFromBinaryStream(dw);
|
||||
MetalinkerHandle m = proc->parseFromBinaryStream(dw);
|
||||
MetalinkEntryHandle e = m->entries[0];
|
||||
ChunkChecksumHandle c = e->chunkChecksum;
|
||||
|
Loading…
Reference in New Issue
Block a user