mirror of https://github.com/aria2/aria2
2008-08-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Added firefox3 cookie support based on the patch submitted by tizianomueller. firefox3 cookie is SQLite3 database. libsqlite3 is required to enable this functionality. * configure.ac * m4/sqlite3.m4 * src/CookieBoxFactory.cc * src/CookieBoxFactory.h * src/Makefile.am * src/Makefile.in * src/Sqlite3MozCookieParser.cc * src/Sqlite3MozCookieParser.h * src/main.cc * test/CookieBoxFactoryTest.cc * test/Makefile.am * test/Makefile.in * test/Sqlite3MozCookieParserTest.cc * test/badcookies.sqlite * test/cookies.sqlitepull/1/head
parent
72d21885d1
commit
0cac0dabde
22
ChangeLog
22
ChangeLog
|
@ -1,3 +1,25 @@
|
|||
2008-08-17 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Added firefox3 cookie support based on the patch submitted by
|
||||
tizianomueller.
|
||||
firefox3 cookie is SQLite3 database. libsqlite3 is required to enable
|
||||
this functionality.
|
||||
* configure.ac
|
||||
* m4/sqlite3.m4
|
||||
* src/CookieBoxFactory.cc
|
||||
* src/CookieBoxFactory.h
|
||||
* src/Makefile.am
|
||||
* src/Makefile.in
|
||||
* src/Sqlite3MozCookieParser.cc
|
||||
* src/Sqlite3MozCookieParser.h
|
||||
* src/main.cc
|
||||
* test/CookieBoxFactoryTest.cc
|
||||
* test/Makefile.am
|
||||
* test/Makefile.in
|
||||
* test/Sqlite3MozCookieParserTest.cc
|
||||
* test/badcookies.sqlite
|
||||
* test/cookies.sqlite
|
||||
|
||||
2008-08-15 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
|
||||
|
||||
Added Danish and Greek translations.
|
||||
|
|
11
Makefile.in
11
Makefile.in
|
@ -56,10 +56,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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 \
|
||||
|
@ -204,6 +205,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
|
|
@ -1446,6 +1446,7 @@ m4_include([m4/po.m4])
|
|||
m4_include([m4/printf-posix.m4])
|
||||
m4_include([m4/progtest.m4])
|
||||
m4_include([m4/size_max.m4])
|
||||
m4_include([m4/sqlite3.m4])
|
||||
m4_include([m4/stdint_h.m4])
|
||||
m4_include([m4/uintmax_t.m4])
|
||||
m4_include([m4/visibility.m4])
|
||||
|
|
|
@ -325,6 +325,9 @@
|
|||
/* Define to 1 if you have the `socket' function. */
|
||||
#undef HAVE_SOCKET
|
||||
|
||||
/* Define to 1 if you have sqlite3. */
|
||||
#undef HAVE_SQLITE3
|
||||
|
||||
/* Define to 1 if `stat' has the bug that it succeeds when given the
|
||||
zero-length file name argument. */
|
||||
#undef HAVE_STAT_EMPTY_STRING_BUG
|
||||
|
|
|
@ -726,6 +726,8 @@ XML_CPPFLAGS
|
|||
XML_LIBS
|
||||
LIBEXPAT_LIBS
|
||||
LIBEXPAT_CPPFLAGS
|
||||
SQLITE3_LIBS
|
||||
SQLITE3_CPPFLAGS
|
||||
LIBGNUTLS_CONFIG
|
||||
LIBGNUTLS_CFLAGS
|
||||
LIBGNUTLS_LIBS
|
||||
|
@ -754,6 +756,8 @@ ENABLE_ASYNC_DNS_TRUE
|
|||
ENABLE_ASYNC_DNS_FALSE
|
||||
HAVE_LIBZ_TRUE
|
||||
HAVE_LIBZ_FALSE
|
||||
HAVE_SQLITE3_TRUE
|
||||
HAVE_SQLITE3_FALSE
|
||||
ALLOCA
|
||||
USE_NLS
|
||||
GETTEXT_MACRO_VERSION
|
||||
|
@ -1436,6 +1440,7 @@ Optional Packages:
|
|||
--with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)
|
||||
--with-gnutls use gnutls if it is installed.
|
||||
--with-openssl use openssl if it is installed.
|
||||
--with-sqlite3 use sqlite3 if it is installed.
|
||||
--with-libxml2 use libxml2 if it is installed.
|
||||
--with-libexpat use libexpat if it is installed.
|
||||
--with-libares use libares if it is installed.
|
||||
|
@ -1444,6 +1449,7 @@ Optional Packages:
|
|||
--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-sqlite3-prefix=PREFIX Prefix where SQLite3 installed (optional)
|
||||
--with-libgnutls-prefix=PFX Prefix where libgnutls is installed (optional)
|
||||
--with-libgcrypt-prefix=PFX
|
||||
prefix where LIBGCRYPT is installed (optional)
|
||||
|
@ -2703,6 +2709,15 @@ fi
|
|||
|
||||
|
||||
|
||||
# Check whether --with-sqlite3 was given.
|
||||
if test "${with_sqlite3+set}" = set; then
|
||||
withval=$with_sqlite3; with_sqlite3=$withval
|
||||
else
|
||||
with_sqlite3=yes
|
||||
fi
|
||||
|
||||
|
||||
|
||||
# Check whether --with-libxml2 was given.
|
||||
if test "${with_libxml2+set}" = set; then
|
||||
withval=$with_libxml2; with_libxml2=$withval
|
||||
|
@ -5936,6 +5951,112 @@ LIBS=$LIBS_save
|
|||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if test "x$with_sqlite3" = "xyes"; then
|
||||
|
||||
|
||||
# Check whether --with-sqlite3-prefix was given.
|
||||
if test "${with_sqlite3_prefix+set}" = set; then
|
||||
withval=$with_sqlite3_prefix; sqlite3_prefix=$withval
|
||||
else
|
||||
sqlite3_prefix=""
|
||||
fi
|
||||
|
||||
if test "x$sqlite3_prefix" = "x"; then
|
||||
sqlite3_prefix="/usr"
|
||||
fi
|
||||
|
||||
sqlite3_prefix_lib=$sqlite3_prefix/lib
|
||||
sqlite3_prefix_include=$sqlite3_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$sqlite3_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS"
|
||||
|
||||
{ echo "$as_me:$LINENO: checking for sqlite3_open in -lsqlite3" >&5
|
||||
echo $ECHO_N "checking for sqlite3_open in -lsqlite3... $ECHO_C" >&6; }
|
||||
if test "${ac_cv_lib_sqlite3_sqlite3_open+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_check_lib_save_LIBS=$LIBS
|
||||
LIBS="-lsqlite3 $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 sqlite3_open ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
return sqlite3_open ();
|
||||
;
|
||||
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_sqlite3_sqlite3_open=yes
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
ac_cv_lib_sqlite3_sqlite3_open=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_sqlite3_sqlite3_open" >&5
|
||||
echo "${ECHO_T}$ac_cv_lib_sqlite3_sqlite3_open" >&6; }
|
||||
if test $ac_cv_lib_sqlite3_sqlite3_open = yes; then
|
||||
have_sqlite3=yes
|
||||
fi
|
||||
|
||||
if test "x$have_sqlite3" = "xyes"; then
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_SQLITE3 1
|
||||
_ACEOF
|
||||
|
||||
SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3"
|
||||
SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include"
|
||||
|
||||
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
|
||||
fi
|
||||
|
||||
if test "x$with_gnutls" = "xyes"; then
|
||||
|
@ -7255,6 +7376,16 @@ else
|
|||
fi
|
||||
|
||||
|
||||
# Set conditional for sqlite3
|
||||
if test "x$have_sqlite3" = "xyes"; then
|
||||
HAVE_SQLITE3_TRUE=
|
||||
HAVE_SQLITE3_FALSE='#'
|
||||
else
|
||||
HAVE_SQLITE3_TRUE='#'
|
||||
HAVE_SQLITE3_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
# Checks for header files.
|
||||
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
|
||||
# for constant arguments. Useless!
|
||||
|
@ -21757,6 +21888,13 @@ 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_SQLITE3_TRUE}" && test -z "${HAVE_SQLITE3_FALSE}"; then
|
||||
{ { echo "$as_me:$LINENO: error: conditional \"HAVE_SQLITE3\" was never defined.
|
||||
Usually this means the macro was only invoked conditionally." >&5
|
||||
echo "$as_me: error: conditional \"HAVE_SQLITE3\" 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
|
||||
|
@ -22593,6 +22731,8 @@ XML_CPPFLAGS!$XML_CPPFLAGS$ac_delim
|
|||
XML_LIBS!$XML_LIBS$ac_delim
|
||||
LIBEXPAT_LIBS!$LIBEXPAT_LIBS$ac_delim
|
||||
LIBEXPAT_CPPFLAGS!$LIBEXPAT_CPPFLAGS$ac_delim
|
||||
SQLITE3_LIBS!$SQLITE3_LIBS$ac_delim
|
||||
SQLITE3_CPPFLAGS!$SQLITE3_CPPFLAGS$ac_delim
|
||||
LIBGNUTLS_CONFIG!$LIBGNUTLS_CONFIG$ac_delim
|
||||
LIBGNUTLS_CFLAGS!$LIBGNUTLS_CFLAGS$ac_delim
|
||||
LIBGNUTLS_LIBS!$LIBGNUTLS_LIBS$ac_delim
|
||||
|
@ -22621,6 +22761,8 @@ 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
|
||||
HAVE_SQLITE3_TRUE!$HAVE_SQLITE3_TRUE$ac_delim
|
||||
HAVE_SQLITE3_FALSE!$HAVE_SQLITE3_FALSE$ac_delim
|
||||
ALLOCA!$ALLOCA$ac_delim
|
||||
USE_NLS!$USE_NLS$ac_delim
|
||||
GETTEXT_MACRO_VERSION!$GETTEXT_MACRO_VERSION$ac_delim
|
||||
|
@ -22675,10 +22817,6 @@ HAVE_BASENAME_TRUE!$HAVE_BASENAME_TRUE$ac_delim
|
|||
HAVE_BASENAME_FALSE!$HAVE_BASENAME_FALSE$ac_delim
|
||||
HAVE_GAI_STRERROR_TRUE!$HAVE_GAI_STRERROR_TRUE$ac_delim
|
||||
HAVE_GAI_STRERROR_FALSE!$HAVE_GAI_STRERROR_FALSE$ac_delim
|
||||
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
|
||||
_ACEOF
|
||||
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
|
||||
|
@ -22720,6 +22858,10 @@ _ACEOF
|
|||
ac_delim='%!_!# '
|
||||
for ac_last_try in false false false false false :; do
|
||||
cat >conf$$subs.sed <<_ACEOF
|
||||
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
|
||||
|
@ -22731,7 +22873,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` = 9; then
|
||||
if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 13; then
|
||||
break
|
||||
elif $ac_last_try; then
|
||||
{ { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
|
||||
|
@ -23452,6 +23594,7 @@ echo "CFLAGS: $CFLAGS"
|
|||
echo "CPPFLAGS: $CPPFLAGS"
|
||||
echo "LDFLAGS: $LDFLAGS"
|
||||
echo "LIBS: $LIBS"
|
||||
echo "SQLite3: $have_sqlite3"
|
||||
echo "GnuTLS: $have_libgnutls"
|
||||
echo "OpenSSL: $have_openssl"
|
||||
echo "LibXML2: $have_libxml2"
|
||||
|
|
|
@ -26,6 +26,7 @@ AC_SUBST(localedir)
|
|||
# Checks for arguments.
|
||||
ARIA2_ARG_WITH([gnutls])
|
||||
ARIA2_ARG_WITH([openssl])
|
||||
ARIA2_ARG_WITH([sqlite3])
|
||||
ARIA2_ARG_WITH([libxml2])
|
||||
ARIA2_ARG_WITH([libexpat])
|
||||
ARIA2_ARG_WITH([libares])
|
||||
|
@ -65,6 +66,10 @@ if test "x$with_libexpat" = "xyes" && test "x$have_libxml2" != "xyes"; then
|
|||
AM_PATH_LIBEXPAT
|
||||
fi
|
||||
|
||||
if test "x$with_sqlite3" = "xyes"; then
|
||||
AM_PATH_SQLITE3
|
||||
fi
|
||||
|
||||
if test "x$with_gnutls" = "xyes"; then
|
||||
AM_PATH_LIBGNUTLS([1.2.9], [have_libgnutls=yes])
|
||||
if test "x$have_libgnutls" = "xyes"; then
|
||||
|
@ -148,6 +153,9 @@ fi
|
|||
# Set conditional for libz
|
||||
AM_CONDITIONAL([HAVE_LIBZ], [test "x$have_libz" = "xyes"])
|
||||
|
||||
# Set conditional for sqlite3
|
||||
AM_CONDITIONAL([HAVE_SQLITE3], [test "x$have_sqlite3" = "xyes"])
|
||||
|
||||
# Checks for header files.
|
||||
AC_FUNC_ALLOCA
|
||||
AC_HEADER_STDC
|
||||
|
@ -325,6 +333,7 @@ echo "CFLAGS: $CFLAGS"
|
|||
echo "CPPFLAGS: $CPPFLAGS"
|
||||
echo "LDFLAGS: $LDFLAGS"
|
||||
echo "LIBS: $LIBS"
|
||||
echo "SQLite3: $have_sqlite3"
|
||||
echo "GnuTLS: $have_libgnutls"
|
||||
echo "OpenSSL: $have_openssl"
|
||||
echo "LibXML2: $have_libxml2"
|
||||
|
|
|
@ -51,10 +51,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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
|
||||
|
@ -178,6 +179,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
|
|
@ -49,10 +49,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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
|
||||
|
@ -164,6 +165,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
|
|
@ -49,10 +49,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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
|
||||
|
@ -164,6 +165,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
AC_DEFUN([AM_PATH_SQLITE3],
|
||||
[
|
||||
AC_ARG_WITH([sqlite3-prefix],
|
||||
[ --with-sqlite3-prefix=PREFIX Prefix where SQLite3 installed (optional)],
|
||||
[sqlite3_prefix=$withval],
|
||||
[sqlite3_prefix=""])
|
||||
if test "x$sqlite3_prefix" = "x"; then
|
||||
sqlite3_prefix="/usr"
|
||||
fi
|
||||
|
||||
sqlite3_prefix_lib=$sqlite3_prefix/lib
|
||||
sqlite3_prefix_include=$sqlite3_prefix/include
|
||||
|
||||
LIBS_save=$LIBS
|
||||
CPPFLAGS_save=$CPPFLAGS
|
||||
|
||||
LIBS="-L$sqlite3_prefix_lib $LIBS"
|
||||
CPPFLAGS="-I$sqlite3_prefix_include $CPPFLAGS"
|
||||
|
||||
AC_CHECK_LIB([sqlite3], [sqlite3_open], [have_sqlite3=yes])
|
||||
if test "x$have_sqlite3" = "xyes"; then
|
||||
AC_DEFINE([HAVE_SQLITE3], [1], [Define to 1 if you have sqlite3.])
|
||||
SQLITE3_LIBS="-L$sqlite3_prefix_lib -lsqlite3"
|
||||
SQLITE3_CPPFLAGS="-I$sqlite3_prefix_include"
|
||||
AC_SUBST(SQLITE3_LIBS)
|
||||
AC_SUBST(SQLITE3_CPPFLAGS)
|
||||
fi
|
||||
|
||||
LIBS=$LIBS_save
|
||||
CPPFLAGS=$CPPFLAGS_save
|
||||
|
||||
])
|
|
@ -38,12 +38,22 @@
|
|||
#include "Util.h"
|
||||
#include "RecoverableException.h"
|
||||
#include "A2STR.h"
|
||||
#include <istream>
|
||||
#include "LogFactory.h"
|
||||
#include "Logger.h"
|
||||
#ifdef HAVE_SQLITE3
|
||||
# include "Sqlite3MozCookieParser.h"
|
||||
#endif // HAVE_SQLITE3
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
const std::string CookieBoxFactory::C_TRUE("TRUE");
|
||||
|
||||
CookieBoxFactory::CookieBoxFactory():_logger(LogFactory::getInstance()) {}
|
||||
|
||||
CookieBoxFactory::~CookieBoxFactory() {}
|
||||
|
||||
CookieBoxHandle CookieBoxFactory::createNewInstance()
|
||||
{
|
||||
CookieBoxHandle box(new CookieBox());
|
||||
|
@ -51,21 +61,43 @@ CookieBoxHandle CookieBoxFactory::createNewInstance()
|
|||
return box;
|
||||
}
|
||||
|
||||
void CookieBoxFactory::loadDefaultCookie(std::istream& s)
|
||||
void CookieBoxFactory::loadDefaultCookie(const std::string& filename)
|
||||
{
|
||||
std::string line;
|
||||
while(getline(s, line)) {
|
||||
if(Util::startsWith(line, A2STR::SHARP_C)) {
|
||||
continue;
|
||||
}
|
||||
std::ifstream s(filename.c_str());
|
||||
char header[16]; // "SQLite format 3" plus \0
|
||||
s.get(header, sizeof(header));
|
||||
if(s.bad()) {
|
||||
_logger->error("Failed to read header of cookie file %s", filename.c_str());
|
||||
return;
|
||||
}
|
||||
if(std::string(header) == "SQLite format 3") {
|
||||
#ifdef HAVE_SQLITE3
|
||||
try {
|
||||
Cookie c = parseNsCookie(line);
|
||||
if(c.good()) {
|
||||
defaultCookies.push_back(c);
|
||||
}
|
||||
defaultCookies = Sqlite3MozCookieParser().parse(filename);
|
||||
} catch(RecoverableException& e) {
|
||||
// ignore malformed cookie entry
|
||||
// TODO better to log it
|
||||
_logger->error("Failed to load cookies from %s, cause: %s",
|
||||
filename.c_str(), e.what());
|
||||
}
|
||||
#else // !HAVE_SQLITE3
|
||||
_logger->notice("Cannot read SQLite3 database because SQLite3 support is"
|
||||
" disabled by configuration.");
|
||||
#endif // !HAVE_SQLITE3
|
||||
} else {
|
||||
s.seekg(0);
|
||||
std::string line;
|
||||
while(getline(s, line)) {
|
||||
if(Util::startsWith(line, A2STR::SHARP_C)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
Cookie c = parseNsCookie(line);
|
||||
if(c.good()) {
|
||||
defaultCookies.push_back(c);
|
||||
}
|
||||
} catch(RecoverableException& e) {
|
||||
// ignore malformed cookie entry
|
||||
// TODO better to log it
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,19 +45,21 @@
|
|||
namespace aria2 {
|
||||
|
||||
class CookieBox;
|
||||
class Logger;
|
||||
|
||||
class CookieBoxFactory {
|
||||
private:
|
||||
Cookies defaultCookies;
|
||||
|
||||
Logger* _logger;
|
||||
public:
|
||||
CookieBoxFactory() {}
|
||||
CookieBoxFactory();
|
||||
|
||||
~CookieBoxFactory() {}
|
||||
~CookieBoxFactory();
|
||||
|
||||
SharedHandle<CookieBox> createNewInstance();
|
||||
|
||||
void loadDefaultCookie(std::istream& s);
|
||||
void loadDefaultCookie(const std::string& filename);
|
||||
|
||||
Cookie parseNsCookie(const std::string& nsCookieStr) const;
|
||||
|
||||
|
|
|
@ -200,6 +200,10 @@ if HAVE_LIBZ
|
|||
SRCS += GZipDecoder.cc GZipDecoder.h
|
||||
endif # HAVE_LIBZ
|
||||
|
||||
if HAVE_SQLITE3
|
||||
SRCS += Sqlite3MozCookieParser.cc Sqlite3MozCookieParser.h
|
||||
endif # HAVE_SQLITE3
|
||||
|
||||
if ENABLE_ASYNC_DNS
|
||||
SRCS += AsyncNameResolver.cc AsyncNameResolver.h
|
||||
endif # ENABLE_ASYNC_DNS
|
||||
|
@ -473,10 +477,12 @@ 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@ @LIBZ_LIBS@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
@SQLITE3_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@\
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
@LIBZ_CPPFLAGS@ @SQLITE3_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
|
@ -36,8 +36,9 @@ host_triplet = @host@
|
|||
target_triplet = @target@
|
||||
bin_PROGRAMS = aria2c$(EXEEXT)
|
||||
@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\
|
||||
@HAVE_SQLITE3_TRUE@am__append_2 = Sqlite3MozCookieParser.cc Sqlite3MozCookieParser.h
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__append_3 = AsyncNameResolver.cc AsyncNameResolver.h
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_4 = 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\
|
||||
|
@ -46,7 +47,7 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_MESSAGE_DIGEST_TRUE@ Checksum.h\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ ChunkChecksum.h
|
||||
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_4 = MetaEntry.h\
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_5 = MetaEntry.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ Data.cc Data.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ Dictionary.cc Dictionary.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ List.cc List.h\
|
||||
|
@ -223,7 +224,7 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_BITTORRENT_TRUE@ BtLeecherStateChoke.cc BtLeecherStateChoke.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtSeederStateChoke.cc BtSeederStateChoke.h
|
||||
|
||||
@ENABLE_METALINK_TRUE@am__append_5 = Metalinker.cc Metalinker.h\
|
||||
@ENABLE_METALINK_TRUE@am__append_6 = Metalinker.cc Metalinker.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.cc MetalinkEntry.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.cc MetalinkResource.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessor.h\
|
||||
|
@ -252,17 +253,17 @@ bin_PROGRAMS = aria2c$(EXEEXT)
|
|||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandler.cc MetalinkPostDownloadHandler.h\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkHelper.cc MetalinkHelper.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
|
||||
@ENABLE_LIBXML2_TRUE@am__append_7 = XML2SAXMetalinkProcessor.cc XML2SAXMetalinkProcessor.h
|
||||
@ENABLE_LIBEXPAT_TRUE@am__append_8 = ExpatMetalinkProcessor.cc ExpatMetalinkProcessor.h
|
||||
@HAVE_ASCTIME_R_FALSE@am__append_9 = asctime_r.c asctime_r.h
|
||||
@HAVE_BASENAME_FALSE@am__append_10 = libgen.c libgen.h
|
||||
@HAVE_GETADDRINFO_FALSE@am__append_11 = getaddrinfo.c getaddrinfo.h
|
||||
@HAVE_GAI_STRERROR_FALSE@am__append_12 = gai_strerror.c gai_strerror.h
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__append_13 = gettimeofday.c gettimeofday.h
|
||||
@HAVE_INET_ATON_FALSE@am__append_14 = inet_aton.c inet_aton.h
|
||||
@HAVE_LOCALTIME_R_FALSE@am__append_15 = localtime_r.c localtime_r.h
|
||||
@HAVE_STRPTIME_FALSE@am__append_16 = strptime.c strptime.h
|
||||
@HAVE_TIMEGM_FALSE@am__append_17 = timegm.c timegm.h
|
||||
subdir = src
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in alloca.c
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
|
@ -280,10 +281,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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
|
||||
|
@ -413,6 +415,7 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
ServerStatMan.h URISelector.h InOrderURISelector.cc \
|
||||
InOrderURISelector.h ServerStatURISelector.cc \
|
||||
ServerStatURISelector.h GZipDecoder.cc GZipDecoder.h \
|
||||
Sqlite3MozCookieParser.cc Sqlite3MozCookieParser.h \
|
||||
AsyncNameResolver.cc AsyncNameResolver.h \
|
||||
IteratableChunkChecksumValidator.cc \
|
||||
IteratableChunkChecksumValidator.h \
|
||||
|
@ -572,14 +575,15 @@ am__libaria2c_a_SOURCES_DIST = Socket.h SocketCore.cc SocketCore.h \
|
|||
inet_aton.h localtime_r.c localtime_r.h strptime.c strptime.h \
|
||||
timegm.c timegm.h
|
||||
@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) \
|
||||
@HAVE_SQLITE3_TRUE@am__objects_2 = Sqlite3MozCookieParser.$(OBJEXT)
|
||||
@ENABLE_ASYNC_DNS_TRUE@am__objects_3 = AsyncNameResolver.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_4 = 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_4 = Data.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_5 = Data.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ Dictionary.$(OBJEXT) List.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ MetaFileUtil.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BencodeVisitor.$(OBJEXT) \
|
||||
|
@ -692,7 +696,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_5 = Metalinker.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@am__objects_6 = Metalinker.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntry.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkResource.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkProcessorFactory.$(OBJEXT) \
|
||||
|
@ -718,20 +722,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_6 = \
|
||||
@ENABLE_LIBXML2_TRUE@am__objects_7 = \
|
||||
@ENABLE_LIBXML2_TRUE@ XML2SAXMetalinkProcessor.$(OBJEXT)
|
||||
@ENABLE_LIBEXPAT_TRUE@am__objects_7 = \
|
||||
@ENABLE_LIBEXPAT_TRUE@am__objects_8 = \
|
||||
@ENABLE_LIBEXPAT_TRUE@ ExpatMetalinkProcessor.$(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) \
|
||||
@HAVE_ASCTIME_R_FALSE@am__objects_9 = asctime_r.$(OBJEXT)
|
||||
@HAVE_BASENAME_FALSE@am__objects_10 = libgen.$(OBJEXT)
|
||||
@HAVE_GETADDRINFO_FALSE@am__objects_11 = getaddrinfo.$(OBJEXT)
|
||||
@HAVE_GAI_STRERROR_FALSE@am__objects_12 = gai_strerror.$(OBJEXT)
|
||||
@HAVE_GETTIMEOFDAY_FALSE@am__objects_13 = gettimeofday.$(OBJEXT)
|
||||
@HAVE_INET_ATON_FALSE@am__objects_14 = inet_aton.$(OBJEXT)
|
||||
@HAVE_LOCALTIME_R_FALSE@am__objects_15 = localtime_r.$(OBJEXT)
|
||||
@HAVE_STRPTIME_FALSE@am__objects_16 = strptime.$(OBJEXT)
|
||||
@HAVE_TIMEGM_FALSE@am__objects_17 = timegm.$(OBJEXT)
|
||||
am__objects_18 = SocketCore.$(OBJEXT) Command.$(OBJEXT) \
|
||||
AbstractCommand.$(OBJEXT) \
|
||||
InitiateConnectionCommandFactory.$(OBJEXT) \
|
||||
DownloadCommand.$(OBJEXT) \
|
||||
|
@ -809,8 +813,9 @@ am__objects_17 = 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__objects_16)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_17)
|
||||
$(am__objects_14) $(am__objects_15) $(am__objects_16) \
|
||||
$(am__objects_17)
|
||||
am_libaria2c_a_OBJECTS = $(am__objects_18)
|
||||
libaria2c_a_OBJECTS = $(am_libaria2c_a_OBJECTS)
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
|
||||
|
@ -939,6 +944,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
@ -1136,19 +1143,21 @@ SRCS = Socket.h SocketCore.cc SocketCore.h BinaryStream.h Command.cc \
|
|||
$(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_16)
|
||||
$(am__append_15) $(am__append_16) $(am__append_17)
|
||||
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@ @LIBZ_LIBS@ #-lprofiler
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
@SQLITE3_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@\
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
@LIBZ_CPPFLAGS@ @SQLITE3_CPPFLAGS@\
|
||||
-DLOCALEDIR=\"$(localedir)\" @DEFS@ #-pg
|
||||
|
||||
all: all-am
|
||||
|
||||
|
@ -1486,6 +1495,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SleepCommand.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SocketCore.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpeedCalc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sqlite3MozCookieParser.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamCheckIntegrityEntry.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StreamFileAllocationEntry.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringFormat.Po@am__quote@
|
||||
|
|
|
@ -0,0 +1,118 @@
|
|||
/* <!-- 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 "Sqlite3MozCookieParser.h"
|
||||
#include "RecoverableException.h"
|
||||
#include "Util.h"
|
||||
#include "StringFormat.h"
|
||||
#include "A2STR.h"
|
||||
#include <cstring>
|
||||
#include <sqlite3.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
Sqlite3MozCookieParser::Sqlite3MozCookieParser() {}
|
||||
|
||||
Sqlite3MozCookieParser::~Sqlite3MozCookieParser() {}
|
||||
|
||||
static std::string toString(const char* str)
|
||||
{
|
||||
if(str) {
|
||||
return str;
|
||||
} else {
|
||||
return A2STR::NIL;
|
||||
}
|
||||
}
|
||||
|
||||
static int cookieRowMapper(void* data, int rowIndex,
|
||||
char** values, char** names)
|
||||
{
|
||||
try {
|
||||
int64_t expireDate = Util::parseLLInt(toString(values[3]));
|
||||
// TODO assuming time_t is int32_t...
|
||||
if(expireDate > INT32_MAX) {
|
||||
expireDate = INT32_MAX;
|
||||
}
|
||||
|
||||
Cookie c(toString(values[4]), // name
|
||||
toString(values[5]), // value
|
||||
expireDate, // expires
|
||||
toString(values[1]), // path
|
||||
toString(values[0]), // domain
|
||||
strcmp(toString(values[2]).c_str(), "1") == 0 ? true:false //secure
|
||||
);
|
||||
|
||||
if(c.good()) {
|
||||
((std::deque<Cookie>*)data)->push_back(c);
|
||||
}
|
||||
} catch(RecoverableException& e) {
|
||||
//failed to parse expiry.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::deque<Cookie> Sqlite3MozCookieParser::parse(const std::string& filename)
|
||||
{
|
||||
sqlite3* db = 0;
|
||||
|
||||
int ret;
|
||||
ret = sqlite3_open_v2(filename.c_str(), &db, SQLITE_OPEN_READONLY, 0);
|
||||
if(SQLITE_OK != ret) {
|
||||
std::string errMsg = sqlite3_errmsg(db);
|
||||
sqlite3_close(db);
|
||||
throw RecoverableException
|
||||
(StringFormat("Failed to open SQLite3 database: %s",
|
||||
errMsg.c_str()).str());
|
||||
}
|
||||
std::deque<Cookie> cookies;
|
||||
char* sqlite3ErrMsg = 0;
|
||||
static const char* QUERY =
|
||||
"SELECT host, path, isSecure, expiry, name, value FROM moz_cookies";
|
||||
ret = sqlite3_exec(db, QUERY, cookieRowMapper, &cookies, &sqlite3ErrMsg);
|
||||
std::string errMsg;
|
||||
if(sqlite3ErrMsg) {
|
||||
errMsg = sqlite3ErrMsg;
|
||||
sqlite3_free(sqlite3ErrMsg);
|
||||
}
|
||||
if(SQLITE_OK != ret) {
|
||||
sqlite3_close(db);
|
||||
throw RecoverableException
|
||||
(StringFormat("Failed to read SQLite3 database: %s",
|
||||
errMsg.c_str()).str());
|
||||
}
|
||||
sqlite3_close(db);
|
||||
return cookies;
|
||||
}
|
||||
|
||||
} // namespace aria2
|
|
@ -0,0 +1,56 @@
|
|||
/* <!-- 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_SQLITE3_MOZ_COOKIE_PARSER_H_
|
||||
#define _D_SQLITE3_MOZ_COOKIE_PARSER_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "Cookie.h"
|
||||
#include <string>
|
||||
#include <deque>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class Sqlite3MozCookieParser {
|
||||
public:
|
||||
Sqlite3MozCookieParser();
|
||||
|
||||
~Sqlite3MozCookieParser();
|
||||
|
||||
std::deque<Cookie> parse(const std::string& filename);
|
||||
};
|
||||
|
||||
} // namespace aria2
|
||||
|
||||
#endif // _D_SQLITE3_MOZ_COOKIE_PARSER_H_
|
|
@ -385,10 +385,11 @@ int main(int argc, char* argv[])
|
|||
if(op->defined(PREF_LOAD_COOKIES)) {
|
||||
File cookieFile(op->get(PREF_LOAD_COOKIES));
|
||||
if(cookieFile.isFile()) {
|
||||
std::ifstream in(op->get(PREF_LOAD_COOKIES).c_str());
|
||||
CookieBoxFactorySingletonHolder::instance()->loadDefaultCookie(in);
|
||||
CookieBoxFactorySingletonHolder::instance()->loadDefaultCookie
|
||||
(op->get(PREF_LOAD_COOKIES));
|
||||
} else {
|
||||
logger->error(MSG_LOADING_COOKIE_FAILED, op->get(PREF_LOAD_COOKIES).c_str());
|
||||
logger->error(MSG_LOADING_COOKIE_FAILED,
|
||||
op->get(PREF_LOAD_COOKIES).c_str());
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "CookieBoxFactory.h"
|
||||
#include "CookieBox.h"
|
||||
#include <fstream>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
@ -9,6 +8,7 @@ class CookieBoxFactoryTest:public CppUnit::TestFixture {
|
|||
|
||||
CPPUNIT_TEST_SUITE(CookieBoxFactoryTest);
|
||||
CPPUNIT_TEST(testLoadDefaultCookie);
|
||||
CPPUNIT_TEST(testLoadDefaultCookie_sqlite3);
|
||||
CPPUNIT_TEST(testCreateNewInstance);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
private:
|
||||
|
@ -18,6 +18,7 @@ public:
|
|||
}
|
||||
|
||||
void testLoadDefaultCookie();
|
||||
void testLoadDefaultCookie_sqlite3();
|
||||
void testCreateNewInstance();
|
||||
};
|
||||
|
||||
|
@ -26,11 +27,9 @@ CPPUNIT_TEST_SUITE_REGISTRATION( CookieBoxFactoryTest );
|
|||
|
||||
void CookieBoxFactoryTest::testLoadDefaultCookie()
|
||||
{
|
||||
std::ifstream f("nscookietest.txt");
|
||||
|
||||
CookieBoxFactory factory;
|
||||
|
||||
factory.loadDefaultCookie(f);
|
||||
factory.loadDefaultCookie("nscookietest.txt");
|
||||
|
||||
Cookies cookies = factory.getDefaultCookies();
|
||||
|
||||
|
@ -65,11 +64,22 @@ void CookieBoxFactoryTest::testLoadDefaultCookie()
|
|||
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), c.domain);
|
||||
}
|
||||
|
||||
void CookieBoxFactoryTest::testLoadDefaultCookie_sqlite3()
|
||||
{
|
||||
CookieBoxFactory factory;
|
||||
factory.loadDefaultCookie("cookies.sqlite");
|
||||
const std::deque<Cookie>& cookies = factory.getDefaultCookies();
|
||||
#ifdef HAVE_SQLITE3
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, cookies.size());
|
||||
#else // !HAVE_SQLITE3
|
||||
CPPUNIT_ASSERT(cookies.empty());
|
||||
#endif // !HAVE_SQLITE3
|
||||
}
|
||||
|
||||
void CookieBoxFactoryTest::testCreateNewInstance()
|
||||
{
|
||||
std::ifstream f("nscookietest.txt");
|
||||
CookieBoxFactory factory;
|
||||
factory.loadDefaultCookie(f);
|
||||
factory.loadDefaultCookie("nscookietest.txt");
|
||||
SharedHandle<CookieBox> box = factory.createNewInstance();
|
||||
std::deque<Cookie> cookies = box->criteriaFind("localhost", "/", 0, true);
|
||||
|
||||
|
|
|
@ -63,6 +63,10 @@ if HAVE_LIBZ
|
|||
aria2c_SOURCES += GZipDecoderTest.cc
|
||||
endif # HAVE_LIBZ
|
||||
|
||||
if HAVE_SQLITE3
|
||||
aria2c_SOURCES += Sqlite3MozCookieParserTest.cc
|
||||
endif # HAVE_SQLITE3
|
||||
|
||||
if ENABLE_MESSAGE_DIGEST
|
||||
aria2c_SOURCES += MessageDigestHelperTest.cc\
|
||||
IteratableChunkChecksumValidatorTest.cc\
|
||||
|
@ -180,6 +184,7 @@ aria2c_LDADD = ../src/libaria2c.a\
|
|||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
@SQLITE3_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
AM_CPPFLAGS = -Wall\
|
||||
${CPPUNIT_CFLAGS}\
|
||||
|
@ -187,7 +192,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@\
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
@LIBZ_CPPFLAGS@ @SQLITE3_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
|
||||
EXTRA_DIST = 4096chunk.txt\
|
||||
chunkChecksumTestFile250.txt\
|
||||
|
|
|
@ -35,11 +35,12 @@ target_triplet = @target@
|
|||
TESTS = aria2c$(EXEEXT)
|
||||
check_PROGRAMS = $(am__EXEEXT_1)
|
||||
@HAVE_LIBZ_TRUE@am__append_1 = GZipDecoderTest.cc
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_2 = MessageDigestHelperTest.cc\
|
||||
@HAVE_SQLITE3_TRUE@am__append_2 = Sqlite3MozCookieParserTest.cc
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__append_3 = MessageDigestHelperTest.cc\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChunkChecksumValidatorTest.cc\
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidatorTest.cc
|
||||
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_3 = BtAllowedFastMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@am__append_4 = BtAllowedFastMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtBitfieldMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtCancelMessageTest.cc\
|
||||
@ENABLE_BITTORRENT_TRUE@ BtChokeMessageTest.cc\
|
||||
|
@ -131,7 +132,7 @@ check_PROGRAMS = $(am__EXEEXT_1)
|
|||
@ENABLE_BITTORRENT_TRUE@ MockPieceStorage.h\
|
||||
@ENABLE_BITTORRENT_TRUE@ RarestPieceSelectorTest.cc
|
||||
|
||||
@ENABLE_METALINK_TRUE@am__append_4 = MetalinkerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@am__append_5 = MetalinkerTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntryTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroupTest.cc\
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.cc\
|
||||
|
@ -156,10 +157,11 @@ am__aclocal_m4_deps = $(top_srcdir)/m4/aria2_arg.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/size_max.m4 $(top_srcdir)/m4/sqlite3.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
|
||||
|
@ -191,7 +193,7 @@ am__aria2c_SOURCES_DIST = AllTest.cc SocketCoreTest.cc \
|
|||
SignatureTest.cc ServerStatManTest.cc \
|
||||
ServerStatURISelectorTest.cc InOrderURISelectorTest.cc \
|
||||
ServerStatTest.cc GZipDecoderTest.cc \
|
||||
MessageDigestHelperTest.cc \
|
||||
Sqlite3MozCookieParserTest.cc MessageDigestHelperTest.cc \
|
||||
IteratableChunkChecksumValidatorTest.cc \
|
||||
IteratableChecksumValidatorTest.cc BtAllowedFastMessageTest.cc \
|
||||
BtBitfieldMessageTest.cc BtCancelMessageTest.cc \
|
||||
|
@ -241,11 +243,13 @@ am__aria2c_SOURCES_DIST = AllTest.cc SocketCoreTest.cc \
|
|||
MetalinkPostDownloadHandlerTest.cc MetalinkHelperTest.cc \
|
||||
MetalinkParserControllerTest.cc MetalinkProcessorTest.cc
|
||||
@HAVE_LIBZ_TRUE@am__objects_1 = GZipDecoderTest.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_2 = \
|
||||
@HAVE_SQLITE3_TRUE@am__objects_2 = \
|
||||
@HAVE_SQLITE3_TRUE@ Sqlite3MozCookieParserTest.$(OBJEXT)
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@am__objects_3 = \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ MessageDigestHelperTest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChunkChecksumValidatorTest.$(OBJEXT) \
|
||||
@ENABLE_MESSAGE_DIGEST_TRUE@ IteratableChecksumValidatorTest.$(OBJEXT)
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_3 = \
|
||||
@ENABLE_BITTORRENT_TRUE@am__objects_4 = \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtAllowedFastMessageTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtBitfieldMessageTest.$(OBJEXT) \
|
||||
@ENABLE_BITTORRENT_TRUE@ BtCancelMessageTest.$(OBJEXT) \
|
||||
|
@ -319,7 +323,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_4 = MetalinkerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@am__objects_5 = MetalinkerTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkEntryTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ Metalink2RequestGroupTest.$(OBJEXT) \
|
||||
@ENABLE_METALINK_TRUE@ MetalinkPostDownloadHandlerTest.$(OBJEXT) \
|
||||
|
@ -360,7 +364,7 @@ am_aria2c_OBJECTS = AllTest.$(OBJEXT) SocketCoreTest.$(OBJEXT) \
|
|||
ServerStatURISelectorTest.$(OBJEXT) \
|
||||
InOrderURISelectorTest.$(OBJEXT) ServerStatTest.$(OBJEXT) \
|
||||
$(am__objects_1) $(am__objects_2) $(am__objects_3) \
|
||||
$(am__objects_4)
|
||||
$(am__objects_4) $(am__objects_5)
|
||||
aria2c_OBJECTS = $(am_aria2c_OBJECTS)
|
||||
am__DEPENDENCIES_1 =
|
||||
aria2c_DEPENDENCIES = ../src/libaria2c.a $(am__DEPENDENCIES_1)
|
||||
|
@ -484,6 +488,8 @@ PRI_MACROS_BROKEN = @PRI_MACROS_BROKEN@
|
|||
RANLIB = @RANLIB@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SQLITE3_CPPFLAGS = @SQLITE3_CPPFLAGS@
|
||||
SQLITE3_LIBS = @SQLITE3_LIBS@
|
||||
STRIP = @STRIP@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
|
@ -578,7 +584,7 @@ aria2c_SOURCES = AllTest.cc SocketCoreTest.cc array_funTest.cc \
|
|||
SignatureTest.cc ServerStatManTest.cc \
|
||||
ServerStatURISelectorTest.cc InOrderURISelectorTest.cc \
|
||||
ServerStatTest.cc $(am__append_1) $(am__append_2) \
|
||||
$(am__append_3) $(am__append_4)
|
||||
$(am__append_3) $(am__append_4) $(am__append_5)
|
||||
|
||||
#aria2c_CXXFLAGS = ${CPPUNIT_CFLAGS} -I../src -I../lib -Wall -D_FILE_OFFSET_BITS=64
|
||||
#aria2c_LDFLAGS = ${CPPUNIT_LIBS}
|
||||
|
@ -586,6 +592,7 @@ aria2c_LDADD = ../src/libaria2c.a\
|
|||
@LIBINTL@ @LIBGNUTLS_LIBS@\
|
||||
@LIBGCRYPT_LIBS@ @OPENSSL_LIBS@ @XML_LIBS@ @LIBARES_LIBS@\
|
||||
@LIBCARES_LIBS@ @WINSOCK_LIBS@ @LIBEXPAT_LIBS@ @LIBZ_LIBS@\
|
||||
@SQLITE3_LIBS@\
|
||||
${CPPUNIT_LIBS}
|
||||
|
||||
AM_CPPFLAGS = -Wall\
|
||||
|
@ -594,7 +601,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@\
|
||||
@LIBZ_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
@LIBZ_CPPFLAGS@ @SQLITE3_CPPFLAGS@ -DLOCALEDIR=\"$(localedir)\" @DEFS@
|
||||
|
||||
EXTRA_DIST = 4096chunk.txt\
|
||||
chunkChecksumTestFile250.txt\
|
||||
|
@ -793,6 +800,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SingletonHolderTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SocketCoreTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SpeedCalcTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Sqlite3MozCookieParserTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StringFormatTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TagContainerTest.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TaggedItemTest.Po@am__quote@
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
#include "Sqlite3MozCookieParser.h"
|
||||
#include "RecoverableException.h"
|
||||
#include "Util.h"
|
||||
#include <iostream>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
namespace aria2 {
|
||||
|
||||
class Sqlite3MozCookieParserTest:public CppUnit::TestFixture {
|
||||
|
||||
CPPUNIT_TEST_SUITE(Sqlite3MozCookieParserTest);
|
||||
CPPUNIT_TEST(testParse);
|
||||
CPPUNIT_TEST(testParse_fileNotFound);
|
||||
CPPUNIT_TEST(testParse_badfile);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
public:
|
||||
void setUp() {}
|
||||
|
||||
void tearDown() {}
|
||||
|
||||
void testParse();
|
||||
void testParse_fileNotFound();
|
||||
void testParse_badfile();
|
||||
};
|
||||
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Sqlite3MozCookieParserTest);
|
||||
|
||||
void Sqlite3MozCookieParserTest::testParse()
|
||||
{
|
||||
Sqlite3MozCookieParser parser;
|
||||
std::deque<Cookie> cookies = parser.parse("cookies.sqlite");
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)3, cookies.size());
|
||||
|
||||
const Cookie& localhost = cookies[0];
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("localhost"), localhost.domain);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("/"), localhost.path);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("JSESSIONID"), localhost.name);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("123456789"), localhost.value);
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)1200000000, localhost.expires);
|
||||
CPPUNIT_ASSERT_EQUAL(true, localhost.secure);
|
||||
|
||||
const Cookie& nullValue = cookies[1];
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("null_value"), nullValue.domain);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("/path/to"), nullValue.path);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("uid"), nullValue.name);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string(""), nullValue.value);
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)0, nullValue.expires);
|
||||
CPPUNIT_ASSERT_EQUAL(false, nullValue.secure);
|
||||
|
||||
// See row id=3 has no name, so it is skipped.
|
||||
|
||||
const Cookie& overflowTime = cookies[2];
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("overflow_time_t"), overflowTime.domain);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("/path/to"), overflowTime.path);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("foo"), overflowTime.name);
|
||||
CPPUNIT_ASSERT_EQUAL(std::string("bar"), overflowTime.value);
|
||||
CPPUNIT_ASSERT_EQUAL((time_t)INT32_MAX, overflowTime.expires);
|
||||
CPPUNIT_ASSERT_EQUAL(false, overflowTime.secure);
|
||||
}
|
||||
|
||||
void Sqlite3MozCookieParserTest::testParse_fileNotFound()
|
||||
{
|
||||
Sqlite3MozCookieParser parser;
|
||||
try {
|
||||
parser.parse("fileNotFound");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(RecoverableException& e) {
|
||||
// SUCCESS
|
||||
}
|
||||
}
|
||||
|
||||
void Sqlite3MozCookieParserTest::testParse_badfile()
|
||||
{
|
||||
Sqlite3MozCookieParser parser;
|
||||
try {
|
||||
parser.parse("badcookies.sqlite");
|
||||
CPPUNIT_FAIL("exception must be thrown.");
|
||||
} catch(RecoverableException& e) {
|
||||
// SUCCESS
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace aria2
|
Binary file not shown.
Loading…
Reference in New Issue