mirror of
https://github.com/mirror/wget.git
synced 2026-08-22 10:53:29 +08:00
Compare commits
35 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19ef7249b8 | ||
|
|
eb76fcbe2b | ||
|
|
c3a0c1a5b5 | ||
|
|
85797041a6 | ||
|
|
eb557e9e77 | ||
|
|
a25607f788 | ||
|
|
0f154e42a4 | ||
|
|
d23ce97885 | ||
|
|
66bbc5bc63 | ||
|
|
a024990e18 | ||
|
|
5bcd75d32f | ||
|
|
547bcb0d3f | ||
|
|
baed30f057 | ||
|
|
5e3c9b55f2 | ||
|
|
2158e58bc1 | ||
|
|
512bdc14cb | ||
|
|
34a6f7fc32 | ||
|
|
9fab5a9f28 | ||
|
|
c79ff7f47a | ||
|
|
1c76d3cceb | ||
|
|
75d04cadf5 | ||
|
|
186200fb6e | ||
|
|
706871e92e | ||
|
|
24a76e1a8f | ||
|
|
375d9ee3f7 | ||
|
|
3382df979c | ||
|
|
6330e4f8b8 | ||
|
|
54beb3f312 | ||
|
|
f3c2686ef7 | ||
|
|
76c651e3a1 | ||
|
|
a73e3a914e | ||
|
|
5eb9c28b31 | ||
|
|
02e316f986 | ||
|
|
13028b1bae | ||
|
|
228299b4f7 |
37
ChangeLog
37
ChangeLog
@@ -1,3 +1,40 @@
|
|||||||
|
2011-09-04 Alan Hourihane <alanh@fairlite.co.uk> (tiny change)
|
||||||
|
|
||||||
|
* configure.ac: Check for libz when gnutls is used.
|
||||||
|
|
||||||
|
2011-08-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* configure.ac: Under mingw don't check for static OpenSSL
|
||||||
|
libraries if the shared version was already found.
|
||||||
|
Suggested by: Ray Satiro <raysatiro@yahoo.com>.
|
||||||
|
|
||||||
|
2011-08-25 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* configure.ac: Check for `utime'.
|
||||||
|
|
||||||
|
2011-08-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* bootstrap.conf (gnulib_modules): Add `sigprocmask'.
|
||||||
|
|
||||||
|
* configure.ac: Do not hardcode GNU TLS and OpenSSL libraries.
|
||||||
|
|
||||||
|
* bootstrap.conf (gnulib_modules): Include module iconv.
|
||||||
|
|
||||||
|
* configure.ac: Allow --with-libgnutls-prefix and
|
||||||
|
--with-libssl-prefix
|
||||||
|
Suggested by: Karl Berry <karl@freefriends.org>
|
||||||
|
|
||||||
|
* build-aux/bzr-version-gen (TAG): Consider only the last tag.
|
||||||
|
|
||||||
|
2011-08-10 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* configure.ac: Print usage string for --with-ssl.
|
||||||
|
Reported by: Karl Berry <karl@freefriends.org>
|
||||||
|
|
||||||
|
* configure.ac: Check for `gnutls_priority_set_direct' when gnutls is
|
||||||
|
used.
|
||||||
|
Reported by: Karl Berry <karl@freefriends.org>
|
||||||
|
|
||||||
2011-08-09 Giuseppe Scrivano <gscrivano@southpole.se>
|
2011-08-09 Giuseppe Scrivano <gscrivano@southpole.se>
|
||||||
|
|
||||||
* build-aux/bzr-version-gen: Fix some portability issues.
|
* build-aux/bzr-version-gen: Fix some portability issues.
|
||||||
|
|||||||
13
NEWS
13
NEWS
@@ -5,11 +5,22 @@ Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
|
|||||||
See the end for copying conditions.
|
See the end for copying conditions.
|
||||||
|
|
||||||
Please send GNU Wget bug reports to <bug-wget@gnu.org>.
|
Please send GNU Wget bug reports to <bug-wget@gnu.org>.
|
||||||
|
* Changes in Wget X.Y.Z
|
||||||
|
|
||||||
|
** Now --version and --help work again.
|
||||||
|
|
||||||
|
** Fix a build error on solaris 10 sparc.
|
||||||
|
|
||||||
|
** If --timestamping and --continue can be used at the same time.
|
||||||
|
|
||||||
|
|
||||||
* Changes in Wget 1.13
|
* Changes in Wget 1.13.3
|
||||||
|
|
||||||
** Support HTTP/1.1
|
** Support HTTP/1.1
|
||||||
|
|
||||||
|
** Now by default the GNU TLS library for secure connections, instead of
|
||||||
|
OpenSSL.
|
||||||
|
|
||||||
** Fix some portability issues.
|
** Fix some portability issues.
|
||||||
|
|
||||||
** Handle properly malformed status line in a HTTP response.
|
** Handle properly malformed status line in a HTTP response.
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ getpeername
|
|||||||
getsockname
|
getsockname
|
||||||
gnupload
|
gnupload
|
||||||
ioctl
|
ioctl
|
||||||
|
iconv
|
||||||
iconv-h
|
iconv-h
|
||||||
listen
|
listen
|
||||||
maintainer-makefile
|
maintainer-makefile
|
||||||
@@ -55,6 +56,7 @@ recv
|
|||||||
select
|
select
|
||||||
send
|
send
|
||||||
setsockopt
|
setsockopt
|
||||||
|
sigprocmask
|
||||||
sigpipe
|
sigpipe
|
||||||
snprintf
|
snprintf
|
||||||
socket
|
socket
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
scriptversion=2011-08-09.13; # UTC
|
scriptversion=2011-08-11.08; # UTC
|
||||||
|
|
||||||
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ REVNO=`bzr revno`
|
|||||||
TAG=`bzr tags -r $REVNO | cut -d' ' -f1`
|
TAG=`bzr tags -r $REVNO | cut -d' ' -f1`
|
||||||
if test -z "$TAG"
|
if test -z "$TAG"
|
||||||
then
|
then
|
||||||
TAG=`bzr tags -r ..$REVNO | cut -d' ' -f1`
|
TAG=`bzr tags --sort=time -r ..$REVNO | tail -n1 | cut -d' ' -f1`
|
||||||
|
|
||||||
# No tags yet
|
# No tags yet
|
||||||
test -z "$TAG" && TAG="unknown"
|
test -z "$TAG" && TAG="unknown"
|
||||||
|
|||||||
80
configure.ac
80
configure.ac
@@ -62,7 +62,8 @@ dnl Process features.
|
|||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_ARG_WITH(ssl,
|
AC_ARG_WITH(ssl,
|
||||||
[[ --without-ssl disable SSL autodetection]])
|
[[ --without-ssl disable SSL autodetection
|
||||||
|
--with-ssl={gnutls,openssl} specify the SSL backend. GNU TLS is the default.]])
|
||||||
|
|
||||||
AC_ARG_ENABLE(opie,
|
AC_ARG_ENABLE(opie,
|
||||||
[ --disable-opie disable support for opie or s/key FTP login],
|
[ --disable-opie disable support for opie or s/key FTP login],
|
||||||
@@ -196,7 +197,7 @@ AC_FUNC_MMAP
|
|||||||
AC_FUNC_FSEEKO
|
AC_FUNC_FSEEKO
|
||||||
AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48)
|
AC_CHECK_FUNCS(strptime timegm vsnprintf vasprintf drand48)
|
||||||
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
|
AC_CHECK_FUNCS(strtoll usleep ftello sigblock sigsetjmp memrchr wcwidth mbtowc)
|
||||||
AC_CHECK_FUNCS(sleep symlink)
|
AC_CHECK_FUNCS(sleep symlink utime)
|
||||||
|
|
||||||
if test x"$ENABLE_OPIE" = xyes; then
|
if test x"$ENABLE_OPIE" = xyes; then
|
||||||
AC_LIBOBJ([ftp-opie])
|
AC_LIBOBJ([ftp-opie])
|
||||||
@@ -245,6 +246,7 @@ AS_IF([test x"$with_ssl" = xopenssl], [
|
|||||||
AC_CHECK_LIB(dl, shl_load)
|
AC_CHECK_LIB(dl, shl_load)
|
||||||
])
|
])
|
||||||
|
|
||||||
|
ssl_found=no
|
||||||
case $host_os in
|
case $host_os in
|
||||||
*mingw32* )
|
*mingw32* )
|
||||||
dnl prefer link to openssl dlls if possible. if not then fallback on static libs. if not then error
|
dnl prefer link to openssl dlls if possible. if not then fallback on static libs. if not then error
|
||||||
@@ -252,35 +254,46 @@ AS_IF([test x"$with_ssl" = xopenssl], [
|
|||||||
AC_CHECK_LIB(eay32, EVP_MD_CTX_init)
|
AC_CHECK_LIB(eay32, EVP_MD_CTX_init)
|
||||||
if test x"$ac_cv_lib_eay32_EVP_MD_CTX_init" != xno
|
if test x"$ac_cv_lib_eay32_EVP_MD_CTX_init" != xno
|
||||||
then
|
then
|
||||||
AC_CHECK_LIB(ssl32, SSL_connect,,
|
AC_CHECK_LIB(ssl32, SSL_connect, [
|
||||||
AC_MSG_ERROR([openssl not found: shared lib eay32 found but ssl32 not found]))
|
ssl_found=yes
|
||||||
AC_MSG_NOTICE([Enabling support for SSL via OpenSSL (shared)])
|
AC_MSG_NOTICE([Enabling support for SSL via OpenSSL (shared)])
|
||||||
|
],
|
||||||
|
AC_MSG_ERROR([openssl not found: shared lib eay32 found but ssl32 not found]))
|
||||||
|
|
||||||
else
|
else
|
||||||
LIBS+=' -lgdi32'
|
LIBS+=' -lgdi32'
|
||||||
dnl fallback and test static libs
|
dnl fallback and test static libs
|
||||||
|
|
||||||
AC_CHECK_LIB(crypto, EVP_MD_CTX_init,,,)
|
|
||||||
if test x"$ac_cv_lib_crypto_EVP_MD_CTX_init" != xno
|
|
||||||
then
|
|
||||||
AC_CHECK_LIB(ssl, SSL_connect,, AC_MSG_ERROR([openssl not found]))
|
|
||||||
AC_MSG_NOTICE([Enabling support for SSL via OpenSSL])
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([openssl not found: shared (eay32/ssl32) or static (crypto/ssl) libs needed])
|
|
||||||
fi
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
dnl add zdll lib as dep for above tests?
|
dnl add zdll lib as dep for above tests?
|
||||||
;;
|
;;
|
||||||
*)
|
|
||||||
|
|
||||||
AC_CHECK_LIB(crypto, EVP_MD_CTX_init)
|
|
||||||
AC_CHECK_LIB(ssl, ERR_func_error_string,,
|
|
||||||
AC_MSG_ERROR([openssl development libraries not found]))
|
|
||||||
AC_MSG_NOTICE([Enabling support for SSL via OpenSSL (static)])
|
|
||||||
;;
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
AS_IF([test x$ssl_found != xyes],
|
||||||
|
[
|
||||||
|
dnl Now actually check for -lssl if it wasn't already found
|
||||||
|
AC_LIB_HAVE_LINKFLAGS([ssl], [crypto z], [
|
||||||
|
#include <openssl/ssl.h>
|
||||||
|
#include <openssl/x509.h>
|
||||||
|
#include <openssl/err.h>
|
||||||
|
#include <openssl/rand.h>
|
||||||
|
#include <openssl/des.h>
|
||||||
|
#include <openssl/md4.h>
|
||||||
|
#include <openssl/md5.h>
|
||||||
|
], [SSL_library_init ()])
|
||||||
|
if test x"$LIBSSL" != x
|
||||||
|
then
|
||||||
|
AC_MSG_NOTICE([compiling in support for SSL via OpenSSL])
|
||||||
|
AC_LIBOBJ([openssl])
|
||||||
|
LIBS="$LIBSSL $LIBS"
|
||||||
|
elif test x"$with_ssl" != x
|
||||||
|
then
|
||||||
|
AC_MSG_ERROR([--with-ssl=openssl was given, but SSL is not available.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_LIBOBJ([openssl])
|
AC_LIBOBJ([openssl])
|
||||||
|
|
||||||
|
])
|
||||||
|
|
||||||
], [
|
], [
|
||||||
# --with-ssl is not gnutls: check if it's no
|
# --with-ssl is not gnutls: check if it's no
|
||||||
AS_IF([test x"$with_ssl" != xno], [
|
AS_IF([test x"$with_ssl" != xno], [
|
||||||
@@ -289,19 +302,24 @@ AS_IF([test x"$with_ssl" = xopenssl], [
|
|||||||
AC_CHECK_LIB(z, compress)
|
AC_CHECK_LIB(z, compress)
|
||||||
AC_CHECK_LIB(gpg-error, gpg_err_init)
|
AC_CHECK_LIB(gpg-error, gpg_err_init)
|
||||||
AC_CHECK_LIB(gcrypt, gcry_control)
|
AC_CHECK_LIB(gcrypt, gcry_control)
|
||||||
AC_CHECK_LIB(gnutls, main)
|
|
||||||
|
|
||||||
if test x"$ac_cv_lib_gnutls_main" != xno
|
dnl Now actually check for -lssl
|
||||||
then
|
AC_LIB_HAVE_LINKFLAGS([gnutls], [], [
|
||||||
AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
|
#include <gnutls/gnutls.h>
|
||||||
AC_LIBOBJ([gnutls])
|
], [gnutls_global_init()])
|
||||||
else
|
if test x"$LIBGNUTLS" != x
|
||||||
AC_MSG_ERROR([--with-ssl was given, but GNUTLS is not available.])
|
then
|
||||||
fi
|
AC_MSG_NOTICE([compiling in support for SSL via GnuTLS])
|
||||||
|
AC_LIBOBJ([gnutls])
|
||||||
|
LIBS="$LIBGNUTLS $LIBS"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([--with-ssl was given, but GNUTLS is not available.])
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_FUNCS(gnutls_priority_set_direct)
|
||||||
]) # endif: --with-ssl == no?
|
]) # endif: --with-ssl == no?
|
||||||
]) # endif: --with-ssl == openssl?
|
]) # endif: --with-ssl == openssl?
|
||||||
|
|
||||||
|
|
||||||
dnl Enable NTLM if requested and if SSL is available.
|
dnl Enable NTLM if requested and if SSL is available.
|
||||||
if test x"$LIBSSL" != x
|
if test x"$LIBSSL" != x
|
||||||
then
|
then
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
2011-08-18 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* texi2pod.pl: Don't assume the perl executable is under /usr/bin/.
|
||||||
|
|
||||||
2011-08-06 Giuseppe Scrivano <gscrivano@gnu.org>
|
2011-08-06 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
* wget.texi (Wgetrc Commands): Document show_all_dns_entries.
|
* wget.texi (Wgetrc Commands): Document show_all_dns_entries.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#! /usr/bin/perl -w
|
#! /usr/bin/env perl
|
||||||
|
|
||||||
# Copyright (C) 1999, 2000, 2001, 2003, 2010 Free Software Foundation, Inc.
|
# Copyright (C) 1999, 2000, 2001, 2003, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,97 @@
|
|||||||
|
2011-09-07 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* http.c (gethttp): Don't inhibit arest request if opt.timestamping is
|
||||||
|
set.
|
||||||
|
Reported by <natrio@list.ru>
|
||||||
|
|
||||||
|
2011-09-06 Jakob Matthes <jakob.matthes@gmail.com> (tiny change)
|
||||||
|
|
||||||
|
* main.c (print_version): Do not exit prematurely when --help is passed.
|
||||||
|
|
||||||
|
2011-09-04 Christian Jullien <eligis@orange.fr> (tiny change)
|
||||||
|
|
||||||
|
* gnutls.c: Include <sys/fcntl.h>.
|
||||||
|
|
||||||
|
2011-09-02 Mojca Miklavec <mojca.miklavec.lists@gmail.com> (tiny change)
|
||||||
|
|
||||||
|
* main.c (print_version): Do not exit prematurely when --version is passed.
|
||||||
|
|
||||||
|
2011-08-30 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* gnutls.c (wgnutls_read_timeout): Use the non blocking socket only for
|
||||||
|
`gnutls_record_recv'. Set errno to ETIMEDOUT on a read timeout.
|
||||||
|
|
||||||
|
2011-08-29 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* gnutls.c (wgnutls_read_timeout): New function.
|
||||||
|
(wgnutls_read): Use wgnutls_read_timeout.
|
||||||
|
(wgnutls_peek): Likewise.
|
||||||
|
|
||||||
|
2011-08-27 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* main.c (print_help): Exit with an error status if print to stdout
|
||||||
|
fails.
|
||||||
|
(print_usage): Change method signature and return a status code.
|
||||||
|
(print_version): Likewise.
|
||||||
|
|
||||||
|
2011-08-26 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* gnutls.c: Include "ptimer.h".
|
||||||
|
(wgnutls_read): Honor read timeout.
|
||||||
|
|
||||||
|
* openssl.c (ssl_init): Make `meth' const.
|
||||||
|
|
||||||
|
2011-08-25 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* utils.c [HAVE_UTIME && HAVE_UTIME_H]: Include <utime.h>.
|
||||||
|
[HAVE_UTIME && HAVE_SYS_UTIME_H]: Include <sys/utime.h>.
|
||||||
|
(touch) [HAVE_UTIME: Prefers utime over futimens when it is available.
|
||||||
|
It was reported that Cygwin has a not working futimens.
|
||||||
|
|
||||||
|
2011-08-19 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* init.c (home_dir) [MSDOS]: Move local variable `len' here.
|
||||||
|
|
||||||
|
2011-08-18 Giuseppe Scrivano <giuseppe@southpole.se>
|
||||||
|
|
||||||
|
* http.c (gethttp): Fix a memory leak on some errors. Free the head
|
||||||
|
buffer.
|
||||||
|
|
||||||
|
* Makefile.am: Use an additional file "css_.c" which in turn includes
|
||||||
|
"wget.h" and immediately "css.c".
|
||||||
|
|
||||||
|
* http.c (gethttp): Reset chunked_transfer_encoding on redirections.
|
||||||
|
|
||||||
|
2011-08-13 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* retr.c (fd_read_body): Ensure max is not already defined.
|
||||||
|
|
||||||
|
* mswindows.h (snprintf): Remove definition.
|
||||||
|
(vsnprintf): Likewise.
|
||||||
|
|
||||||
|
2011-08-12 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* css.l: Remove include "wget.h".
|
||||||
|
Reported by: Perry Smith <pedzsan@gmail.com>.
|
||||||
|
|
||||||
|
2011-08-11 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
* utils.c (abort_run_with_timeout): Use sigprocmask instead of
|
||||||
|
sigsetmask.
|
||||||
|
|
||||||
|
* gnutls.c (ssl_connect_wget): Remove call to deprecated function
|
||||||
|
`gnutls_certificate_type_set_priority'.
|
||||||
|
|
||||||
|
* Makefile.am (version.c): Don't invoke hg to set version string.
|
||||||
|
|
||||||
|
2011-08-10 Giuseppe Scrivano <gscrivano@gnu.org>
|
||||||
|
|
||||||
|
Fix a linker error on systems with an older gnutls version.
|
||||||
|
* gnutls.c (ssl_connect_wget)
|
||||||
|
[HAVE_GNUTLS_PRIORITY_SET_DIRECT]: Use gnutls_priority_set_direct.
|
||||||
|
[! HAVE_GNUTLS_PRIORITY_SET_DIRECT]: Use gnutls_protocol_set_priority.
|
||||||
|
Reported by: Karl Berry <karl@freefriends.org>
|
||||||
|
|
||||||
2011-08-06 Jochen Roderburg <Roderburg@Uni-Koeln.DE>
|
2011-08-06 Jochen Roderburg <Roderburg@Uni-Koeln.DE>
|
||||||
|
|
||||||
* host.c (lookup_host): Ensure it doesn't print more IPs than available
|
* host.c (lookup_host): Ensure it doesn't print more IPs than available
|
||||||
|
|||||||
@@ -39,9 +39,11 @@ endif
|
|||||||
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
|
DEFS = @DEFS@ -DSYSTEM_WGETRC=\"$(sysconfdir)/wgetrc\" -DLOCALEDIR=\"$(localedir)\"
|
||||||
LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
|
LIBS = @LIBICONV@ @LIBINTL@ @LIBS@ $(LIB_CLOCK_GETTIME)
|
||||||
|
|
||||||
|
EXTRA_DIST = css.l css.c css_.c build_info.c.in
|
||||||
|
|
||||||
bin_PROGRAMS = wget
|
bin_PROGRAMS = wget
|
||||||
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
wget_SOURCES = cmpt.c connect.c convert.c cookies.c ftp.c \
|
||||||
css.l css-url.c \
|
css_.c css-url.c \
|
||||||
ftp-basic.c ftp-ls.c hash.c host.c html-parse.c html-url.c \
|
ftp-basic.c ftp-ls.c hash.c host.c html-parse.c html-url.c \
|
||||||
http.c init.c log.c main.c netrc.c progress.c ptimer.c \
|
http.c init.c log.c main.c netrc.c progress.c ptimer.c \
|
||||||
recur.c res.c retr.c spider.c url.c \
|
recur.c res.c retr.c spider.c url.c \
|
||||||
@@ -57,6 +59,7 @@ EXTRA_wget_SOURCES = iri.c
|
|||||||
LDADD = $(LIBOBJS) ../lib/libgnu.a
|
LDADD = $(LIBOBJS) ../lib/libgnu.a
|
||||||
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
|
AM_CPPFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib
|
||||||
|
|
||||||
|
|
||||||
../lib/libgnu.a:
|
../lib/libgnu.a:
|
||||||
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
cd ../lib && $(MAKE) $(AM_MAKEFLAGS)
|
||||||
|
|
||||||
@@ -71,21 +74,27 @@ version.c: $(wget_SOURCES) ../lib/libgnu.a
|
|||||||
echo '/* version.c */' > $@
|
echo '/* version.c */' > $@
|
||||||
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
|
echo '/* Autogenerated by Makefile - DO NOT EDIT */' >> $@
|
||||||
echo '' >> $@
|
echo '' >> $@
|
||||||
echo 'const char *version_string = "@VERSION@"' >> $@
|
echo 'const char *version_string = "@VERSION@";' >> $@
|
||||||
-hg log -R "$(top_srcdir)" -r . --template='" ({node|short})"\n' \
|
|
||||||
2>/dev/null >> $@
|
|
||||||
echo ';' >> $@
|
|
||||||
echo 'const char *compilation_string = "'$(COMPILE)'";' \
|
echo 'const char *compilation_string = "'$(COMPILE)'";' \
|
||||||
| $(ESCAPEQUOTE) >> $@
|
| $(ESCAPEQUOTE) >> $@
|
||||||
echo 'const char *link_string = "'$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
echo 'const char *link_string = "'$(CCLD) $(AM_CFLAGS) $(CFLAGS) \
|
||||||
$(AM_LDFLAGS) $(LDFLAGS) $(LIBS) $(wget_LDADD)'";' \
|
$(AM_LDFLAGS) $(LDFLAGS) $(LIBS) $(wget_LDADD)'";' \
|
||||||
| $(ESCAPEQUOTE) >> $@
|
| $(ESCAPEQUOTE) >> $@
|
||||||
|
|
||||||
|
css.c: $(srcdir)/css.l
|
||||||
|
$(LEX) $(LFLAGS) -o $@ $^
|
||||||
|
|
||||||
|
css_.c: css.c
|
||||||
|
echo '#include "wget.h"' > $@
|
||||||
|
cat css.c >> $@
|
||||||
|
|
||||||
|
distclean-local:
|
||||||
|
rm -f css.c css_.c
|
||||||
|
|
||||||
check_LIBRARIES = libunittest.a
|
check_LIBRARIES = libunittest.a
|
||||||
libunittest_a_SOURCES = $(wget_SOURCES) test.c build_info.c test.h
|
libunittest_a_SOURCES = $(wget_SOURCES) test.c build_info.c test.h
|
||||||
nodist_libunittest_a_SOURCES = version.c
|
nodist_libunittest_a_SOURCES = version.c
|
||||||
libunittest_a_CPPFLAGS = -DTESTING "-I$(top_builddir)/lib" "-I$(top_srcdir)/lib"
|
libunittest_a_CPPFLAGS = -DTESTING "-I$(top_builddir)/lib" "-I$(top_srcdir)/lib"
|
||||||
libunittest_a_LIBADD = $(LIBOBJS)
|
libunittest_a_LIBADD = $(LIBOBJS)
|
||||||
EXTRA_DIST = build_info.c.in
|
|
||||||
|
|
||||||
CLEANFILES = *~ *.bak core core.[0-9]* build_info.c version.c
|
CLEANFILES = *~ *.bak core core.[0-9]* build_info.c version.c
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ as that of the covered work. */
|
|||||||
|
|
||||||
#define YY_NO_INPUT
|
#define YY_NO_INPUT
|
||||||
|
|
||||||
#include "wget.h"
|
|
||||||
#include "css-tokens.h"
|
#include "css-tokens.h"
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|||||||
127
src/gnutls.c
127
src/gnutls.c
@@ -45,8 +45,11 @@ as that of the covered work. */
|
|||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "connect.h"
|
#include "connect.h"
|
||||||
#include "url.h"
|
#include "url.h"
|
||||||
|
#include "ptimer.h"
|
||||||
#include "ssl.h"
|
#include "ssl.h"
|
||||||
|
|
||||||
|
#include <sys/fcntl.h>
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
# include "w32sock.h"
|
# include "w32sock.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -57,7 +60,6 @@ as that of the covered work. */
|
|||||||
preprocessor macro. */
|
preprocessor macro. */
|
||||||
|
|
||||||
static gnutls_certificate_credentials credentials;
|
static gnutls_certificate_credentials credentials;
|
||||||
|
|
||||||
bool
|
bool
|
||||||
ssl_init ()
|
ssl_init ()
|
||||||
{
|
{
|
||||||
@@ -122,10 +124,94 @@ struct wgnutls_transport_context
|
|||||||
# define MIN(i, j) ((i) <= (j) ? (i) : (j))
|
# define MIN(i, j) ((i) <= (j) ? (i) : (j))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
wgnutls_read_timeout (int fd, char *buf, int bufsize, void *arg, double timeout)
|
||||||
|
{
|
||||||
|
#ifdef F_GETFL
|
||||||
|
int flags = 0;
|
||||||
|
#endif
|
||||||
|
int ret = 0;
|
||||||
|
struct ptimer *timer;
|
||||||
|
struct wgnutls_transport_context *ctx = arg;
|
||||||
|
int timed_out = 0;
|
||||||
|
|
||||||
|
if (timeout)
|
||||||
|
{
|
||||||
|
#ifdef F_GETFL
|
||||||
|
flags = fcntl (fd, F_GETFL, 0);
|
||||||
|
if (flags < 0)
|
||||||
|
return flags;
|
||||||
|
#endif
|
||||||
|
timer = ptimer_new ();
|
||||||
|
if (timer == 0)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
double next_timeout = timeout - ptimer_measure (timer);
|
||||||
|
if (timeout && next_timeout < 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
ret = GNUTLS_E_AGAIN;
|
||||||
|
if (timeout == 0 || gnutls_record_check_pending (ctx->session)
|
||||||
|
|| select_fd (fd, next_timeout, WAIT_FOR_READ))
|
||||||
|
{
|
||||||
|
if (timeout)
|
||||||
|
{
|
||||||
|
#ifdef F_GETFL
|
||||||
|
ret = fcntl (fd, F_SETFL, flags | O_NONBLOCK);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
#else
|
||||||
|
/* XXX: Assume it was blocking before. */
|
||||||
|
const int one = 1;
|
||||||
|
ret = ioctl (fd, FIONBIO, &one);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = gnutls_record_recv (ctx->session, buf, bufsize);
|
||||||
|
|
||||||
|
if (timeout)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
#ifdef F_GETFL
|
||||||
|
status = fcntl (fd, F_SETFL, flags);
|
||||||
|
if (status < 0)
|
||||||
|
return status;
|
||||||
|
#else
|
||||||
|
const int zero = 0;
|
||||||
|
status = ioctl (fd, FIONBIO, &zero);
|
||||||
|
if (status < 0)
|
||||||
|
return status;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
timed_out = timeout && ptimer_measure (timer) >= timeout;
|
||||||
|
}
|
||||||
|
while (ret == GNUTLS_E_INTERRUPTED || (ret == GNUTLS_E_AGAIN && !timed_out));
|
||||||
|
|
||||||
|
if (timeout)
|
||||||
|
ptimer_destroy (timer);
|
||||||
|
|
||||||
|
if (timeout && timed_out && ret == GNUTLS_E_AGAIN)
|
||||||
|
errno = ETIMEDOUT;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
wgnutls_read (int fd, char *buf, int bufsize, void *arg)
|
wgnutls_read (int fd, char *buf, int bufsize, void *arg)
|
||||||
{
|
{
|
||||||
|
#ifdef F_GETFL
|
||||||
|
int flags = 0;
|
||||||
|
#endif
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
struct ptimer *timer;
|
||||||
struct wgnutls_transport_context *ctx = arg;
|
struct wgnutls_transport_context *ctx = arg;
|
||||||
|
|
||||||
if (ctx->peeklen)
|
if (ctx->peeklen)
|
||||||
@@ -140,10 +226,7 @@ wgnutls_read (int fd, char *buf, int bufsize, void *arg)
|
|||||||
return copysize;
|
return copysize;
|
||||||
}
|
}
|
||||||
|
|
||||||
do
|
ret = wgnutls_read_timeout (fd, buf, bufsize, arg, opt.read_timeout);
|
||||||
ret = gnutls_record_recv (ctx->session, buf, bufsize);
|
|
||||||
while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN);
|
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
ctx->last_error = ret;
|
ctx->last_error = ret;
|
||||||
|
|
||||||
@@ -189,9 +272,8 @@ wgnutls_peek (int fd, char *buf, int bufsize, void *arg)
|
|||||||
&& select_fd (fd, 0.0, WAIT_FOR_READ) <= 0)
|
&& select_fd (fd, 0.0, WAIT_FOR_READ) <= 0)
|
||||||
read = 0;
|
read = 0;
|
||||||
else
|
else
|
||||||
read = gnutls_record_recv (ctx->session, buf + offset,
|
read = wgnutls_read_timeout (fd, buf + offset, bufsize - offset,
|
||||||
bufsize - offset);
|
ctx, opt.read_timeout);
|
||||||
|
|
||||||
if (read < 0)
|
if (read < 0)
|
||||||
{
|
{
|
||||||
if (offset)
|
if (offset)
|
||||||
@@ -240,15 +322,11 @@ static struct transport_implementation wgnutls_transport =
|
|||||||
bool
|
bool
|
||||||
ssl_connect_wget (int fd)
|
ssl_connect_wget (int fd)
|
||||||
{
|
{
|
||||||
static const int cert_type_priority[] = {
|
|
||||||
GNUTLS_CRT_X509, GNUTLS_CRT_OPENPGP, 0
|
|
||||||
};
|
|
||||||
struct wgnutls_transport_context *ctx;
|
struct wgnutls_transport_context *ctx;
|
||||||
gnutls_session session;
|
gnutls_session session;
|
||||||
int err;
|
int err;
|
||||||
gnutls_init (&session, GNUTLS_CLIENT);
|
gnutls_init (&session, GNUTLS_CLIENT);
|
||||||
gnutls_set_default_priority (session);
|
gnutls_set_default_priority (session);
|
||||||
gnutls_certificate_type_set_priority (session, cert_type_priority);
|
|
||||||
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, credentials);
|
gnutls_credentials_set (session, GNUTLS_CRD_CERTIFICATE, credentials);
|
||||||
#ifndef FD_TO_SOCKET
|
#ifndef FD_TO_SOCKET
|
||||||
# define FD_TO_SOCKET(X) (X)
|
# define FD_TO_SOCKET(X) (X)
|
||||||
@@ -256,6 +334,7 @@ ssl_connect_wget (int fd)
|
|||||||
gnutls_transport_set_ptr (session, (gnutls_transport_ptr) FD_TO_SOCKET (fd));
|
gnutls_transport_set_ptr (session, (gnutls_transport_ptr) FD_TO_SOCKET (fd));
|
||||||
|
|
||||||
err = 0;
|
err = 0;
|
||||||
|
#if HAVE_GNUTLS_PRIORITY_SET_DIRECT
|
||||||
switch (opt.secure_protocol)
|
switch (opt.secure_protocol)
|
||||||
{
|
{
|
||||||
case secure_protocol_auto:
|
case secure_protocol_auto:
|
||||||
@@ -270,6 +349,30 @@ ssl_connect_wget (int fd)
|
|||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int allowed_protocols[4] = {0, 0, 0, 0};
|
||||||
|
switch (opt.secure_protocol)
|
||||||
|
{
|
||||||
|
case secure_protocol_auto:
|
||||||
|
break;
|
||||||
|
case secure_protocol_sslv2:
|
||||||
|
case secure_protocol_sslv3:
|
||||||
|
allowed_protocols[0] = GNUTLS_SSL3;
|
||||||
|
err = gnutls_protocol_set_priority (session, allowed_protocols);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case secure_protocol_tlsv1:
|
||||||
|
allowed_protocols[0] = GNUTLS_TLS1_0;
|
||||||
|
allowed_protocols[1] = GNUTLS_TLS1_1;
|
||||||
|
allowed_protocols[2] = GNUTLS_TLS1_2;
|
||||||
|
err = gnutls_protocol_set_priority (session, allowed_protocols);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
abort ();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
{
|
{
|
||||||
logprintf (LOG_NOTQUIET, "GnuTLS: %s\n", gnutls_strerror (err));
|
logprintf (LOG_NOTQUIET, "GnuTLS: %s\n", gnutls_strerror (err));
|
||||||
|
|||||||
@@ -1626,7 +1626,7 @@ gethttp (struct url *u, struct http_stat *hs, int *dt, struct url *proxy,
|
|||||||
/* ... but some HTTP/1.0 caches doesn't implement Cache-Control. */
|
/* ... but some HTTP/1.0 caches doesn't implement Cache-Control. */
|
||||||
request_set_header (req, "Pragma", "no-cache", rel_none);
|
request_set_header (req, "Pragma", "no-cache", rel_none);
|
||||||
}
|
}
|
||||||
if (hs->restval && !opt.timestamping)
|
if (hs->restval)
|
||||||
request_set_header (req, "Range",
|
request_set_header (req, "Range",
|
||||||
aprintf ("bytes=%s-",
|
aprintf ("bytes=%s-",
|
||||||
number_to_static_string (hs->restval)),
|
number_to_static_string (hs->restval)),
|
||||||
@@ -1986,12 +1986,14 @@ read_header:
|
|||||||
_("Malformed status line")));
|
_("Malformed status line")));
|
||||||
CLOSE_INVALIDATE (sock);
|
CLOSE_INVALIDATE (sock);
|
||||||
request_free (req);
|
request_free (req);
|
||||||
|
xfree (head);
|
||||||
return HERR;
|
return HERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (H_10X (statcode))
|
if (H_10X (statcode))
|
||||||
{
|
{
|
||||||
DEBUGP (("Ignoring response\n"));
|
DEBUGP (("Ignoring response\n"));
|
||||||
|
xfree (head);
|
||||||
goto read_header;
|
goto read_header;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2040,8 +2042,9 @@ read_header:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
resp_header_copy (resp, "Transfer-Encoding", hdrval, sizeof (hdrval));
|
chunked_transfer_encoding = false;
|
||||||
if (0 == strcasecmp (hdrval, "chunked"))
|
if (resp_header_copy (resp, "Transfer-Encoding", hdrval, sizeof (hdrval))
|
||||||
|
&& 0 == strcasecmp (hdrval, "chunked"))
|
||||||
chunked_transfer_encoding = true;
|
chunked_transfer_encoding = true;
|
||||||
|
|
||||||
/* Handle (possibly multiple instances of) the Set-Cookie header. */
|
/* Handle (possibly multiple instances of) the Set-Cookie header. */
|
||||||
|
|||||||
@@ -370,7 +370,6 @@ home_dir (void)
|
|||||||
{
|
{
|
||||||
static char *buf = NULL;
|
static char *buf = NULL;
|
||||||
static char *home, *ret;
|
static char *home, *ret;
|
||||||
int len;
|
|
||||||
|
|
||||||
if (!home)
|
if (!home)
|
||||||
{
|
{
|
||||||
@@ -378,6 +377,8 @@ home_dir (void)
|
|||||||
if (!home)
|
if (!home)
|
||||||
{
|
{
|
||||||
#if defined(MSDOS)
|
#if defined(MSDOS)
|
||||||
|
int len;
|
||||||
|
|
||||||
/* Under MSDOS, if $HOME isn't defined, use the directory where
|
/* Under MSDOS, if $HOME isn't defined, use the directory where
|
||||||
`wget.exe' resides. */
|
`wget.exe' resides. */
|
||||||
const char *_w32_get_argv0 (void); /* in libwatt.a/pcconfig.c */
|
const char *_w32_get_argv0 (void); /* in libwatt.a/pcconfig.c */
|
||||||
|
|||||||
101
src/main.c
101
src/main.c
@@ -393,11 +393,11 @@ init_switches (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print the usage message. */
|
/* Print the usage message. */
|
||||||
static void
|
static int
|
||||||
print_usage (int error)
|
print_usage (int error)
|
||||||
{
|
{
|
||||||
fprintf (error ? stderr : stdout, _("Usage: %s [OPTION]... [URL]...\n"),
|
return fprintf (error ? stderr : stdout,
|
||||||
exec_name);
|
_("Usage: %s [OPTION]... [URL]...\n"), exec_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the help message, describing all the available options. If
|
/* Print the help message, describing all the available options. If
|
||||||
@@ -709,12 +709,15 @@ Recursive accept/reject:\n"),
|
|||||||
|
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
|
if (printf (_("GNU Wget %s, a non-interactive network retriever.\n"),
|
||||||
version_string);
|
version_string) < 0)
|
||||||
print_usage (0);
|
exit (3);
|
||||||
|
if (print_usage (0) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
for (i = 0; i < countof (help); i++)
|
for (i = 0; i < countof (help); i++)
|
||||||
fputs (_(help[i]), stdout);
|
if (fputs (_(help[i]), stdout) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
@@ -759,7 +762,7 @@ prompt_for_password (void)
|
|||||||
to at most line_length. prefix is printed on the first line
|
to at most line_length. prefix is printed on the first line
|
||||||
and an appropriate number of spaces are added on subsequent
|
and an appropriate number of spaces are added on subsequent
|
||||||
lines.*/
|
lines.*/
|
||||||
static void
|
static int
|
||||||
format_and_print_line (const char *prefix, const char *line,
|
format_and_print_line (const char *prefix, const char *line,
|
||||||
int line_length)
|
int line_length)
|
||||||
{
|
{
|
||||||
@@ -774,7 +777,8 @@ format_and_print_line (const char *prefix, const char *line,
|
|||||||
if (line_length <= 0)
|
if (line_length <= 0)
|
||||||
line_length = MAX_CHARS_PER_LINE - TABULATION;
|
line_length = MAX_CHARS_PER_LINE - TABULATION;
|
||||||
|
|
||||||
printf ("%s", prefix);
|
if (printf ("%s", prefix) < 0)
|
||||||
|
return -1;
|
||||||
remaining_chars = line_length;
|
remaining_chars = line_length;
|
||||||
/* We break on spaces. */
|
/* We break on spaces. */
|
||||||
token = strtok (line_dup, " ");
|
token = strtok (line_dup, " ");
|
||||||
@@ -785,17 +789,21 @@ format_and_print_line (const char *prefix, const char *line,
|
|||||||
token on the next line. */
|
token on the next line. */
|
||||||
if (remaining_chars <= strlen (token))
|
if (remaining_chars <= strlen (token))
|
||||||
{
|
{
|
||||||
printf ("\n%*c", TABULATION, ' ');
|
if (printf ("\n%*c", TABULATION, ' ') < 0)
|
||||||
|
return -1;
|
||||||
remaining_chars = line_length - TABULATION;
|
remaining_chars = line_length - TABULATION;
|
||||||
}
|
}
|
||||||
printf ("%s ", token);
|
if (printf ("%s ", token) < 0)
|
||||||
|
return -1;
|
||||||
remaining_chars -= strlen (token) + 1; /* account for " " */
|
remaining_chars -= strlen (token) + 1; /* account for " " */
|
||||||
token = strtok (NULL, " ");
|
token = strtok (NULL, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
printf ("\n");
|
if (printf ("\n") < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
xfree (line_dup);
|
xfree (line_dup);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -808,72 +816,91 @@ print_version (void)
|
|||||||
char *env_wgetrc, *user_wgetrc;
|
char *env_wgetrc, *user_wgetrc;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf (_("GNU Wget %s built on %s.\n\n"), version_string, OS_TYPE);
|
if (printf (_("GNU Wget %s built on %s.\n\n"), version_string, OS_TYPE) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
for (i = 0; compiled_features[i] != NULL; )
|
for (i = 0; compiled_features[i] != NULL; )
|
||||||
{
|
{
|
||||||
int line_length = MAX_CHARS_PER_LINE;
|
int line_length = MAX_CHARS_PER_LINE;
|
||||||
while ((line_length > 0) && (compiled_features[i] != NULL))
|
while ((line_length > 0) && (compiled_features[i] != NULL))
|
||||||
{
|
{
|
||||||
printf ("%s ", compiled_features[i]);
|
if (printf ("%s ", compiled_features[i]) < 0)
|
||||||
|
exit (3);
|
||||||
line_length -= strlen (compiled_features[i]) + 2;
|
line_length -= strlen (compiled_features[i]) + 2;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
printf ("\n");
|
if (printf ("\n") < 0)
|
||||||
|
exit (3);
|
||||||
}
|
}
|
||||||
printf ("\n");
|
if (printf ("\n") < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
/* Handle the case when $WGETRC is unset and $HOME/.wgetrc is
|
/* Handle the case when $WGETRC is unset and $HOME/.wgetrc is
|
||||||
absent. */
|
absent. */
|
||||||
printf ("%s\n", wgetrc_title);
|
if (printf ("%s\n", wgetrc_title) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
env_wgetrc = wgetrc_env_file_name ();
|
env_wgetrc = wgetrc_env_file_name ();
|
||||||
if (env_wgetrc && *env_wgetrc)
|
if (env_wgetrc && *env_wgetrc)
|
||||||
{
|
{
|
||||||
printf (_(" %s (env)\n"), env_wgetrc);
|
if (printf (_(" %s (env)\n"), env_wgetrc) < 0)
|
||||||
|
exit (3);
|
||||||
xfree (env_wgetrc);
|
xfree (env_wgetrc);
|
||||||
}
|
}
|
||||||
user_wgetrc = wgetrc_user_file_name ();
|
user_wgetrc = wgetrc_user_file_name ();
|
||||||
if (user_wgetrc)
|
if (user_wgetrc)
|
||||||
{
|
{
|
||||||
printf (_(" %s (user)\n"), user_wgetrc);
|
if (printf (_(" %s (user)\n"), user_wgetrc) < 0)
|
||||||
|
exit (3);
|
||||||
xfree (user_wgetrc);
|
xfree (user_wgetrc);
|
||||||
}
|
}
|
||||||
#ifdef SYSTEM_WGETRC
|
#ifdef SYSTEM_WGETRC
|
||||||
printf (_(" %s (system)\n"), SYSTEM_WGETRC);
|
if (printf (_(" %s (system)\n"), SYSTEM_WGETRC) < 0)
|
||||||
|
exit (3);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
format_and_print_line (locale_title,
|
if (format_and_print_line (locale_title,
|
||||||
LOCALEDIR,
|
LOCALEDIR,
|
||||||
MAX_CHARS_PER_LINE);
|
MAX_CHARS_PER_LINE) < 0)
|
||||||
|
exit (3);
|
||||||
#endif /* def ENABLE_NLS */
|
#endif /* def ENABLE_NLS */
|
||||||
|
|
||||||
if (compilation_string != NULL)
|
if (compilation_string != NULL)
|
||||||
format_and_print_line (compile_title,
|
if (format_and_print_line (compile_title,
|
||||||
compilation_string,
|
compilation_string,
|
||||||
MAX_CHARS_PER_LINE);
|
MAX_CHARS_PER_LINE) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
if (link_string != NULL)
|
if (link_string != NULL)
|
||||||
format_and_print_line (link_title,
|
if (format_and_print_line (link_title,
|
||||||
link_string,
|
link_string,
|
||||||
MAX_CHARS_PER_LINE);
|
MAX_CHARS_PER_LINE) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
|
if (printf ("\n") < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
printf ("\n");
|
|
||||||
/* TRANSLATORS: When available, an actual copyright character
|
/* TRANSLATORS: When available, an actual copyright character
|
||||||
(cirle-c) should be used in preference to "(C)". */
|
(cirle-c) should be used in preference to "(C)". */
|
||||||
fputs (_("\
|
if (fputs (_("\
|
||||||
Copyright (C) 2009 Free Software Foundation, Inc.\n"), stdout);
|
Copyright (C) 2009 Free Software Foundation, Inc.\n"), stdout) < 0)
|
||||||
fputs (_("\
|
exit (3);
|
||||||
|
if (fputs (_("\
|
||||||
License GPLv3+: GNU GPL version 3 or later\n\
|
License GPLv3+: GNU GPL version 3 or later\n\
|
||||||
<http://www.gnu.org/licenses/gpl.html>.\n\
|
<http://www.gnu.org/licenses/gpl.html>.\n\
|
||||||
This is free software: you are free to change and redistribute it.\n\
|
This is free software: you are free to change and redistribute it.\n\
|
||||||
There is NO WARRANTY, to the extent permitted by law.\n"), stdout);
|
There is NO WARRANTY, to the extent permitted by law.\n"), stdout) < 0)
|
||||||
|
exit (3);
|
||||||
/* TRANSLATORS: When available, please use the proper diacritics for
|
/* TRANSLATORS: When available, please use the proper diacritics for
|
||||||
names such as this one. See en_US.po for reference. */
|
names such as this one. See en_US.po for reference. */
|
||||||
fputs (_("\nOriginally written by Hrvoje Niksic <hniksic@xemacs.org>.\n"),
|
if (fputs (_("\nOriginally written by Hrvoje Niksic <hniksic@xemacs.org>.\n"),
|
||||||
stdout);
|
stdout) < 0)
|
||||||
fputs (_("Please send bug reports and questions to <bug-wget@gnu.org>.\n"),
|
exit (3);
|
||||||
stdout);
|
if (fputs (_("Please send bug reports and questions to <bug-wget@gnu.org>.\n"),
|
||||||
|
stdout) < 0)
|
||||||
|
exit (3);
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,10 +74,6 @@ as that of the covered work. */
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
/* The same for snprintf() and vsnprintf(). */
|
|
||||||
#define snprintf _snprintf
|
|
||||||
#define vsnprintf _vsnprintf
|
|
||||||
|
|
||||||
/* Define a wgint type under Windows. */
|
/* Define a wgint type under Windows. */
|
||||||
typedef __int64 wgint;
|
typedef __int64 wgint;
|
||||||
#define SIZEOF_WGINT 8
|
#define SIZEOF_WGINT 8
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ key_type_to_ssl_type (enum keyfile_type type)
|
|||||||
bool
|
bool
|
||||||
ssl_init ()
|
ssl_init ()
|
||||||
{
|
{
|
||||||
SSL_METHOD *meth;
|
SSL_METHOD const *meth;
|
||||||
|
|
||||||
if (ssl_ctx)
|
if (ssl_ctx)
|
||||||
/* The SSL has already been initialized. */
|
/* The SSL has already been initialized. */
|
||||||
|
|||||||
@@ -207,6 +207,7 @@ fd_read_body (int fd, FILE *out, wgint toread, wgint startpos,
|
|||||||
wgint *qtyread, wgint *qtywritten, double *elapsed, int flags)
|
wgint *qtyread, wgint *qtywritten, double *elapsed, int flags)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
#undef max
|
||||||
#define max(a,b) ((a) > (b) ? (a) : (b))
|
#define max(a,b) ((a) > (b) ? (a) : (b))
|
||||||
int dlbufsize = max (BUFSIZ, 8 * 1024);
|
int dlbufsize = max (BUFSIZ, 8 * 1024);
|
||||||
char *dlbuf = xmalloc (dlbufsize);
|
char *dlbuf = xmalloc (dlbufsize);
|
||||||
|
|||||||
36
src/utils.c
36
src/utils.c
@@ -42,15 +42,23 @@ as that of the covered work. */
|
|||||||
#ifdef HAVE_PROCESS_H
|
#ifdef HAVE_PROCESS_H
|
||||||
# include <process.h> /* getpid() */
|
# include <process.h> /* getpid() */
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_UTIME_H
|
|
||||||
# include <utime.h>
|
|
||||||
#endif
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
|
||||||
|
#if HAVE_UTIME
|
||||||
|
# include <sys/types.h>
|
||||||
|
# ifdef HAVE_UTIME_H
|
||||||
|
# include <utime.h>
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef HAVE_SYS_UTIME_H
|
||||||
|
# include <sys/utime.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* For TIOCGWINSZ and friends: */
|
/* For TIOCGWINSZ and friends: */
|
||||||
@@ -487,6 +495,20 @@ fork_to_background (void)
|
|||||||
void
|
void
|
||||||
touch (const char *file, time_t tm)
|
touch (const char *file, time_t tm)
|
||||||
{
|
{
|
||||||
|
#if HAVE_UTIME
|
||||||
|
# ifdef HAVE_STRUCT_UTIMBUF
|
||||||
|
struct utimbuf times;
|
||||||
|
# else
|
||||||
|
struct {
|
||||||
|
time_t actime;
|
||||||
|
time_t modtime;
|
||||||
|
} times;
|
||||||
|
# endif
|
||||||
|
times.modtime = tm;
|
||||||
|
times.actime = time (NULL);
|
||||||
|
if (utime (file, ×) == -1)
|
||||||
|
logprintf (LOG_NOTQUIET, "utime(%s): %s\n", file, strerror (errno));
|
||||||
|
#else
|
||||||
struct timespec timespecs[2];
|
struct timespec timespecs[2];
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
@@ -506,6 +528,7 @@ touch (const char *file, time_t tm)
|
|||||||
logprintf (LOG_NOTQUIET, "futimens(%s): %s\n", file, strerror (errno));
|
logprintf (LOG_NOTQUIET, "futimens(%s): %s\n", file, strerror (errno));
|
||||||
|
|
||||||
close (fd);
|
close (fd);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Checks if FILE is a symbolic link, and removes it if it is. Does
|
/* Checks if FILE is a symbolic link, and removes it if it is. Does
|
||||||
@@ -1930,9 +1953,10 @@ abort_run_with_timeout (int sig)
|
|||||||
/* We don't have siglongjmp to preserve the set of blocked signals;
|
/* We don't have siglongjmp to preserve the set of blocked signals;
|
||||||
if we longjumped out of the handler at this point, SIGALRM would
|
if we longjumped out of the handler at this point, SIGALRM would
|
||||||
remain blocked. We must unblock it manually. */
|
remain blocked. We must unblock it manually. */
|
||||||
int mask = siggetmask ();
|
sigset_t set;
|
||||||
mask &= ~sigmask (SIGALRM);
|
sigemptyset (&set);
|
||||||
sigsetmask (mask);
|
sigaddset (&set, SIGALRM);
|
||||||
|
sigprocmask (SIG_BLOCK, &set, NULL);
|
||||||
|
|
||||||
/* Now it's safe to longjump. */
|
/* Now it's safe to longjump. */
|
||||||
longjmp (run_with_timeout_env, -1);
|
longjmp (run_with_timeout_env, -1);
|
||||||
|
|||||||
Reference in New Issue
Block a user