summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.in1
-rw-r--r--config.h.in3
-rwxr-xr-xconfigure68
-rw-r--r--configure.ac5
-rw-r--r--html/Makefile.in1
-rw-r--r--lang/Makefile.in1
-rw-r--r--libtest/Makefile.in1
-rw-r--r--m4/Makefile.in1
-rw-r--r--m4/check_zlib.m440
-rw-r--r--man/Makefile.in1
-rw-r--r--man/httrack.12
-rw-r--r--src/Makefile.am8
-rw-r--r--src/Makefile.in18
-rw-r--r--src/htsback.c6
-rw-r--r--src/htsbasenet.h96
-rw-r--r--src/htslib.c12
-rw-r--r--src/htsmodules.c125
-rw-r--r--src/htsparse.c3
-rw-r--r--src/htstools.c10
-rw-r--r--templates/Makefile.in1
20 files changed, 147 insertions, 256 deletions
diff --git a/Makefile.in b/Makefile.in
index 5777f4f..316ff4f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -132,6 +132,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/config.h.in b/config.h.in
index dd9abcc..b91fc58 100644
--- a/config.h.in
+++ b/config.h.in
@@ -54,6 +54,9 @@
/* Check for large files support */
#undef HTS_LFS
+/* Check for OpenSSL */
+#undef HTS_USEOPENSSL
+
/* Check for libiconv */
#undef LIBICONV
diff --git a/configure b/configure
index 852f639..4712410 100755
--- a/configure
+++ b/configure
@@ -638,6 +638,7 @@ THREADS_CFLAGS
THREADS_LIBS
LFS_FLAG
V6_FLAG
+OPENSSL_LIBS
VERSION_INFO
DEFAULT_CFLAGS
CXXCPP
@@ -15497,24 +15498,26 @@ if test "${with_zlib+set}" = set; then :
withval=$with_zlib; if test "$withval" != no ; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
$as_echo "yes" >&6; }
- ZLIB_HOME="$withval"
+ if test -d "$withval"
+ then
+ ZLIB_HOME="$withval"
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Sorry, $withval does not exist, checking usual places" >&5
+$as_echo "$as_me: WARNING: Sorry, $withval does not exist, checking usual places" >&2;}
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
-else
+fi
+
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
ZLIB_HOME=/usr/local
if test ! -f "${ZLIB_HOME}/include/zlib.h"
then
ZLIB_HOME=/usr
fi
-fi
-
-
#
# Locate zlib, if wanted
#
@@ -15577,7 +15580,7 @@ fi
if test "x$ac_cv_header_zlib_h" = xyes; then :
zlib_cv_zlib_h=yes
else
- zlib_cvs_zlib_h=no
+ zlib_cv_zlib_h=no
fi
@@ -15657,6 +15660,55 @@ fi
+### OpenSSL
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SSL_library_init in -lssl" >&5
+$as_echo_n "checking for SSL_library_init in -lssl... " >&6; }
+if ${ac_cv_lib_ssl_SSL_library_init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lssl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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 SSL_library_init ();
+int
+main ()
+{
+return SSL_library_init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_ssl_SSL_library_init=yes
+else
+ ac_cv_lib_ssl_SSL_library_init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ssl_SSL_library_init" >&5
+$as_echo "$ac_cv_lib_ssl_SSL_library_init" >&6; }
+if test "x$ac_cv_lib_ssl_SSL_library_init" = xyes; then :
+ OPENSSL_LIBS="-lcrypto -lssl"
+
+$as_echo "#define HTS_USEOPENSSL 1" >>confdefs.h
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: not necessary" >&5
+$as_echo "not necessary" >&6; }
+fi
+
+
+
### Support IPv6
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lc" >&5
$as_echo_n "checking for getaddrinfo in -lc... " >&6; }
diff --git a/configure.ac b/configure.ac
index b7fdc90..384395f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,6 +114,11 @@ AC_MSG_WARN([*** in_addr_t not found]),
### zlib
CHECK_ZLIB()
+### OpenSSL
+AC_CHECK_LIB(ssl, SSL_library_init, [OPENSSL_LIBS="-lcrypto -lssl"
+AC_DEFINE(HTS_USEOPENSSL, 1,[Check for OpenSSL])], AC_MSG_RESULT([not necessary]))
+AC_SUBST(OPENSSL_LIBS)
+
### Support IPv6
AC_CHECK_LIB(c, getaddrinfo, [V6_FLAG="-DINET6"
AC_DEFINE(HTS_INET6, 1,[Check for IPv6])], AC_MSG_WARN([*** IPv6 not found IPv6 compatibility disabled]))
diff --git a/html/Makefile.in b/html/Makefile.in
index 7115264..62791b9 100644
--- a/html/Makefile.in
+++ b/html/Makefile.in
@@ -141,6 +141,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/lang/Makefile.in b/lang/Makefile.in
index ac4ad5f..bf17b78 100644
--- a/lang/Makefile.in
+++ b/lang/Makefile.in
@@ -118,6 +118,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/libtest/Makefile.in b/libtest/Makefile.in
index da3eef9..ebaaa86 100644
--- a/libtest/Makefile.in
+++ b/libtest/Makefile.in
@@ -183,6 +183,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 777795a..886f309 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -107,6 +107,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/m4/check_zlib.m4 b/m4/check_zlib.m4
index b02bd33..61923dc 100644
--- a/m4/check_zlib.m4
+++ b/m4/check_zlib.m4
@@ -1,6 +1,28 @@
-dnl Available from the GNU Autoconf Macro Archive at:
-dnl http://www.gnu.org/software/ac-archive/htmldoc/check_zlib.html
+dnl @synopsis CHECK_ZLIB()
dnl
+dnl This macro searches for an installed zlib library. If nothing was
+dnl specified when calling configure, it searches first in /usr/local
+dnl and then in /usr. If the --with-zlib=DIR is specified, it will try
+dnl to find it in DIR/include/zlib.h and DIR/lib/libz.a. If
+dnl --without-zlib is specified, the library is not searched at all.
+dnl
+dnl If either the header file (zlib.h) or the library (libz) is not
+dnl found, the configuration exits on error, asking for a valid zlib
+dnl installation directory or --without-zlib.
+dnl
+dnl The macro defines the symbol HAVE_LIBZ if the library is found. You
+dnl should use autoheader to include a definition for this symbol in a
+dnl config.h file. Sample usage in a C/C++ source is as follows:
+dnl
+dnl #ifdef HAVE_LIBZ
+dnl #include <zlib.h>
+dnl #endif /* HAVE_LIBZ */
+dnl
+dnl @category InstalledPackages
+dnl @author Loic Dachary <loic@senga.org>
+dnl @version 2004-09-20
+dnl @license GPLWithACException
+
AC_DEFUN([CHECK_ZLIB],
#
# Handle user hints
@@ -12,17 +34,21 @@ AC_ARG_WITH(zlib,
--without-zlib to disable zlib usage completely],
[if test "$withval" != no ; then
AC_MSG_RESULT(yes)
- ZLIB_HOME="$withval"
+ if test -d "$withval"
+ then
+ ZLIB_HOME="$withval"
+ else
+ AC_MSG_WARN([Sorry, $withval does not exist, checking usual places])
+ fi
else
AC_MSG_RESULT(no)
-fi], [
-AC_MSG_RESULT(yes)
+fi])
+
ZLIB_HOME=/usr/local
if test ! -f "${ZLIB_HOME}/include/zlib.h"
then
ZLIB_HOME=/usr
fi
-])
#
# Locate zlib, if wanted
@@ -36,7 +62,7 @@ then
AC_LANG_SAVE
AC_LANG_C
AC_CHECK_LIB(z, inflateEnd, [zlib_cv_libz=yes], [zlib_cv_libz=no])
- AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cvs_zlib_h=no])
+ AC_CHECK_HEADER(zlib.h, [zlib_cv_zlib_h=yes], [zlib_cv_zlib_h=no])
AC_LANG_RESTORE
if test "$zlib_cv_libz" = "yes" -a "$zlib_cv_zlib_h" = "yes"
then
diff --git a/man/Makefile.in b/man/Makefile.in
index 68cc26f..c0fe0bf 100644
--- a/man/Makefile.in
+++ b/man/Makefile.in
@@ -111,6 +111,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
diff --git a/man/httrack.1 b/man/httrack.1
index 8cc25a2..7dc14f0 100644
--- a/man/httrack.1
+++ b/man/httrack.1
@@ -1,7 +1,7 @@
.\" Process this file with
.\" groff -man -Tascii httrack.1
.\"
-.TH httrack 1 "HTTrack version 3.47 (compiled May 1 2013)" "httrack website copier"
+.TH httrack 1 "May 2013" "httrack website copier"
.SH NAME
httrack \- offline browser : copy websites to a local directory
.SH SYNOPSIS
diff --git a/src/Makefile.am b/src/Makefile.am
index 0b1998e..0901f6d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -25,8 +25,8 @@ INCLUDES = \
bin_PROGRAMS = proxytrack httrack htsserver
-httrack_LDADD = $(THREADS_LIBS) libhttrack.la
-htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) libhttrack.la
+httrack_LDADD = $(THREADS_LIBS) $(OPENSSL_LIBS) libhttrack.la
+htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) $(OPENSSL_LIBS) libhttrack.la
proxytrack_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS)
proxytrack_CFLAGS = $(AM_CFLAGS) -DNO_MALLOCT
@@ -65,11 +65,11 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
htsmms.h \
minizip/crypt.h minizip/ioapi.h minizip/mztools.h minizip/unzip.h minizip/zip.h \
mmsrip/error.h mmsrip/mms.h
-libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
+libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
libhtsjava_la_SOURCES = htsjava.c htsjava.h
-libhtsjava_la_LIBADD = $(THREADS_LIBS) $(DL_LIBS) libhttrack.la
+libhtsjava_la_LIBADD = $(THREADS_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) libhttrack.la
libhtsjava_la_LDFLAGS = -version-info $(VERSION_INFO)
EXTRA_DIST = httrack.h webhttrack \
diff --git a/src/Makefile.in b/src/Makefile.in
index 4c2d4fb..30a1e93 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -67,12 +67,12 @@ libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
am__DEPENDENCIES_1 =
libhtsjava_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1) libhttrack.la
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) libhttrack.la
am_libhtsjava_la_OBJECTS = htsjava.lo
libhtsjava_la_OBJECTS = $(am_libhtsjava_la_OBJECTS)
libhttrack_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_libhttrack_la_OBJECTS = htscore.lo htsparse.lo htsback.lo \
htscache.lo htscatchurl.lo htsfilters.lo htsftp.lo htshash.lo \
htsinthash.lo htshelp.lo htslib.lo htscoremain.lo htsname.lo \
@@ -86,10 +86,11 @@ PROGRAMS = $(bin_PROGRAMS)
am_htsserver_OBJECTS = htsserver.$(OBJEXT) htsweb.$(OBJEXT)
htsserver_OBJECTS = $(am_htsserver_OBJECTS)
htsserver_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
- libhttrack.la
+ $(am__DEPENDENCIES_1) libhttrack.la
httrack_SOURCES = httrack.c
httrack_OBJECTS = httrack.$(OBJEXT)
-httrack_DEPENDENCIES = $(am__DEPENDENCIES_1) libhttrack.la
+httrack_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ libhttrack.la
am_proxytrack_OBJECTS = proxytrack-main.$(OBJEXT) \
proxytrack-proxytrack.$(OBJEXT) proxytrack-store.$(OBJEXT) \
proxytrack-htsinthash.$(OBJEXT) proxytrack-htsmd5.$(OBJEXT) \
@@ -176,6 +177,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -268,8 +270,8 @@ INCLUDES = \
-DDATADIR=\""$(datadir)"\" \
-DLIBDIR=\""$(libdir)"\"
-httrack_LDADD = $(THREADS_LIBS) libhttrack.la
-htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) libhttrack.la
+httrack_LDADD = $(THREADS_LIBS) $(OPENSSL_LIBS) libhttrack.la
+htsserver_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS) $(OPENSSL_LIBS) libhttrack.la
proxytrack_LDADD = $(THREADS_LIBS) $(SOCKET_LIBS)
proxytrack_CFLAGS = $(AM_CFLAGS) -DNO_MALLOCT
lib_LTLIBRARIES = libhttrack.la libhtsjava.la
@@ -306,10 +308,10 @@ libhttrack_la_SOURCES = htscore.c htsparse.c htsback.c htscache.c \
minizip/crypt.h minizip/ioapi.h minizip/mztools.h minizip/unzip.h minizip/zip.h \
mmsrip/error.h mmsrip/mms.h
-libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
+libhttrack_la_LIBADD = $(THREADS_LIBS) $(ZLIB_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) $(SOCKET_LIBS) $(ICONV_LIBS)
libhttrack_la_LDFLAGS = -version-info $(VERSION_INFO)
libhtsjava_la_SOURCES = htsjava.c htsjava.h
-libhtsjava_la_LIBADD = $(THREADS_LIBS) $(DL_LIBS) libhttrack.la
+libhtsjava_la_LIBADD = $(THREADS_LIBS) $(OPENSSL_LIBS) $(DL_LIBS) libhttrack.la
libhtsjava_la_LDFLAGS = -version-info $(VERSION_INFO)
EXTRA_DIST = httrack.h webhttrack \
minizip/ChangeLogUnzip \
diff --git a/src/htsback.c b/src/htsback.c
index fafa8e4..55bf041 100644
--- a/src/htsback.c
+++ b/src/htsback.c
@@ -1952,7 +1952,7 @@ int back_add(struct_back * sback, httrackp * opt, cache_back * cache, char *adr,
}
#endif
#if HTS_USEOPENSSL
- else if (SSL_is_available && strfield(back[p].url_adr, "https://")) { // let's rock
+ else if (strfield(back[p].url_adr, "https://")) { // let's rock
back[p].r.ssl = 1;
// back[p].r.ssl_soc = NULL;
back[p].r.ssl_con = NULL;
@@ -2621,7 +2621,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
#if HTS_USEOPENSSL
/* SSL mode */
- if (SSL_is_available && back[i].r.ssl) {
+ if (back[i].r.ssl) {
// handshake not yet launched
if (!back[i].r.ssl_con) {
SSL_CTX_set_options(openssl_ctx, SSL_OP_ALL);
@@ -2691,7 +2691,7 @@ void back_wait(struct_back * sback, httrackp * opt, cache_back * cache,
// attente gethostbyname
}
#if HTS_USEOPENSSL
- else if (SSL_is_available && back[i].status == STATUS_SSL_WAIT_HANDSHAKE) { // wait for SSL handshake
+ else if (back[i].status == STATUS_SSL_WAIT_HANDSHAKE) { // wait for SSL handshake
/* SSL mode */
if (back[i].r.ssl) {
int conn_code;
diff --git a/src/htsbasenet.h b/src/htsbasenet.h
index 723da97..b907c09 100644
--- a/src/htsbasenet.h
+++ b/src/htsbasenet.h
@@ -77,103 +77,15 @@ typedef struct hostent t_hostent;
#ifndef HTS_OPENSSL_H_INCLUDED
#define HTS_OPENSSL_H_INCLUDED
-/*
+/* OpenSSL definitions */
#include <openssl/ssl.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
-*/
-
-/* Library internal definictions */
-#ifdef HTS_INTERNAL_BYTECODE
-
-/* OpenSSL definitions */
-#define SSL_shutdown hts_ptrfunc_SSL_shutdown
-#define SSL_free hts_ptrfunc_SSL_free
-#define SSL_new hts_ptrfunc_SSL_new
-#define SSL_clear hts_ptrfunc_SSL_clear
-#define SSL_set_fd hts_ptrfunc_SSL_set_fd
-#define SSL_set_connect_state hts_ptrfunc_SSL_set_connect_state
-#define SSL_connect hts_ptrfunc_SSL_connect
-#define SSL_get_error hts_ptrfunc_SSL_get_error
-#define SSL_write hts_ptrfunc_SSL_write
-#define SSL_read hts_ptrfunc_SSL_read
-#define SSL_library_init hts_ptrfunc_SSL_library_init
-#define ERR_load_crypto_strings hts_ptrfunc_ERR_load_crypto_strings
-#define ERR_load_SSL_strings hts_ptrfunc_ERR_load_SSL_strings
-#define SSLv23_client_method hts_ptrfunc_SSLv23_client_method
-#define SSL_CTX_new hts_ptrfunc_SSL_CTX_new
-#define ERR_error_string hts_ptrfunc_ERR_error_string
-#define SSL_load_error_strings hts_ptrfunc_SSL_load_error_strings
-#define SSL_CTX_ctrl hts_ptrfunc_SSL_CTX_ctrl
-
-#endif
-
-/* */
-typedef void SSL_CTX;
-typedef void *SSL;
-typedef void SSL_METHOD;
-typedef int (*t_SSL_shutdown) (SSL * ssl);
-typedef void (*t_SSL_free) (SSL * ssl);
-typedef SSL(*t_SSL_new) (SSL_CTX * ctx);
-typedef int (*t_SSL_clear) (SSL * ssl);
-typedef int (*t_SSL_set_fd) (SSL * ssl, int fd);
-typedef void (*t_SSL_set_connect_state) (SSL * ssl);
-typedef int (*t_SSL_connect) (SSL * ssl);
-typedef int (*t_SSL_get_error) (SSL * ssl, int ret);
-typedef int (*t_SSL_write) (SSL * ssl, const void *buf, int num);
-typedef int (*t_SSL_read) (SSL * ssl, void *buf, int num);
-typedef int (*t_SSL_library_init) (void);
-typedef void (*t_ERR_load_crypto_strings) (void);
-typedef void (*t_ERR_load_SSL_strings) (void);
-typedef SSL_METHOD *(*t_SSLv23_client_method) (void);
-typedef SSL_CTX *(*t_SSL_CTX_new) (SSL_METHOD * method);
-typedef char *(*t_ERR_error_string) (unsigned long e, char *buf);
-typedef void (*t_SSL_load_error_strings) (void);
-typedef long (*t_SSL_CTX_ctrl) (SSL_CTX * ctx, int cmd, long larg, char *parg);
-
-/* Library internal definictions */
-#ifdef HTS_INTERNAL_BYTECODE
-
-extern int SSL_is_available;
-extern t_SSL_shutdown SSL_shutdown;
-extern t_SSL_free SSL_free;
-extern t_SSL_new SSL_new;
-extern t_SSL_clear SSL_clear;
-extern t_SSL_set_fd SSL_set_fd;
-extern t_SSL_set_connect_state SSL_set_connect_state;
-extern t_SSL_connect SSL_connect;
-extern t_SSL_get_error SSL_get_error;
-extern t_SSL_write SSL_write;
-extern t_SSL_read SSL_read;
-extern t_SSL_library_init SSL_library_init;
-extern t_ERR_load_crypto_strings ERR_load_crypto_strings;
-extern t_ERR_load_SSL_strings ERR_load_SSL_strings;
-extern t_SSLv23_client_method SSLv23_client_method;
-extern t_SSL_CTX_new SSL_CTX_new;
-extern t_ERR_error_string ERR_error_string;
-extern t_SSL_load_error_strings SSL_load_error_strings;
-extern t_SSL_CTX_ctrl SSL_CTX_ctrl;
-
-#endif
-/*
-From /usr/include/openssl/ssl.h
-*/
-#define SSL_ERROR_NONE 0
-#define SSL_ERROR_SSL 1
-#define SSL_ERROR_WANT_READ 2
-#define SSL_ERROR_WANT_WRITE 3
-#define SSL_ERROR_WANT_X509_LOOKUP 4
-#define SSL_ERROR_SYSCALL 5 /* look at error stack/return value/errno */
-#define SSL_ERROR_ZERO_RETURN 6
-#define SSL_ERROR_WANT_CONNECT 7
-#define SSL_OP_ALL 0x000FFFFFL
-#define SSL_CTRL_OPTIONS 32
-#define SSL_CTX_set_options(ctx,op) \
- SSL_CTX_ctrl(ctx,SSL_CTRL_OPTIONS,op,NULL)
-
-//#include <openssl/bio.h>
/* OpenSSL structure */
+#include <openssl/bio.h>
+
+/* Global SSL context */
extern SSL_CTX *openssl_ctx;
#endif
diff --git a/src/htslib.c b/src/htslib.c
index bf6577e..cbb0005 100644
--- a/src/htslib.c
+++ b/src/htslib.c
@@ -2486,7 +2486,7 @@ int ident_url_absolute(const char *url, char *adr, char *fil) {
strcpybuff(adr, "ftp://"); // FTP!!
//!!p+=3;
#if HTS_USEOPENSSL
- } else if (SSL_is_available && (pos = strfield(url, "https:"))) { // HTTPS
+ } else if ((pos = strfield(url, "https:"))) { // HTTPS
strcpybuff(adr, "https://");
#endif
#if HTS_USEMMS
@@ -2641,7 +2641,7 @@ HTS_INLINE void deletehttp(htsblk * r) {
#endif
#if HTS_USEOPENSSL
/* Free OpenSSL structures */
- if (SSL_is_available && r->ssl_con) {
+ if (r->ssl_con) {
SSL_shutdown(r->ssl_con);
SSL_free(r->ssl_con);
r->ssl_con = NULL;
@@ -2702,7 +2702,7 @@ HTS_INLINE void deletesoc(T_SOC soc) {
/* Will also clean other things */
HTS_INLINE void deletesoc_r(htsblk * r) {
#if HTS_USEOPENSSL
- if (SSL_is_available && r->ssl_con) {
+ if (r->ssl_con) {
SSL_shutdown(r->ssl_con);
// SSL_CTX_set_quiet_shutdown(r->ssl_con->ctx, 1);
SSL_free(r->ssl_con);
@@ -3075,7 +3075,7 @@ HTS_INLINE int sendc(htsblk * r, const char *s) {
#endif
#if HTS_USEOPENSSL
- if (SSL_is_available && r->ssl) {
+ if (r->ssl) {
n = SSL_write(r->ssl_con, s, ssz);
} else
#endif
@@ -4871,7 +4871,7 @@ int hts_read(htsblk * r, char *buff, int size) {
#endif
//HTS_TOTAL_RECV_CHECK(size); // Diminuer au besoin si trop de données reçues
#if HTS_USEOPENSSL
- if (SSL_is_available && r->ssl) {
+ if (r->ssl) {
retour = SSL_read(r->ssl_con, buff, size);
if (retour <= 0) {
int err_code = SSL_get_error(r->ssl_con, retour);
@@ -5533,7 +5533,7 @@ HTSEXT_API int hts_init(void) {
/*
Initialize the OpensSSL library
*/
- if (!openssl_ctx && SSL_is_available) {
+ if (!openssl_ctx) {
if (SSL_load_error_strings)
SSL_load_error_strings();
SSL_library_init();
diff --git a/src/htsmodules.c b/src/htsmodules.c
index e1d2ec6..338140a 100644
--- a/src/htsmodules.c
+++ b/src/htsmodules.c
@@ -64,26 +64,6 @@ t_gzread gzread = NULL;
t_gzclose gzclose = NULL;
#endif
-int SSL_is_available = 0;
-t_SSL_shutdown SSL_shutdown = NULL;
-t_SSL_free SSL_free = NULL;
-t_SSL_CTX_ctrl SSL_CTX_ctrl = NULL;
-t_SSL_new SSL_new = NULL;
-t_SSL_clear SSL_clear = NULL;
-t_SSL_set_fd SSL_set_fd = NULL;
-t_SSL_set_connect_state SSL_set_connect_state = NULL;
-t_SSL_connect SSL_connect = NULL;
-t_SSL_get_error SSL_get_error = NULL;
-t_SSL_write SSL_write = NULL;
-t_SSL_read SSL_read = NULL;
-t_SSL_library_init SSL_library_init = NULL;
-t_ERR_load_crypto_strings ERR_load_crypto_strings = NULL;
-t_ERR_load_SSL_strings ERR_load_SSL_strings = NULL;
-t_SSLv23_client_method SSLv23_client_method = NULL;
-t_SSL_CTX_new SSL_CTX_new = NULL;
-t_ERR_error_string ERR_error_string = NULL;
-t_SSL_load_error_strings SSL_load_error_strings = NULL;
-
int V6_is_available = HTS_INET6;
static char WHAT_is_available[64] = "";
@@ -280,106 +260,15 @@ void htspe_init(void) {
/* Zlib is now statically linked */
gz_is_available = 1;
- /* OpenSSL */
-#if HTS_DLOPEN
- {
- void *handle;
-
-#ifdef _WIN32
- handle = LoadLibraryA((char *) "ssleay32");
-#else
- /* We are compatible with 0.9.6/7/8/8b and potentially above */
- static const char *const libs[] = {
-#ifdef __APPLE__
- "libssl.dylib",
-#endif
- "libssl.so.1.0",
- "libssl.so.1",
- "libssl.so.1.0.0",
- /* */
- "libssl.so.0",
- "libssl.so.0.9",
- "libssl.so.0.9.8p",
- "libssl.so.0.9.8o",
- "libssl.so.0.9.8n",
- "libssl.so.0.9.8m",
- "libssl.so.0.9.8l",
- "libssl.so.0.9.8k", /* (Debarshi Ray) */
- "libssl.so.0.9.8j", /* (Debarshi Ray) */
- "libssl.so.0.9.8g", /* Added 8g release too (Debarshi Ray) */
- "libssl.so.0.9.8b",
- "libssl.so.0.9.8",
- "libssl.so.0.9.7",
- "libssl.so.0.9.6",
- "libssl.so", /* Try harder with devel link */
- NULL
- };
- int i;
-
- for(i = 0, handle = NULL; handle == NULL && libs[i] != NULL; i++) {
- handle = dlopen(libs[i], RTLD_LAZY);
- }
-#endif
- ssl_handle = handle;
- if (handle != NULL) {
- SSL_shutdown =
- (t_SSL_shutdown) DynamicGet(handle, (char *) "SSL_shutdown");
- SSL_free = (t_SSL_free) DynamicGet(handle, (char *) "SSL_free");
- SSL_new = (t_SSL_new) DynamicGet(handle, (char *) "SSL_new");
- SSL_clear = (t_SSL_clear) DynamicGet(handle, (char *) "SSL_clear");
- SSL_set_fd = (t_SSL_set_fd) DynamicGet(handle, (char *) "SSL_set_fd");
- SSL_set_connect_state =
- (t_SSL_set_connect_state) DynamicGet(handle,
- (char *)
- "SSL_set_connect_state");
- SSL_connect =
- (t_SSL_connect) DynamicGet(handle, (char *) "SSL_connect");
- SSL_get_error =
- (t_SSL_get_error) DynamicGet(handle, (char *) "SSL_get_error");
- SSL_write = (t_SSL_write) DynamicGet(handle, (char *) "SSL_write");
- SSL_read = (t_SSL_read) DynamicGet(handle, (char *) "SSL_read");
- SSL_library_init =
- (t_SSL_library_init) DynamicGet(handle, (char *) "SSL_library_init");
- ERR_load_SSL_strings =
- (t_ERR_load_SSL_strings) DynamicGet(handle,
- (char *) "ERR_load_SSL_strings");
- SSLv23_client_method =
- (t_SSLv23_client_method) DynamicGet(handle,
- (char *) "SSLv23_client_method");
- SSL_CTX_new =
- (t_SSL_CTX_new) DynamicGet(handle, (char *) "SSL_CTX_new");
- SSL_load_error_strings =
- (t_SSL_load_error_strings) DynamicGet(handle,
- (char *)
- "SSL_load_error_strings");
- SSL_CTX_ctrl =
- (t_SSL_CTX_ctrl) DynamicGet(handle, (char *) "SSL_CTX_ctrl");
-#ifdef _WIN32
- handle = LoadLibraryA((char *) "libeay32");
- ssl_handle_2 = handle;
-#endif
- ERR_load_crypto_strings =
- (t_ERR_load_crypto_strings) DynamicGet(handle,
- (char *)
- "ERR_load_crypto_strings");
- ERR_error_string =
- (t_ERR_error_string) DynamicGet(handle, (char *) "ERR_error_string");
-
- if (SSL_shutdown && SSL_free && SSL_CTX_ctrl && SSL_new && SSL_clear
- && SSL_set_fd && SSL_set_connect_state && SSL_connect
- && SSL_get_error && SSL_write && SSL_read && SSL_library_init
- && SSLv23_client_method && SSL_CTX_new && SSL_load_error_strings
- && ERR_error_string) {
- SSL_is_available = 1;
- }
- }
- }
-#endif
- /* */
-
/* Options availability */
sprintf(WHAT_is_available, "%s%s%s", V6_is_available ? "" : "-noV6",
- gz_is_available ? "" : "-nozip", SSL_is_available ? "" : "-nossl");
+ gz_is_available ? "" : "-nozip",
+#if HTS_USEOPENSSL
+ ""
+#else
+ "-nossl"
+#endif
+ );
}
}
diff --git a/src/htsparse.c b/src/htsparse.c
index 73f66ac..419d882 100644
--- a/src/htsparse.c
+++ b/src/htsparse.c
@@ -1685,8 +1685,7 @@ int htsparse(htsmoduleStruct * str, htsmoduleStructExtended * stre) {
if ((strfield(tempo, "http:"))
|| (strfield(tempo, "ftp:"))
#if HTS_USEOPENSSL
- || (SSL_is_available
- && (strfield(tempo, "https:"))
+ || (strfield(tempo, "https:")
)
#endif
#if HTS_USEMMS
diff --git a/src/htstools.c b/src/htstools.c
index 3a5ca70..6f614b7 100644
--- a/src/htstools.c
+++ b/src/htstools.c
@@ -170,13 +170,9 @@ int ident_url_relatif(const char *lien, const char *origin_adr,
#endif
#if HTS_USEOPENSSL
} else if (strfield(lien, "https://")) {
- if (SSL_is_available) {
- // Note: ftp:foobar.gif is not valid
- if (ident_url_absolute(lien, adr, fil) == -1) {
- ok = -1; // erreur URL
- }
- } else {
- ok = -1;
+ // Note: ftp:foobar.gif is not valid
+ if (ident_url_absolute(lien, adr, fil) == -1) {
+ ok = -1; // erreur URL
}
#endif
} else if ((scheme) && ((!strfield(lien, "http:"))
diff --git a/templates/Makefile.in b/templates/Makefile.in
index 8ffe6a0..56ba91e 100644
--- a/templates/Makefile.in
+++ b/templates/Makefile.in
@@ -117,6 +117,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OPENSSL_LIBS = @OPENSSL_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@