-diff -urN wget-1.5.3.orig/configure wget-1.5.3/configure
---- wget-1.5.3.orig/configure Sat May 22 13:25:03 1999
-+++ wget-1.5.3/configure Sat May 22 13:31:33 1999
-@@ -1,7 +1,7 @@
- #! /bin/sh
-
- # Guess values for system-dependent variables and create Makefiles.
--# Generated automatically using autoconf version 2.12
-+# Generated automatically using autoconf version 2.13
- # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
- #
- # This configure script is free software; the Free Software Foundation
-@@ -12,6 +12,9 @@
- ac_default_prefix=/usr/local
- # Any additions from configure.in:
- ac_help="$ac_help
-+ --enable-ipv6 Enable ipv6 (with ipv4) support
-+ --disable-ipv6 Disable ipv6 support"
-+ac_help="$ac_help
- --with-socks use the socks library"
- ac_help="$ac_help
- --disable-opie disable support for opie or s/key FTP login"
-@@ -59,6 +62,7 @@
- # Initialize some other variables.
- subdirs=
- MFLAGS= MAKEFLAGS=
-+SHELL=${CONFIG_SHELL-/bin/sh}
- # Maximum number of lines to put in a shell here document.
- ac_max_here_lines=12
-
-@@ -342,7 +346,7 @@
- verbose=yes ;;
+diff -ur wget-1.8.1.orig/src/connect.c wget-1.8.1/src/connect.c
+--- wget-1.8.1.orig/src/connect.c Tue Nov 27 23:55:40 2001
++++ wget-1.8.1/src/connect.c Tue Feb 19 03:02:05 2002
+@@ -78,17 +78,49 @@
+ int
+ connect_to_one (const unsigned char *addr, unsigned short port, int silent)
+ {
++#ifdef INET6
++ struct addrinfo hints, *res;
++ struct sockaddr_storage sock_name;
++ char portstr[NI_MAXSERV];
++ int err;
++#else
+ struct sockaddr_in sock_name;
+- int sock, save_errno;
++#endif
++ int sock, save_errno, salen;
- -version | --version | --versio | --versi | --vers)
-- echo "configure generated by autoconf version 2.12"
-+ echo "configure generated by autoconf version 2.13"
- exit 0 ;;
+ /* Set port and protocol */
++#ifdef INET6
++ memset(&hints, 0, sizeof(hints));
++ hints.ai_family = PF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_flags = AI_NUMERICHOST;
++ snprintf(portstr, sizeof(portstr), "%d", port);
++ err = getaddrinfo(addr, portstr, &hints, &res);
++ if (err)
++ {
++ if (!silent)
++ logprintf (LOG_VERBOSE, "getaddrinfo: %s.\n", gai_strerror (err));
++ return -1;
++ }
++ memset (&sock_name, 0, sizeof (sock_name));
++ memcpy (&sock_name, res->ai_addr, res->ai_addrlen);
++ salen = res->ai_addrlen;
++ freeaddrinfo (res);
++#else
+ sock_name.sin_family = AF_INET;
+ sock_name.sin_port = htons (port);
+ memcpy ((unsigned char *)&sock_name.sin_addr, addr, 4);
++ salen = sizeof (sock_name);
++#endif
- -with-* | --with-*)
-@@ -512,9 +516,11 @@
- # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
- ac_cpp='$CPP $CPPFLAGS'
- ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
- cross_compiling=$ac_cv_prog_cc_cross
+ if (!silent)
+ {
++#ifdef INET6
++ char pretty_addr[INET6_ADDRSTRLEN];
++ pretty_print_address_sa (&sock_name, salen, pretty_addr);
++#else
+ char *pretty_addr = pretty_print_address (addr);
++#endif
+ if (connection_host_name
+ && 0 != strcmp (connection_host_name, pretty_addr))
+ logprintf (LOG_VERBOSE, _("Connecting to %s[%s]:%hu... "),
+@@ -99,26 +131,29 @@
+ }
-+ac_exeext=
-+ac_objext=o
- if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-@@ -537,6 +543,334 @@
- PACKAGE=wget
+ /* Make an internet socket, stream type. */
+- sock = socket (AF_INET, SOCK_STREAM, 0);
++ sock = socket (((struct sockaddr *)&sock_name)->sa_family, SOCK_STREAM, 0);
+ if (sock < 0)
+ goto out;
+ if (opt.bind_address)
+ {
+ /* Bind the client side to the requested address. */
+- if (bind (sock, (struct sockaddr *)opt.bind_address,
+- sizeof (*opt.bind_address)))
++ if (bind (sock, (struct sockaddr *)opt.bind_address, salen))
+ {
+- close (sock);
++ save_errno = errno;
++ CLOSE (sock);
++ errno = save_errno;
+ sock = -1;
+ goto out;
+ }
+ }
-+# Extract the first word of "gcc", so it can be a program name with args.
-+set dummy gcc; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:550: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ if test -n "$CC"; then
-+ ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-+ ac_dummy="$PATH"
-+ for ac_dir in $ac_dummy; do
-+ test -z "$ac_dir" && ac_dir=.
-+ if test -f $ac_dir/$ac_word; then
-+ ac_cv_prog_CC="gcc"
-+ break
-+ fi
-+ done
-+ IFS="$ac_save_ifs"
-+fi
-+fi
-+CC="$ac_cv_prog_CC"
-+if test -n "$CC"; then
-+ echo "$ac_t""$CC" 1>&6
-+else
-+ echo "$ac_t""no" 1>&6
-+fi
-+
-+if test -z "$CC"; then
-+ # Extract the first word of "cc", so it can be a program name with args.
-+set dummy cc; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:580: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ if test -n "$CC"; then
-+ ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-+ ac_prog_rejected=no
-+ ac_dummy="$PATH"
-+ for ac_dir in $ac_dummy; do
-+ test -z "$ac_dir" && ac_dir=.
-+ if test -f $ac_dir/$ac_word; then
-+ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-+ ac_prog_rejected=yes
-+ continue
-+ fi
-+ ac_cv_prog_CC="cc"
-+ break
-+ fi
-+ done
-+ IFS="$ac_save_ifs"
-+if test $ac_prog_rejected = yes; then
-+ # We found a bogon in the path, so make sure we never use it.
-+ set dummy $ac_cv_prog_CC
-+ shift
-+ if test $# -gt 0; then
-+ # We chose a different compiler from the bogus one.
-+ # However, it has the same basename, so the bogon will be chosen
-+ # first if we set CC to just the basename; use the full file name.
-+ shift
-+ set dummy "$ac_dir/$ac_word" "$@"
-+ shift
-+ ac_cv_prog_CC="$@"
-+ fi
-+fi
-+fi
-+fi
-+CC="$ac_cv_prog_CC"
-+if test -n "$CC"; then
-+ echo "$ac_t""$CC" 1>&6
-+else
-+ echo "$ac_t""no" 1>&6
-+fi
-+
-+ if test -z "$CC"; then
-+ case "`uname -s`" in
-+ *win32* | *WIN32*)
-+ # Extract the first word of "cl", so it can be a program name with args.
-+set dummy cl; ac_word=$2
-+echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-+echo "configure:631: checking for $ac_word" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ if test -n "$CC"; then
-+ ac_cv_prog_CC="$CC" # Let the user override the test.
-+else
-+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-+ ac_dummy="$PATH"
-+ for ac_dir in $ac_dummy; do
-+ test -z "$ac_dir" && ac_dir=.
-+ if test -f $ac_dir/$ac_word; then
-+ ac_cv_prog_CC="cl"
-+ break
-+ fi
-+ done
-+ IFS="$ac_save_ifs"
-+fi
-+fi
-+CC="$ac_cv_prog_CC"
-+if test -n "$CC"; then
-+ echo "$ac_t""$CC" 1>&6
-+else
-+ echo "$ac_t""no" 1>&6
-+fi
-+ ;;
-+ esac
-+ fi
-+ test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-+fi
-+
-+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-+echo "configure:663: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-+
-+ac_ext=c
-+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-+cross_compiling=$ac_cv_prog_cc_cross
-+
-+cat > conftest.$ac_ext << EOF
-+
-+#line 674 "configure"
-+#include "confdefs.h"
-+
-+main(){return(0);}
-+EOF
-+if { (eval echo configure:679: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-+ ac_cv_prog_cc_works=yes
-+ # If we can't run a trivial program, we are probably using a cross compiler.
-+ if (./conftest; exit) 2>/dev/null; then
-+ ac_cv_prog_cc_cross=no
-+ else
-+ ac_cv_prog_cc_cross=yes
-+ fi
-+else
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ ac_cv_prog_cc_works=no
-+fi
-+rm -fr conftest*
-+ac_ext=c
-+# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-+ac_cpp='$CPP $CPPFLAGS'
-+ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-+ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-+cross_compiling=$ac_cv_prog_cc_cross
-+
-+echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-+if test $ac_cv_prog_cc_works = no; then
-+ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-+fi
-+echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-+echo "configure:705: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-+echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-+cross_compiling=$ac_cv_prog_cc_cross
-+
-+echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-+echo "configure:710: checking whether we are using GNU C" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ cat > conftest.c <<EOF
-+#ifdef __GNUC__
-+ yes;
+ /* Connect the socket to the remote host. */
+- if (connect (sock, (struct sockaddr *)&sock_name, sizeof (sock_name)) < 0)
++ if (connect (sock, (struct sockaddr *)&sock_name, salen) < 0)
+ {
+- close (sock);
++ save_errno = errno;
++ CLOSE (sock);
++ errno = save_errno;
+ sock = -1;
+ goto out;
+ }
+@@ -130,6 +165,10 @@
+ if (!silent)
+ logprintf (LOG_VERBOSE, _("connected.\n"));
+ DEBUGP (("Created socket %d.\n", sock));
++#ifdef INET6
++ opt.conn_inet6 = ((struct sockaddr *)&sock_name)->sa_family == AF_INET6 ?
++ 1 : 0;
+#endif
-+EOF
-+if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:719: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-+ ac_cv_prog_gcc=yes
-+else
-+ ac_cv_prog_gcc=no
-+fi
-+fi
-+
-+echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-+
-+if test $ac_cv_prog_gcc = yes; then
-+ GCC=yes
-+else
-+ GCC=
-+fi
-+
-+ac_test_CFLAGS="${CFLAGS+set}"
-+ac_save_CFLAGS="$CFLAGS"
-+CFLAGS=
-+echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-+echo "configure:738: checking whether ${CC-cc} accepts -g" >&5
-+if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ echo 'void f(){}' > conftest.c
-+if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-+ ac_cv_prog_cc_g=yes
-+else
-+ ac_cv_prog_cc_g=no
-+fi
-+rm -f conftest*
-+
-+fi
-+
-+echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-+if test "$ac_test_CFLAGS" = set; then
-+ CFLAGS="$ac_save_CFLAGS"
-+elif test $ac_cv_prog_cc_g = yes; then
-+ if test "$GCC" = yes; then
-+ CFLAGS="-g -O2"
-+ else
-+ CFLAGS="-g"
-+ fi
-+else
-+ if test "$GCC" = yes; then
-+ CFLAGS="-O2"
-+ else
-+ CFLAGS=
-+ fi
-+fi
-+
-+
-+echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-+echo "configure:771: checking how to run the C preprocessor" >&5
-+# On Suns, sometimes $CPP names a directory.
-+if test -n "$CPP" && test -d "$CPP"; then
-+ CPP=
-+fi
-+if test -z "$CPP"; then
-+if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ # This must be in double quotes, not single quotes, because CPP may get
-+ # substituted into the Makefile and "${CC-cc}" will confuse make.
-+ CPP="${CC-cc} -E"
-+ # On the NeXT, cc -E runs the code through the compiler's parser,
-+ # not just through cpp.
-+ cat > conftest.$ac_ext <<EOF
-+#line 786 "configure"
-+#include "confdefs.h"
-+#include <assert.h>
-+Syntax Error
-+EOF
-+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-+{ (eval echo configure:792: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-+if test -z "$ac_err"; then
-+ :
-+else
-+ echo "$ac_err" >&5
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -rf conftest*
-+ CPP="${CC-cc} -E -traditional-cpp"
-+ cat > conftest.$ac_ext <<EOF
-+#line 803 "configure"
-+#include "confdefs.h"
-+#include <assert.h>
-+Syntax Error
-+EOF
-+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-+{ (eval echo configure:809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-+if test -z "$ac_err"; then
-+ :
-+else
-+ echo "$ac_err" >&5
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -rf conftest*
-+ CPP="${CC-cc} -nologo -E"
-+ cat > conftest.$ac_ext <<EOF
-+#line 820 "configure"
-+#include "confdefs.h"
-+#include <assert.h>
-+Syntax Error
-+EOF
-+ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-+{ (eval echo configure:826: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-+if test -z "$ac_err"; then
-+ :
-+else
-+ echo "$ac_err" >&5
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -rf conftest*
-+ CPP=/lib/cpp
-+fi
-+rm -f conftest*
-+fi
-+rm -f conftest*
-+fi
-+rm -f conftest*
-+ ac_cv_prog_CPP="$CPP"
-+fi
-+ CPP="$ac_cv_prog_CPP"
-+else
-+ ac_cv_prog_CPP="$CPP"
-+fi
-+echo "$ac_t""$CPP" 1>&6
-+
-+echo $ac_n "checking for AIX""... $ac_c" 1>&6
-+echo "configure:851: checking for AIX" >&5
-+cat > conftest.$ac_ext <<EOF
-+#line 853 "configure"
-+#include "confdefs.h"
-+#ifdef _AIX
-+ yes
+ }
+ else
+ {
+@@ -151,10 +190,28 @@
+ address_list_get_bounds (al, &start, &end);
+ for (i = start; i < end; i++)
+ {
++#ifdef INET6
++ struct addrinfo ai;
++ unsigned char *addr = (unsigned char *)&ai;
++ char hbuf[INET6_ADDRSTRLEN];
++ int err;
++#else
+ unsigned char addr[4];
+#endif
-+
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
-+#define _ALL_SOURCE 1
-+EOF
-+
-+else
-+ rm -rf conftest*
-+ echo "$ac_t""no" 1>&6
-+fi
-+rm -f conftest*
-+
-+
-+
- ac_aux_dir=
- for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do
- if test -f $ac_dir/install-sh; then
-@@ -558,26 +892,26 @@
-
-
- # Make sure we can run config.sub.
--if $ac_config_sub sun4 >/dev/null 2>&1; then :
-+if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then :
- else { echo "configure: error: can not run $ac_config_sub" 1>&2; exit 1; }
- fi
-
- echo $ac_n "checking host system type""... $ac_c" 1>&6
--echo "configure:567: checking host system type" >&5
-+echo "configure:901: checking host system type" >&5
-
- host_alias=$host
- case "$host_alias" in
- NONE)
- case $nonopt in
- NONE)
-- if host_alias=`$ac_config_guess`; then :
-+ if host_alias=`${CONFIG_SHELL-/bin/sh} $ac_config_guess`; then :
- else { echo "configure: error: can not guess host type; you must specify one" 1>&2; exit 1; }
- fi ;;
- *) host_alias=$nonopt ;;
- esac ;;
- esac
+ int sock;
+ address_list_copy_one (al, i, addr);
--host=`$ac_config_sub $host_alias`
-+host=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $host_alias`
- host_cpu=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
- host_vendor=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
- host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-@@ -588,6 +922,376 @@
- EOF
-
-
-+echo $ac_n "checking whether to enable ipv6""... $ac_c" 1>&6
-+echo "configure:927: checking whether to enable ipv6" >&5
-+# Check whether --enable-ipv6 or --disable-ipv6 was given.
-+if test "${enable_ipv6+set}" = set; then
-+ enableval="$enable_ipv6"
-+ case "$enableval" in
-+ no)
-+ echo "$ac_t""no" 1>&6
-+ ipv6=no
-+ ;;
-+ *) echo "$ac_t""yes" 1>&6
-+ cat >> confdefs.h <<\EOF
-+#define ENABLE_IPV6 1
-+EOF
-+
-+ ipv6=yes
-+ ;;
-+ esac
-+else
-+ if test "$cross_compiling" = yes; then
-+ echo "$ac_t""no" 1>&6
-+ ipv6=no
-+
-+else
-+ cat > conftest.$ac_ext <<EOF
-+#line 951 "configure"
-+#include "confdefs.h"
-+ /* AF_INET6 avalable check */
-+#include <sys/types.h>
-+#include <sys/socket.h>
-+main()
-+{
-+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
-+ exit(1);
-+ else
-+ exit(0);
-+}
-+
-+EOF
-+if { (eval echo configure:965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-+then
-+ echo "$ac_t""yes" 1>&6
-+ cat >> confdefs.h <<\EOF
-+#define ENABLE_IPV6 1
-+EOF
-+
-+ ipv6=yes
-+else
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -fr conftest*
-+ echo "$ac_t""no" 1>&6
-+ ipv6=no
-+fi
-+rm -fr conftest*
-+fi
-+
-+fi
-+
-+
-+ipv6type=unknown
-+ipv6lib=none
-+
-+if test "$ipv6" = "yes"; then
-+ echo $ac_n "checking ipv6 stack type""... $ac_c" 1>&6
-+echo "configure:991: checking ipv6 stack type" >&5
-+ for i in inria kame linux toshiba v6d zeta; do
-+ case $i in
-+ inria)
-+ cat > conftest.$ac_ext <<EOF
-+#line 996 "configure"
-+#include "confdefs.h"
-+dnl
-+#include <netinet/in.h>
-+#ifdef IPV6_INRIA_VERSION
-+yes
-+#endif
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ ipv6type=$i;
-+ CFLAGS="-DINET6 $CFLAGS"
-+fi
-+rm -f conftest*
-+
-+ ;;
-+ kame)
-+ cat > conftest.$ac_ext <<EOF
-+#line 1015 "configure"
-+#include "confdefs.h"
-+dnl
-+#include <netinet/in.h>
-+#ifdef __KAME__
-+yes
++#ifdef INET6
++ err = getnameinfo(ai.ai_addr, ai.ai_addrlen, hbuf, sizeof (hbuf),
++ NULL, 0, NI_NUMERICHOST);
++ if (err)
++ {
++ if (!silent)
++ logprintf (LOG_VERBOSE, "getnameinfo: %s.\n", gai_strerror (err));
++ continue;
++ }
++ addr = (unsigned char *)hbuf;
+#endif
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"
-+fi
-+rm -f conftest*
-+
-+ ;;
-+ linux)
-+ if test -d /usr/inet6; then
-+ ipv6type=$i
-+ ipv6lib=inet6
-+ ipv6libdir=/usr/inet6/lib
-+ CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
-+ fi
-+ ;;
-+ toshiba)
-+ cat > conftest.$ac_ext <<EOF
-+#line 1044 "configure"
-+#include "confdefs.h"
-+dnl
-+#include <sys/param.h>
-+#ifdef _TOSHIBA_INET6
-+yes
+ sock = connect_to_one (addr, port, silent);
+ if (sock >= 0)
+ /* Success. */
+@@ -207,14 +264,27 @@
+ internal variable MPORT is set to the value of the ensuing master
+ socket. Call acceptport() to block for and accept a connection. */
+ uerr_t
+-bindport (unsigned short *port)
++bindport_af (unsigned short *port, int af)
+ {
+ int optval = 1;
++#ifdef INET6
++ static struct sockaddr_storage srv;
++#else
+ static struct sockaddr_in srv;
+#endif
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"
-+fi
-+rm -f conftest*
-+
-+ ;;
-+ v6d)
-+ cat > conftest.$ac_ext <<EOF
-+#line 1065 "configure"
-+#include "confdefs.h"
-+dnl
-+#include </usr/local/v6/include/sys/v6config.h>
-+#ifdef __V6D__
-+yes
++ int alen;
+
+ msock = -1;
+ addr = (struct sockaddr *) &srv;
+- if ((msock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
++ if (af == AF_INET)
++ alen = sizeof (struct sockaddr_in);
++#ifdef INET6
++ else if (af == AF_INET6)
++ alen = sizeof (struct sockaddr_in6);
+#endif
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ ipv6type=$i;
-+ ipv6lib=v6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-I/usr/local/v6/include $CFLAGS"
-+fi
-+rm -f conftest*
-+
-+ ;;
-+ zeta)
-+ cat > conftest.$ac_ext <<EOF
-+#line 1086 "configure"
-+#include "confdefs.h"
-+dnl
-+#include <sys/param.h>
-+#ifdef _ZETA_MINAMI_INET6
-+yes
++ else
++ return CONSOCKERR;
++ if ((msock = socket (af, SOCK_STREAM, 0)) < 0)
+ return CONSOCKERR;
+ if (setsockopt (msock, SOL_SOCKET, SO_REUSEADDR,
+ (char *)&optval, sizeof (optval)) < 0)
+@@ -222,14 +292,18 @@
+
+ if (opt.bind_address == NULL)
+ {
+- srv.sin_family = AF_INET;
++ memset (&srv, 0, sizeof (srv));
++ ((struct sockaddr *)&srv)->sa_family = af;
++ /* in6addr_any : all 0 */
++#ifndef INET6
+ srv.sin_addr.s_addr = htonl (INADDR_ANY);
+#endif
-+EOF
-+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-+ egrep "yes" >/dev/null 2>&1; then
-+ rm -rf conftest*
-+ ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"
-+fi
-+rm -f conftest*
-+
-+ ;;
-+ esac
-+ if test "$ipv6type" != "unknown"; then
-+ break
-+ fi
-+ done
-+ echo "$ac_t""$ipv6type" 1>&6
-+fi
-+
-+if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
-+ if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
-+ LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
-+ else
-+ echo 'Fatal: no $ipv6lib library found. cannot continue.'
-+ echo "You need to fetch lib$ipv6lib.a from appropriate"
-+ echo 'ipv6 kit and compile beforehand.'
-+ exit 1
-+ fi
-+fi
-+
-+echo $ac_n "checking getaddrinfo bug""... $ac_c" 1>&6
-+echo "configure:1125: checking getaddrinfo bug" >&5
-+if test "$cross_compiling" = yes; then
-+ echo "$ac_t""buggy" 1>&6
-+buggygetaddrinfo=yes
-+else
-+ cat > conftest.$ac_ext <<EOF
-+#line 1131 "configure"
-+#include "confdefs.h"
+ }
+ else
+ srv = *opt.bind_address;
+
+- srv.sin_port = htons (*port);
+- if (bind (msock, addr, sizeof (struct sockaddr_in)) < 0)
++ ((struct sockaddr_in *)&srv)->sin_port = htons (*port); /* same sin6 */
++ if (bind (msock, addr, alen) < 0)
+ {
+ CLOSE (msock);
+ msock = -1;
+@@ -241,14 +315,14 @@
+ /* #### addrlen should be a 32-bit type, which int is not
+ guaranteed to be. Oh, and don't try to make it a size_t,
+ because that can be 64-bit. */
+- int addrlen = sizeof (struct sockaddr_in);
++ int addrlen = sizeof (srv);
+ if (getsockname (msock, addr, &addrlen) < 0)
+ {
+ CLOSE (msock);
+ msock = -1;
+ return CONPORTERR;
+ }
+- *port = ntohs (srv.sin_port);
++ *port = ntohs (((struct sockaddr_in *)addr)->sin_port); /* same sin6 */
+ }
+ if (listen (msock, 1) < 0)
+ {
+@@ -257,6 +331,12 @@
+ return LISTENERR;
+ }
+ return BINDOK;
++}
+
-+#include <sys/types.h>
-+#include <netdb.h>
-+#include <string.h>
++uerr_t
++bindport (unsigned short *port)
++{
++ return bindport_af (port, AF_INET);
+ }
+
+ #ifdef HAVE_SELECT
+diff -ur wget-1.8.1.orig/src/connect.h wget-1.8.1/src/connect.h
+--- wget-1.8.1.orig/src/connect.h Fri Nov 30 03:22:18 2001
++++ wget-1.8.1/src/connect.h Mon Feb 11 23:53:31 2002
+@@ -30,6 +30,7 @@
+
+ int test_socket_open PARAMS ((int));
+ int select_fd PARAMS ((int, int, int));
++uerr_t bindport_af PARAMS ((unsigned short *, int));
+ uerr_t bindport PARAMS ((unsigned short *));
+ uerr_t acceptport PARAMS ((int *));
+ void closeport PARAMS ((int));
+diff -ur wget-1.8.1.orig/src/ftp-basic.c wget-1.8.1/src/ftp-basic.c
+--- wget-1.8.1.orig/src/ftp-basic.c Mon Dec 10 11:29:11 2001
++++ wget-1.8.1/src/ftp-basic.c Tue Feb 19 00:29:13 2002
+@@ -35,7 +35,12 @@
+
+ #ifdef WINDOWS
+ # include <winsock.h>
++#else
+#include <sys/socket.h>
+#include <netinet/in.h>
++#include <netdb.h>
+ #endif
++#include <limits.h>
+
+ #include "wget.h"
+ #include "utils.h"
+@@ -340,6 +345,137 @@
+ xfree (respline);
+ return FTPOK;
+ }
+
-+main()
++#ifdef INET6
++/* Bind a port and send the appropriate EPRT command to the FTP
++ server. Use acceptport after RETR, to get the socket of data
++ connection. */
++uerr_t
++ftp_eprt (struct rbuf *rbuf)
+{
-+ int passive, gaierr, inet4 = 0, inet6 = 0;
-+ struct addrinfo hints, *ai, *aitop;
-+ char straddr[INET6_ADDRSTRLEN], strport[16];
-+
-+ for (passive = 0; passive <= 1; passive++) {
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_family = AF_UNSPEC;
-+ hints.ai_flags = passive ? AI_PASSIVE : 0;
-+ hints.ai_socktype = SOCK_STREAM;
-+ if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
-+ (void)gai_strerror(gaierr);
-+ goto bad;
++ uerr_t err;
++ char *request, *respline, *bytes;
++ int nwritten;
++ unsigned short port;
++ struct sockaddr_storage ss;
++ int sslen;
++ char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
++ int af;
++
++ /* Get the address of this side of the connection. */
++ sslen = sizeof(ss);
++ if (getsockname(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
++ return HOSTERR;
++ /* Construct the argument of EPRT. */
++ if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
++ NULL, 0, NI_NUMERICHOST) != 0)
++ return HOSTERR;
++ /* Setting port to 0 lets the system choose a free port. */
++ port = 0;
++ /* Bind the port. */
++ err = bindport_af (&port, ((struct sockaddr *)&ss)->sa_family);
++ if (err != BINDOK)
++ return err;
++ sprintf(pbuf, "%u", port);
++ af = ((struct sockaddr *)&ss)->sa_family == AF_INET6 ? 2 : 1;
++ bytes = (char *)alloca (1 + strlen(hbuf) + strlen(pbuf) + 4 + 1);
++ sprintf (bytes, "|%d|%s|%s|", af, hbuf, pbuf);
++ /* Send EPRT request. */
++ request = ftp_request ("EPRT", bytes);
++ nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
++ if (nwritten < 0)
++ {
++ free (request);
++ return WRITEFAILED;
+ }
-+ for (ai = aitop; ai; ai = ai->ai_next) {
-+ if (ai->ai_addr == NULL ||
-+ ai->ai_addrlen == 0 ||
-+ getnameinfo(ai->ai_addr, ai->ai_addrlen,
-+ straddr, sizeof(straddr), strport, sizeof(strport),
-+ NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
-+ goto bad;
-+ }
-+ if (strcmp(strport, "54321") != 0) {
-+ goto bad;
-+ }
-+ switch (ai->ai_family) {
-+ case AF_INET:
-+ if (passive) {
-+ if (strcmp(straddr, "0.0.0.0") != 0) {
-+ goto bad;
-+ }
-+ } else {
-+ if (strcmp(straddr, "127.0.0.1") != 0) {
-+ goto bad;
-+ }
-+ }
-+ inet4++;
-+ break;
-+ case AF_INET6:
-+ if (passive) {
-+ if (strcmp(straddr, "::") != 0) {
-+ goto bad;
-+ }
-+ } else {
-+ if (strcmp(straddr, "::1") != 0) {
-+ goto bad;
-+ }
-+ }
-+ inet6++;
-+ break;
-+ case AF_UNSPEC:
-+ goto bad;
-+ break;
-+ default:
-+ /* another family support? */
-+ break;
-+ }
++ free (request);
++ /* Get appropriate response. */
++ err = ftp_response (rbuf, &respline);
++ if (err != FTPOK)
++ {
++ free (respline);
++ return err;
+ }
-+ }
-+
-+ if (inet6 != 2 || inet4 != 2)
-+ goto bad;
-+
-+ if (aitop)
-+ freeaddrinfo(aitop);
-+ exit(0);
-+
-+ bad:
-+ if (aitop)
-+ freeaddrinfo(aitop);
-+ exit(1);
++ if (*respline != '2')
++ {
++ free (respline);
++ return FTPPORTERR;
++ }
++ free (respline);
++ return FTPOK;
+}
+
-+EOF
-+if { (eval echo configure:1215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-+then
-+ echo "$ac_t""good" 1>&6
-+buggygetaddrinfo=no
-+else
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -fr conftest*
-+ echo "$ac_t""buggy" 1>&6
-+buggygetaddrinfo=yes
-+fi
-+rm -fr conftest*
-+fi
-+
-+
-+if test "$buggygetaddrinfo" = "yes"; then
-+ if test "$ipv6" = "yes"; then
-+ echo 'Fatal: You must get working getaddrinfo() function.'
-+ echo ' or you can specify "--disable-ipv6"'.
-+ exit 1
-+ else
-+ for ac_func in getaddrinfo getnameinfo
-+do
-+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-+echo "configure:1239: checking for $ac_func" >&5
-+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-+ echo $ac_n "(cached) $ac_c" 1>&6
-+else
-+ cat > conftest.$ac_ext <<EOF
-+#line 1244 "configure"
-+#include "confdefs.h"
-+/* System header to define __stub macros and hopefully few prototypes,
-+ which can conflict with char $ac_func(); below. */
-+#include <assert.h>
-+/* Override any gcc2 internal prototype to avoid an error. */
-+/* We use char because int might match the return type of a gcc2
-+ builtin and then its argument prototype would still apply. */
-+char $ac_func();
++/* Similar to ftp_eprt, but uses `EPSV' to initiate the passive FTP
++ transfer. Reads the response from server and parses it. Reads the
++ host and port addresses and returns them. */
++uerr_t
++ftp_epsv (struct rbuf *rbuf, char *hbuf, unsigned short *pport)
++{
++ char *request, *respline, *s, *ep, delim;
++ long rcv;
++ int nwritten;
++ uerr_t err;
++ struct sockaddr_storage ss;
++ int sslen = sizeof(ss);
++
++ if (getpeername(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
++ return HOSTERR;
++ if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, INET6_ADDRSTRLEN,
++ NULL, 0, NI_NUMERICHOST) != 0)
++ return HOSTERR;
+
-+int main() {
++ /* Form the request. */
++ request = ftp_request ("EPSV", NULL);
++ /* And send it. */
++ nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
++ if (nwritten < 0)
++ {
++ free (request);
++ return WRITEFAILED;
++ }
++ free (request);
++ /* Get the server response. */
++ err = ftp_response (rbuf, &respline);
++ if (err != FTPOK)
++ goto fin;
++ if (strncmp(respline, "229", 3) != 0)
++ {
++ err = FTPNOPASV;
++ goto fin;
++ }
++ /* Parse the request. */
++ s = respline;
++ for (s += 4; *s && *s != '('; s++);
++ if (!*s)
++ {
++ err = FTPINVPASV;
++ goto fin;
++ }
++ s++;
++ if (s[0] && s[0] == s[1] && s[0] == s[2])
++ {
++ delim = s[0];
++ s += 3;
++ }
++ else
++ {
++ err = FTPINVPASV;
++ goto fin;
++ }
++ rcv = strtol (s, &ep, 10);
++ if (rcv <= 0 || rcv > USHRT_MAX || *ep != delim)
++ {
++ err = FTPINVPASV;
++ goto fin;
++ }
++ *pport = (unsigned short)rcv;
++ err = FTPOK;
+
-+/* The GNU C library defines this for functions which it implements
-+ to always fail with ENOSYS. Some functions are actually named
-+ something starting with __ and the normal name is an alias. */
-+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
-+choke me
-+#else
-+$ac_func();
++fin:
++ free (respline);
++ return err;
++}
+#endif
-+
-+; return 0; }
-+EOF
-+if { (eval echo configure:1267: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-+ rm -rf conftest*
-+ eval "ac_cv_func_$ac_func=yes"
-+else
-+ echo "configure: failed program was:" >&5
-+ cat conftest.$ac_ext >&5
-+ rm -rf conftest*
-+ eval "ac_cv_func_$ac_func=no"
-+fi
-+rm -f conftest*
-+fi
-+
-+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-+ echo "$ac_t""yes" 1>&6
-+ ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-+ cat >> confdefs.h <<EOF
-+#define $ac_tr_func 1
-+EOF
-+
-+else
-+ echo "$ac_t""no" 1>&6
-+LIBOBJS="$LIBOBJS ${ac_func}.${ac_objext}"
-+fi
-+done
-+
-+
-+ fi
-+fi
-+
- # Check whether --with-socks or --without-socks was given.
- if test "${with_socks+set}" = set; then
- withval="$with_socks"
-@@ -648,7 +1352,7 @@
-
- echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
--echo "configure:652: checking whether ${MAKE-make} sets \${MAKE}" >&5
-+echo "configure:1356: checking whether ${MAKE-make} sets \${MAKE}" >&5
- set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -682,28 +1386,30 @@
- # SunOS /usr/etc/install
- # IRIX /sbin/install
- # AIX /bin/install
-+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
- # AFS /usr/afsws/bin/install, which mishandles nonexistent args
- # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
- # ./install, which can be erroneously created by make from ./install.sh.
- echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
--echo "configure:690: checking for a BSD compatible install" >&5
-+echo "configure:1395: checking for a BSD compatible install" >&5
- if test -z "$INSTALL"; then
- if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-- IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
-+ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":"
- for ac_dir in $PATH; do
- # Account for people who put trailing slashes in PATH elements.
- case "$ac_dir/" in
- /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
-- for ac_prog in ginstall installbsd scoinst install; do
-+ # Don't use installbsd from OSF since it installs stuff as root
-+ # by default.
-+ for ac_prog in ginstall scoinst install; do
- if test -f $ac_dir/$ac_prog; then
- if test $ac_prog = install &&
- grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
-- # OSF/1 installbsd also uses dspmsg, but is usable.
- :
- else
- ac_cv_path_install="$ac_dir/$ac_prog -c"
-@@ -733,6 +1439,8 @@
- # It thinks the first close brace ends the variable substitution.
- test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+ /* Sends the TYPE request to the server. */
+ uerr_t
+diff -ur wget-1.8.1.orig/src/ftp.c wget-1.8.1/src/ftp.c
+--- wget-1.8.1.orig/src/ftp.c Tue Dec 4 02:22:05 2001
++++ wget-1.8.1/src/ftp.c Tue Feb 19 03:35:12 2002
+@@ -33,6 +33,9 @@
+ #include <sys/types.h>
+ #include <assert.h>
+ #include <errno.h>
++#include <sys/socket.h>
++#include <netinet/in.h>
++#include <arpa/inet.h>
-+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+ #include "wget.h"
+ #include "utils.h"
+@@ -489,6 +492,54 @@
+ {
+ if (opt.ftp_pasv > 0)
+ {
++ unsigned short tport;
++#ifdef INET6
++ char thost[64];
++
++ if (!opt.conn_inet6)
++ goto noepsv;
++ if (!opt.server_response)
++ logputs (LOG_VERBOSE, "==> EPSV ... ");
++ err = ftp_epsv (&con->rbuf, thost, &tport);
++ /* FTPRERR, WRITEFAILED, FTPNOPASV, FTPINVPASV, HOSTERR */
++ switch (err)
++ {
++ case FTPRERR:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET, _("\
++Error in server response, closing control connection.\n"));
++ break;
++ case WRITEFAILED:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET,
++ _("Write failed, closing control connection.\n"));
++ break;
++ case FTPNOPASV:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET, _("Cannot initiate EPSV transfer.\n"));
++ goto tryeprt;
++ case FTPINVPASV:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET, _("Cannot parse EPSV response.\n"));
++ goto tryeprt;
++ case HOSTERR:
++ logputs (LOG_VERBOSE, "\n");
++ logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
++ break;
++ case FTPOK:
++ /* fine and dandy */
++ inet_aton(thost, (struct in_addr *)pasv_addr);
++ goto pasvok;
++ default:
++ abort ();
++ break;
++ }
++ CLOSE (csock);
++ rbuf_uninitialize (&con->rbuf);
++ return err;
+
- test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-@@ -740,177 +1448,6 @@
- test -z "$CFLAGS" && CFLAGS= auto_cflags=1
- test -z "$CC" && cc_specified=yes
-
--# Extract the first word of "gcc", so it can be a program name with args.
--set dummy gcc; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:747: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-- for ac_dir in $PATH; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- ac_cv_prog_CC="gcc"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
--fi
--fi
--CC="$ac_cv_prog_CC"
--if test -n "$CC"; then
-- echo "$ac_t""$CC" 1>&6
--else
-- echo "$ac_t""no" 1>&6
--fi
--
--if test -z "$CC"; then
-- # Extract the first word of "cc", so it can be a program name with args.
--set dummy cc; ac_word=$2
--echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:776: checking for $ac_word" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- if test -n "$CC"; then
-- ac_cv_prog_CC="$CC" # Let the user override the test.
--else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-- ac_prog_rejected=no
-- for ac_dir in $PATH; do
-- test -z "$ac_dir" && ac_dir=.
-- if test -f $ac_dir/$ac_word; then
-- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-- ac_prog_rejected=yes
-- continue
-- fi
-- ac_cv_prog_CC="cc"
-- break
-- fi
-- done
-- IFS="$ac_save_ifs"
--if test $ac_prog_rejected = yes; then
-- # We found a bogon in the path, so make sure we never use it.
-- set dummy $ac_cv_prog_CC
-- shift
-- if test $# -gt 0; then
-- # We chose a different compiler from the bogus one.
-- # However, it has the same basename, so the bogon will be chosen
-- # first if we set CC to just the basename; use the full file name.
-- shift
-- set dummy "$ac_dir/$ac_word" "$@"
-- shift
-- ac_cv_prog_CC="$@"
-- fi
--fi
--fi
--fi
--CC="$ac_cv_prog_CC"
--if test -n "$CC"; then
-- echo "$ac_t""$CC" 1>&6
--else
-- echo "$ac_t""no" 1>&6
--fi
--
-- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
--fi
--
--echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
--echo "configure:824: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
--
--ac_ext=c
--# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
--ac_cpp='$CPP $CPPFLAGS'
--ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
--ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
--cross_compiling=$ac_cv_prog_cc_cross
--
--cat > conftest.$ac_ext <<EOF
--#line 834 "configure"
--#include "confdefs.h"
--main(){return(0);}
--EOF
--if { (eval echo configure:838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-- ac_cv_prog_cc_works=yes
-- # If we can't run a trivial program, we are probably using a cross compiler.
-- if (./conftest; exit) 2>/dev/null; then
-- ac_cv_prog_cc_cross=no
-- else
-- ac_cv_prog_cc_cross=yes
-- fi
--else
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- ac_cv_prog_cc_works=no
--fi
--rm -fr conftest*
--
--echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
--if test $ac_cv_prog_cc_works = no; then
-- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
--fi
--echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
--echo "configure:858: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
--echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
--cross_compiling=$ac_cv_prog_cc_cross
--
--echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
--echo "configure:863: checking whether we are using GNU C" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- cat > conftest.c <<EOF
--#ifdef __GNUC__
-- yes;
--#endif
--EOF
--if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-- ac_cv_prog_gcc=yes
--else
-- ac_cv_prog_gcc=no
--fi
--fi
--
--echo "$ac_t""$ac_cv_prog_gcc" 1>&6
--
--if test $ac_cv_prog_gcc = yes; then
-- GCC=yes
-- ac_test_CFLAGS="${CFLAGS+set}"
-- ac_save_CFLAGS="$CFLAGS"
-- CFLAGS=
-- echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
--echo "configure:887: checking whether ${CC-cc} accepts -g" >&5
--if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- echo 'void f(){}' > conftest.c
--if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
-- ac_cv_prog_cc_g=yes
--else
-- ac_cv_prog_cc_g=no
--fi
--rm -f conftest*
--
--fi
--
--echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-- if test "$ac_test_CFLAGS" = set; then
-- CFLAGS="$ac_save_CFLAGS"
-- elif test $ac_cv_prog_cc_g = yes; then
-- CFLAGS="-g -O2"
-- else
-- CFLAGS="-O2"
-- fi
--else
-- GCC=
-- test "${CFLAGS+set}" = set || CFLAGS="-g"
--fi
--
--
- if test -n "$auto_cflags"; then
- if test -n "$GCC"; then
- CFLAGS="$CFLAGS -O2 -Wall -Wno-implicit"
-@@ -923,92 +1460,6 @@
- fi
- fi
-
--echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
--echo "configure:928: checking how to run the C preprocessor" >&5
--# On Suns, sometimes $CPP names a directory.
--if test -n "$CPP" && test -d "$CPP"; then
-- CPP=
--fi
--if test -z "$CPP"; then
--if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-- echo $ac_n "(cached) $ac_c" 1>&6
--else
-- # This must be in double quotes, not single quotes, because CPP may get
-- # substituted into the Makefile and "${CC-cc}" will confuse make.
-- CPP="${CC-cc} -E"
-- # On the NeXT, cc -E runs the code through the compiler's parser,
-- # not just through cpp.
-- cat > conftest.$ac_ext <<EOF
--#line 943 "configure"
--#include "confdefs.h"
--#include <assert.h>
--Syntax Error
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:949: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
--if test -z "$ac_err"; then
-- :
--else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- CPP="${CC-cc} -E -traditional-cpp"
-- cat > conftest.$ac_ext <<EOF
--#line 960 "configure"
--#include "confdefs.h"
--#include <assert.h>
--Syntax Error
--EOF
--ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
--if test -z "$ac_err"; then
-- :
--else
-- echo "$ac_err" >&5
-- echo "configure: failed program was:" >&5
-- cat conftest.$ac_ext >&5
-- rm -rf conftest*
-- CPP=/lib/cpp
--fi
--rm -f conftest*
--fi
--rm -f conftest*
-- ac_cv_prog_CPP="$CPP"
--fi
-- CPP="$ac_cv_prog_CPP"
--else
-- ac_cv_prog_CPP="$CPP"
--fi
--echo "$ac_t""$CPP" 1>&6
--
--echo $ac_n "checking for AIX""... $ac_c" 1>&6
--echo "configure:989: checking for AIX" >&5
--cat > conftest.$ac_ext <<EOF
--#line 991 "configure"
--#include "confdefs.h"
--#ifdef _AIX
-- yes
--#endif
--
--EOF
--if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- egrep "yes" >/dev/null 2>&1; then
-- rm -rf conftest*
-- echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
--#define _ALL_SOURCE 1
--EOF
--
--else
-- rm -rf conftest*
-- echo "$ac_t""no" 1>&6
--fi
--rm -f conftest*
--
--
++ noepsv:
++#endif
+ if (!opt.server_response)
+ logputs (LOG_VERBOSE, "==> PASV ... ");
+ err = ftp_pasv (&con->rbuf, pasv_addr);
+@@ -528,10 +579,17 @@
+ }
+ if (err==FTPOK)
+ {
+- unsigned short tport;
-
- case "$host_os" in
- *win32) exeext='.exe';;
- *) exeext='';;
-@@ -1017,7 +1468,7 @@
-
-
- echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6
--echo "configure:1021: checking for ${CC-cc} option to accept ANSI C" >&5
-+echo "configure:1472: checking for ${CC-cc} option to accept ANSI C" >&5
- if eval "test \"`echo '$''{'am_cv_prog_cc_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-@@ -1033,7 +1484,7 @@
- do
- CC="$ac_save_CC $ac_arg"
- cat > conftest.$ac_ext <<EOF
--#line 1037 "configure"
-+#line 1488 "configure"
- #include "confdefs.h"
- #if !defined(__STDC__) || __STDC__ != 1
- choke me
-@@ -1051,7 +1502,7 @@
- struct s2 {int (*f) (double a);};
- ; return 0; }
- EOF
--if { (eval echo configure:1055: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:1506: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- am_cv_prog_cc_stdc="$ac_arg"; break
- else
-@@ -1073,7 +1524,7 @@
-
-
- echo $ac_n "checking for function prototypes""... $ac_c" 1>&6
--echo "configure:1077: checking for function prototypes" >&5
-+echo "configure:1528: checking for function prototypes" >&5
- if test "$am_cv_prog_cc_stdc" != no; then
- echo "$ac_t""yes" 1>&6
- cat >> confdefs.h <<\EOF
-@@ -1086,12 +1537,12 @@
- U=_ ANSI2KNR=./ansi2knr
- # Ensure some checks needed by ansi2knr itself.
- echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
--echo "configure:1090: checking for ANSI C header files" >&5
-+echo "configure:1541: checking for ANSI C header files" >&5
- if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1095 "configure"
-+#line 1546 "configure"
- #include "confdefs.h"
- #include <stdlib.h>
- #include <stdarg.h>
-@@ -1099,8 +1550,8 @@
- #include <float.h>
- EOF
- ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1103: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
-+{ (eval echo configure:1554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
- if test -z "$ac_err"; then
- rm -rf conftest*
- ac_cv_header_stdc=yes
-@@ -1116,7 +1567,7 @@
- if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat > conftest.$ac_ext <<EOF
--#line 1120 "configure"
-+#line 1571 "configure"
- #include "confdefs.h"
- #include <string.h>
- EOF
-@@ -1134,7 +1585,7 @@
- if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat > conftest.$ac_ext <<EOF
--#line 1138 "configure"
-+#line 1589 "configure"
- #include "confdefs.h"
- #include <stdlib.h>
- EOF
-@@ -1155,7 +1606,7 @@
- :
- else
- cat > conftest.$ac_ext <<EOF
--#line 1159 "configure"
-+#line 1610 "configure"
- #include "confdefs.h"
- #include <ctype.h>
- #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-@@ -1166,7 +1617,7 @@
- exit (0); }
-
- EOF
--if { (eval echo configure:1170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-+if { (eval echo configure:1621: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
- then
- :
- else
-@@ -1193,18 +1644,18 @@
- do
- ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
- echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--echo "configure:1197: checking for $ac_hdr" >&5
-+echo "configure:1648: checking for $ac_hdr" >&5
- if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1202 "configure"
-+#line 1653 "configure"
- #include "confdefs.h"
- #include <$ac_hdr>
- EOF
- ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1207: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
-+{ (eval echo configure:1658: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
- if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-@@ -1233,12 +1684,12 @@
-
-
- echo $ac_n "checking for working const""... $ac_c" 1>&6
--echo "configure:1237: checking for working const" >&5
-+echo "configure:1688: checking for working const" >&5
- if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1242 "configure"
-+#line 1693 "configure"
- #include "confdefs.h"
-
- int main() {
-@@ -1287,7 +1738,7 @@
-
- ; return 0; }
- EOF
--if { (eval echo configure:1291: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:1742: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_const=yes
- else
-@@ -1308,12 +1759,12 @@
- fi
++#ifdef INET6
++ inet_ntop (AF_INET, pasv_addr, thost, sizeof (thost));
++#endif
+ tport = (pasv_addr[4] << 8) + pasv_addr[5];
++
++#ifdef INET6
++ pasvok:
++ dtsock = connect_to_one (thost, tport, 1);
++#else
+ dtsock = connect_to_one (pasv_addr, tport, 1);
++#endif
- echo $ac_n "checking for size_t""... $ac_c" 1>&6
--echo "configure:1312: checking for size_t" >&5
-+echo "configure:1763: checking for size_t" >&5
- if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1317 "configure"
-+#line 1768 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #if STDC_HEADERS
-@@ -1322,7 +1773,7 @@
- #endif
- EOF
- if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-+ egrep "(^|[^a-zA-Z_0-9])size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_size_t=yes
- else
-@@ -1341,12 +1792,12 @@
- fi
+ if (dtsock < 0)
+ {
+@@ -539,7 +597,11 @@
+ CLOSE (csock);
+ rbuf_uninitialize (&con->rbuf);
+ logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"),
++#ifdef INET6
++ thost, tport,
++#else
+ pretty_print_address (pasv_addr), tport,
++#endif
+ strerror (save_errno));
+ return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR;
+ }
+@@ -552,6 +614,61 @@
- echo $ac_n "checking for pid_t""... $ac_c" 1>&6
--echo "configure:1345: checking for pid_t" >&5
-+echo "configure:1796: checking for pid_t" >&5
- if eval "test \"`echo '$''{'ac_cv_type_pid_t'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1350 "configure"
-+#line 1801 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #if STDC_HEADERS
-@@ -1355,7 +1806,7 @@
- #endif
- EOF
- if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-- egrep "pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-+ egrep "(^|[^a-zA-Z_0-9])pid_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
- rm -rf conftest*
- ac_cv_type_pid_t=yes
- else
-@@ -1374,14 +1825,14 @@
- fi
+ if (!passive_mode_open) /* Try to use a port command if PASV failed */
+ {
++#ifdef INET6
++ if (!opt.conn_inet6)
++ goto noeprt;
++ tryeprt:
++ if (!opt.server_response)
++ logputs (LOG_VERBOSE, "==> EPRT ... ");
++ err = ftp_eprt (&con->rbuf);
++ /* FTPRERR, WRITEFAILED, bindport (CONSOCKERR, CONPORTERR, BINDERR,
++ LISTENERR), HOSTERR, FTPPORTERR */
++ switch (err)
++ {
++ case FTPRERR:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET, _("\
++Error in server response, closing control connection.\n"));
++ break;
++ case WRITEFAILED:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET,
++ _("Write failed, closing control connection.\n"));
++ break;
++ case CONSOCKERR:
++ logputs (LOG_VERBOSE, "\n");
++ logprintf (LOG_NOTQUIET, "socket: %s\n", strerror (errno));
++ break;
++ case CONPORTERR: case BINDERR: case LISTENERR:
++ /* What now? These problems are local... */
++ logputs (LOG_VERBOSE, "\n");
++ logprintf (LOG_NOTQUIET, _("Bind error (%s).\n"),
++ strerror (errno));
++ closeport (dtsock);
++ return err;
++ break;
++ case HOSTERR:
++ logputs (LOG_VERBOSE, "\n");
++ logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
++ break;
++ case FTPPORTERR:
++ logputs (LOG_VERBOSE, "\n");
++ logputs (LOG_NOTQUIET, _("Invalid EPRT.\n"));
++ break;
++ case FTPOK:
++ /* fine and dandy */
++ goto portok;
++ default:
++ abort ();
++ break;
++ } /* eprt switch */
++ CLOSE (csock);
++ closeport (dtsock);
++ rbuf_uninitialize (&con->rbuf);
++ return err;
++
++ noeprt:
++#endif
+ if (!opt.server_response)
+ logputs (LOG_VERBOSE, "==> PORT ... ");
+ err = ftp_port (&con->rbuf);
+@@ -608,6 +725,9 @@
+ abort ();
+ break;
+ } /* port switch */
++#ifdef INET6
++ portok:
++#endif
+ if (!opt.server_response)
+ logputs (LOG_VERBOSE, _("done. "));
+ } /* dtsock == -1 */
+diff -ur wget-1.8.1.orig/src/ftp.h wget-1.8.1/src/ftp.h
+--- wget-1.8.1.orig/src/ftp.h Thu Nov 22 09:24:27 2001
++++ wget-1.8.1/src/ftp.h Tue Feb 19 00:32:35 2002
+@@ -37,6 +37,10 @@
+ uerr_t ftp_login PARAMS ((struct rbuf *, const char *, const char *));
+ uerr_t ftp_port PARAMS ((struct rbuf *));
+ uerr_t ftp_pasv PARAMS ((struct rbuf *, unsigned char *));
++#ifdef INET6
++uerr_t ftp_eprt PARAMS ((struct rbuf *));
++uerr_t ftp_epsv PARAMS ((struct rbuf *, char *, unsigned short *));
++#endif
+ uerr_t ftp_type PARAMS ((struct rbuf *, int));
+ uerr_t ftp_cwd PARAMS ((struct rbuf *, const char *));
+ uerr_t ftp_retr PARAMS ((struct rbuf *, const char *));
+diff -ur wget-1.8.1.orig/src/host.c wget-1.8.1/src/host.c
+--- wget-1.8.1.orig/src/host.c Tue Dec 11 17:32:57 2001
++++ wget-1.8.1/src/host.c Wed Feb 13 04:14:11 2002
+@@ -77,7 +77,11 @@
+
+ struct address_list {
+ int count; /* number of adrresses */
++#ifdef INET6
++ struct addrinfo *addresses;
++#else
+ ipv4_address *addresses; /* pointer to the string of addresses */
++#endif
- echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
--echo "configure:1378: checking whether byte ordering is bigendian" >&5
-+echo "configure:1829: checking whether byte ordering is bigendian" >&5
- if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- ac_cv_c_bigendian=unknown
- # See if sys/param.h defines the BYTE_ORDER macro.
- cat > conftest.$ac_ext <<EOF
--#line 1385 "configure"
-+#line 1836 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #include <sys/param.h>
-@@ -1392,11 +1843,11 @@
- #endif
- ; return 0; }
- EOF
--if { (eval echo configure:1396: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:1847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- # It does; now see whether it defined to BIG_ENDIAN or not.
- cat > conftest.$ac_ext <<EOF
--#line 1400 "configure"
-+#line 1851 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #include <sys/param.h>
-@@ -1407,7 +1858,7 @@
- #endif
- ; return 0; }
- EOF
--if { (eval echo configure:1411: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:1862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_c_bigendian=yes
- else
-@@ -1427,7 +1878,7 @@
- { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
- else
- cat > conftest.$ac_ext <<EOF
--#line 1431 "configure"
-+#line 1882 "configure"
- #include "confdefs.h"
- main () {
- /* Are we little or big endian? From Harbison&Steele. */
-@@ -1440,7 +1891,7 @@
- exit (u.c[sizeof (long) - 1] == 1);
+ int faulty; /* number of addresses known not to
+ work. */
+@@ -100,8 +104,17 @@
+ address_list_copy_one (struct address_list *al, int index,
+ unsigned char *ip_store)
+ {
++#ifdef INET6
++ struct addrinfo *ai;
++ assert (index >= al->faulty && index < al->count);
++ for (ai = al->addresses; ai; ai = ai->ai_next, index--)
++ if (index <= 0)
++ break;
++ memcpy (ip_store, ai, sizeof (*ai));
++#else
+ assert (index >= al->faulty && index < al->count);
+ memcpy (ip_store, al->addresses + index, sizeof (ipv4_address));
++#endif
}
- EOF
--if { (eval echo configure:1444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-+if { (eval echo configure:1895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
- then
- ac_cv_c_bigendian=no
- else
-@@ -1468,18 +1919,18 @@
- do
- ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
- echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--echo "configure:1472: checking for $ac_hdr" >&5
-+echo "configure:1923: checking for $ac_hdr" >&5
- if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1477 "configure"
-+#line 1928 "configure"
- #include "confdefs.h"
- #include <$ac_hdr>
- EOF
- ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1482: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
-+{ (eval echo configure:1933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
- if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-@@ -1508,18 +1959,18 @@
- do
- ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
- echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--echo "configure:1512: checking for $ac_hdr" >&5
-+echo "configure:1963: checking for $ac_hdr" >&5
- if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1517 "configure"
-+#line 1968 "configure"
- #include "confdefs.h"
- #include <$ac_hdr>
- EOF
- ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:1522: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
-+{ (eval echo configure:1973: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
- if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-@@ -1545,12 +1996,12 @@
- done
-
- echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
--echo "configure:1549: checking whether time.h and sys/time.h may both be included" >&5
-+echo "configure:2000: checking whether time.h and sys/time.h may both be included" >&5
- if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1554 "configure"
-+#line 2005 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #include <sys/time.h>
-@@ -1559,7 +2010,7 @@
- struct tm *tp;
- ; return 0; }
- EOF
--if { (eval echo configure:1563: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:2014: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_header_time=yes
- else
-@@ -1581,12 +2032,12 @@
-
-
- echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
--echo "configure:1585: checking return type of signal handlers" >&5
-+echo "configure:2036: checking return type of signal handlers" >&5
- if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1590 "configure"
-+#line 2041 "configure"
- #include "confdefs.h"
- #include <sys/types.h>
- #include <signal.h>
-@@ -1603,7 +2054,7 @@
- int i;
- ; return 0; }
- EOF
--if { (eval echo configure:1607: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-+if { (eval echo configure:2058: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- ac_cv_type_signal=void
- else
-@@ -1623,10 +2074,10 @@
-
-
- echo $ac_n "checking for struct utimbuf""... $ac_c" 1>&6
--echo "configure:1627: checking for struct utimbuf" >&5
-+echo "configure:2078: checking for struct utimbuf" >&5
- if test x"$ac_cv_header_utime_h" = xyes; then
- cat > conftest.$ac_ext <<EOF
--#line 1630 "configure"
-+#line 2081 "configure"
- #include "confdefs.h"
- #include <utime.h>
- EOF
-@@ -1651,19 +2102,19 @@
- # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
- # for constant arguments. Useless!
- echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
--echo "configure:1655: checking for working alloca.h" >&5
-+echo "configure:2106: checking for working alloca.h" >&5
- if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1660 "configure"
-+#line 2111 "configure"
- #include "confdefs.h"
- #include <alloca.h>
- int main() {
- char *p = alloca(2 * sizeof(int));
- ; return 0; }
- EOF
--if { (eval echo configure:1667: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_header_alloca_h=yes
- else
-@@ -1684,25 +2135,30 @@
- fi
-
- echo $ac_n "checking for alloca""... $ac_c" 1>&6
--echo "configure:1688: checking for alloca" >&5
-+echo "configure:2139: checking for alloca" >&5
- if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1693 "configure"
-+#line 2144 "configure"
- #include "confdefs.h"
- #ifdef __GNUC__
- # define alloca __builtin_alloca
- #else
--# if HAVE_ALLOCA_H
--# include <alloca.h>
-+# ifdef _MSC_VER
-+# include <malloc.h>
-+# define alloca _alloca
- # else
--# ifdef _AIX
-- #pragma alloca
-+# if HAVE_ALLOCA_H
-+# include <alloca.h>
- # else
--# ifndef alloca /* predefined by HP cc +Olibcalls */
-+# ifdef _AIX
-+ #pragma alloca
-+# else
-+# ifndef alloca /* predefined by HP cc +Olibcalls */
- char *alloca ();
-+# endif
- # endif
- # endif
- # endif
-@@ -1712,7 +2168,7 @@
- char *p = (char *) alloca(1);
- ; return 0; }
- EOF
--if { (eval echo configure:1716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_cv_func_alloca_works=yes
- else
-@@ -1737,19 +2193,19 @@
- # that cause trouble. Some versions do not even contain alloca or
- # contain a buggy version. If you still want to use their alloca,
- # use ar to extract alloca.o from them instead of compiling alloca.c.
-- ALLOCA=alloca.o
-+ ALLOCA=alloca.${ac_objext}
- cat >> confdefs.h <<\EOF
- #define C_ALLOCA 1
- EOF
-
-
- echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
--echo "configure:1748: checking whether alloca needs Cray hooks" >&5
-+echo "configure:2204: checking whether alloca needs Cray hooks" >&5
- if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1753 "configure"
-+#line 2209 "configure"
- #include "confdefs.h"
- #if defined(CRAY) && ! defined(CRAY2)
- webecray
-@@ -1774,12 +2230,12 @@
- if test $ac_cv_os_cray = yes; then
- for ac_func in _getb67 GETB67 getb67; do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1778: checking for $ac_func" >&5
-+echo "configure:2234: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1783 "configure"
-+#line 2239 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -1802,7 +2258,7 @@
-
- ; return 0; }
- EOF
--if { (eval echo configure:1806: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2262: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -1829,7 +2285,7 @@
- fi
-
- echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
--echo "configure:1833: checking stack direction for C alloca" >&5
-+echo "configure:2289: checking stack direction for C alloca" >&5
- if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-@@ -1837,7 +2293,7 @@
- ac_cv_c_stack_direction=0
- else
- cat > conftest.$ac_ext <<EOF
--#line 1841 "configure"
-+#line 2297 "configure"
- #include "confdefs.h"
- find_stack_direction ()
+ /* Check whether two address lists have all their IPs in common. */
+@@ -109,12 +122,27 @@
+ int
+ address_list_match_all (struct address_list *al1, struct address_list *al2)
{
-@@ -1856,7 +2312,7 @@
- exit (find_stack_direction() < 0);
++#ifdef INET6
++ struct addrinfo *ai1, *ai2;
++#endif
+ if (al1 == al2)
+ return 1;
+ if (al1->count != al2->count)
+ return 0;
++#ifdef INET6
++ for (ai1 = al1->addresses, ai2 = al2->addresses; ai1;
++ ai1 = ai1->ai_next, ai2 = ai2->ai_next)
++ {
++ if (ai1->ai_addrlen != ai2->ai_addrlen)
++ return 0;
++ if (memcmp (ai1->ai_addr, ai2->ai_addr, ai1->ai_addrlen))
++ return 0;
++ }
++ return 1;
++#else
+ return 0 == memcmp (al1->addresses, al2->addresses,
+ al1->count * sizeof (ipv4_address));
++#endif
}
- EOF
--if { (eval echo configure:1860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
-+if { (eval echo configure:2316: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
- then
- ac_cv_c_stack_direction=1
- else
-@@ -1880,12 +2336,12 @@
- for ac_func in strdup strstr strcasecmp strncasecmp
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1884: checking for $ac_func" >&5
-+echo "configure:2340: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1889 "configure"
-+#line 2345 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -1908,7 +2364,7 @@
-
- ; return 0; }
- EOF
--if { (eval echo configure:1912: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2368: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -1935,12 +2391,12 @@
- for ac_func in gettimeofday mktime strptime
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1939: checking for $ac_func" >&5
-+echo "configure:2395: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1944 "configure"
-+#line 2400 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -1963,7 +2419,7 @@
- ; return 0; }
- EOF
--if { (eval echo configure:1967: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2423: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -1990,12 +2446,12 @@
- for ac_func in strerror vsnprintf select signal symlink access isatty
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:1994: checking for $ac_func" >&5
-+echo "configure:2450: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 1999 "configure"
-+#line 2455 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -2018,7 +2474,7 @@
+ /* Mark the INDEXth element of AL as faulty, so that the next time
+@@ -141,26 +169,44 @@
+ as returned by gethostbyname. */
- ; return 0; }
- EOF
--if { (eval echo configure:2022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -2045,12 +2501,12 @@
- for ac_func in uname gethostname
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:2049: checking for $ac_func" >&5
-+echo "configure:2505: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 2054 "configure"
-+#line 2510 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -2073,7 +2529,7 @@
-
- ; return 0; }
- EOF
--if { (eval echo configure:2077: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2533: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -2101,12 +2557,12 @@
- for ac_func in gethostbyname
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:2105: checking for $ac_func" >&5
-+echo "configure:2561: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 2110 "configure"
-+#line 2566 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -2129,7 +2585,7 @@
+ static struct address_list *
++#ifdef INET6
++address_list_new (struct addrinfo *ai)
++{
++ struct addrinfo *res;
++#else
+ address_list_new (char **h_addr_list)
+ {
+- int count = 0, i;
++ int i;
++#endif
++ int count = 0;
- ; return 0; }
- EOF
--if { (eval echo configure:2133: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -2151,7 +2607,7 @@
- else
- echo "$ac_t""no" 1>&6
- echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
--echo "configure:2155: checking for gethostbyname in -lnsl" >&5
-+echo "configure:2611: checking for gethostbyname in -lnsl" >&5
- ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -2159,7 +2615,7 @@
- ac_save_LIBS="$LIBS"
- LIBS="-lnsl $LIBS"
- cat > conftest.$ac_ext <<EOF
--#line 2163 "configure"
-+#line 2619 "configure"
- #include "confdefs.h"
- /* Override any gcc2 internal prototype to avoid an error. */
- /* We use char because int might match the return type of a gcc2
-@@ -2170,7 +2626,7 @@
- gethostbyname()
- ; return 0; }
- EOF
--if { (eval echo configure:2174: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2630: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
- else
-@@ -2204,7 +2660,7 @@
+ struct address_list *al = xmalloc (sizeof (struct address_list));
++#ifdef INET6
++ for (res = ai; res; res = res->ai_next)
++#else
+ while (h_addr_list[count])
++#endif
+ ++count;
+ assert (count > 0);
+ al->count = count;
+ al->faulty = 0;
++#ifdef INET6
++ al->addresses = ai;
++#else
+ al->addresses = xmalloc (count * sizeof (ipv4_address));
++#endif
+ al->refcount = 1;
- echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6
--echo "configure:2208: checking for socket in -lsocket" >&5
-+echo "configure:2664: checking for socket in -lsocket" >&5
- ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -2212,7 +2668,7 @@
- ac_save_LIBS="$LIBS"
- LIBS="-lsocket $LIBS"
- cat > conftest.$ac_ext <<EOF
--#line 2216 "configure"
-+#line 2672 "configure"
- #include "confdefs.h"
- /* Override any gcc2 internal prototype to avoid an error. */
- /* We use char because int might match the return type of a gcc2
-@@ -2223,7 +2679,7 @@
- socket()
- ; return 0; }
- EOF
--if { (eval echo configure:2227: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
- else
-@@ -2254,7 +2710,7 @@
- if test "x${with_socks}" = xyes
- then
- echo $ac_n "checking for main in -lresolv""... $ac_c" 1>&6
--echo "configure:2258: checking for main in -lresolv" >&5
-+echo "configure:2714: checking for main in -lresolv" >&5
- ac_lib_var=`echo resolv'_'main | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -2262,14 +2718,14 @@
- ac_save_LIBS="$LIBS"
- LIBS="-lresolv $LIBS"
- cat > conftest.$ac_ext <<EOF
--#line 2266 "configure"
-+#line 2722 "configure"
- #include "confdefs.h"
++#ifndef INET6
+ for (i = 0; i < count; i++)
+ memcpy (al->addresses + i, h_addr_list[i], sizeof (ipv4_address));
++#endif
- int main() {
- main()
- ; return 0; }
- EOF
--if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2729: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
- else
-@@ -2297,7 +2753,7 @@
- fi
+ return al;
+ }
- echo $ac_n "checking for Rconnect in -lsocks""... $ac_c" 1>&6
--echo "configure:2301: checking for Rconnect in -lsocks" >&5
-+echo "configure:2757: checking for Rconnect in -lsocks" >&5
- ac_lib_var=`echo socks'_'Rconnect | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -2305,7 +2761,7 @@
- ac_save_LIBS="$LIBS"
- LIBS="-lsocks $LIBS"
- cat > conftest.$ac_ext <<EOF
--#line 2309 "configure"
-+#line 2765 "configure"
- #include "confdefs.h"
- /* Override any gcc2 internal prototype to avoid an error. */
- /* We use char because int might match the return type of a gcc2
-@@ -2316,7 +2772,7 @@
- Rconnect()
- ; return 0; }
- EOF
--if { (eval echo configure:2320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:2776: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
- else
-@@ -2348,7 +2804,7 @@
- ALL_LINGUAS="cs de hr no it pl pt_BR"
++#ifndef INET6
+ /* Like address_list_new, but initialized with only one address. */
- echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6
--echo "configure:2352: checking whether NLS is requested" >&5
-+echo "configure:2808: checking whether NLS is requested" >&5
- # Check whether --enable-nls or --disable-nls was given.
- if test "${enable_nls+set}" = set; then
- enableval="$enable_nls"
-@@ -2365,7 +2821,7 @@
- # Extract the first word of "msgfmt", so it can be a program name with args.
- set dummy msgfmt; ac_word=$2
- echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:2369: checking for $ac_word" >&5
-+echo "configure:2825: checking for $ac_word" >&5
- if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-@@ -2399,7 +2855,7 @@
- # Extract the first word of "xgettext", so it can be a program name with args.
- set dummy xgettext; ac_word=$2
- echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:2403: checking for $ac_word" >&5
-+echo "configure:2859: checking for $ac_word" >&5
- if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-@@ -2434,7 +2890,7 @@
- # Extract the first word of "gmsgfmt", so it can be a program name with args.
- set dummy gmsgfmt; ac_word=$2
- echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:2438: checking for $ac_word" >&5
-+echo "configure:2894: checking for $ac_word" >&5
- if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
-@@ -2442,9 +2898,13 @@
- /*)
- ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path.
- ;;
-+ ?:/*)
-+ ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path.
-+ ;;
- *)
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-- for ac_dir in $PATH; do
-+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-+ ac_dummy="$PATH"
-+ for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_path_GMSGFMT="$ac_dir/$ac_word"
-@@ -2480,18 +2940,18 @@
- do
- ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
- echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
--echo "configure:2484: checking for $ac_hdr" >&5
-+echo "configure:2944: checking for $ac_hdr" >&5
- if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 2489 "configure"
-+#line 2949 "configure"
- #include "confdefs.h"
- #include <$ac_hdr>
- EOF
- ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
--{ (eval echo configure:2494: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
--ac_err=`grep -v '^ *+' conftest.out`
-+{ (eval echo configure:2954: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-+ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
- if test -z "$ac_err"; then
- rm -rf conftest*
- eval "ac_cv_header_$ac_safe=yes"
-@@ -2520,12 +2980,12 @@
- for ac_func in gettext
- do
- echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
--echo "configure:2524: checking for $ac_func" >&5
-+echo "configure:2984: checking for $ac_func" >&5
- if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- cat > conftest.$ac_ext <<EOF
--#line 2529 "configure"
-+#line 2989 "configure"
- #include "confdefs.h"
- /* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $ac_func(); below. */
-@@ -2548,7 +3008,7 @@
+ static struct address_list *
+@@ -175,11 +221,16 @@
- ; return 0; }
- EOF
--if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:3012: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_$ac_func=yes"
- else
-@@ -2570,7 +3030,7 @@
- else
- echo "$ac_t""no" 1>&6
- echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6
--echo "configure:2574: checking for gettext in -lintl" >&5
-+echo "configure:3034: checking for gettext in -lintl" >&5
- ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'`
- if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-@@ -2578,7 +3038,7 @@
- ac_save_LIBS="$LIBS"
- LIBS="-lintl $LIBS"
- cat > conftest.$ac_ext <<EOF
--#line 2582 "configure"
-+#line 3042 "configure"
- #include "confdefs.h"
- /* Override any gcc2 internal prototype to avoid an error. */
- /* We use char because int might match the return type of a gcc2
-@@ -2589,7 +3049,7 @@
- gettext()
- ; return 0; }
- EOF
--if { (eval echo configure:2593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
-+if { (eval echo configure:3053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
- else
-@@ -2657,15 +3117,16 @@
- # Extract the first word of "$ac_prog", so it can be a program name with args.
- set dummy $ac_prog; ac_word=$2
- echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
--echo "configure:2661: checking for $ac_word" >&5
-+echo "configure:3121: checking for $ac_word" >&5
- if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
- else
- if test -n "$MAKEINFO"; then
- ac_cv_prog_MAKEINFO="$MAKEINFO" # Let the user override the test.
- else
-- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
-- for ac_dir in $PATH; do
-+ IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
-+ ac_dummy="$PATH"
-+ for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_MAKEINFO="$ac_prog"
-@@ -2715,7 +3176,7 @@
- # Ultrix sh set writes to stderr and can't be redirected directly,
- # and sets the high bit in the cache file unless we assign to the vars.
- (set) 2>&1 |
-- case `(ac_space=' '; set) 2>&1` in
-+ case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
-@@ -2782,7 +3243,7 @@
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-- echo "$CONFIG_STATUS generated by autoconf version 2.12"
-+ echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
-@@ -2802,9 +3263,11 @@
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
- $ac_vpsub
- $extrasub
-+s%@SHELL@%$SHELL%g
- s%@CFLAGS@%$CFLAGS%g
- s%@CPPFLAGS@%$CPPFLAGS%g
- s%@CXXFLAGS@%$CXXFLAGS%g
-+s%@FFLAGS@%$FFLAGS%g
- s%@DEFS@%$DEFS%g
- s%@LDFLAGS@%$LDFLAGS%g
- s%@LIBS@%$LIBS%g
-@@ -2825,18 +3288,20 @@
- s%@mandir@%$mandir%g
- s%@VERSION@%$VERSION%g
- s%@PACKAGE@%$PACKAGE%g
-+s%@CC@%$CC%g
-+s%@CPP@%$CPP%g
- s%@host@%$host%g
- s%@host_alias@%$host_alias%g
- s%@host_cpu@%$host_cpu%g
- s%@host_vendor@%$host_vendor%g
- s%@host_os@%$host_os%g
-+s%@LIBOBJS@%$LIBOBJS%g
- s%@MD5_OBJ@%$MD5_OBJ%g
- s%@OPIE_OBJ@%$OPIE_OBJ%g
- s%@SET_MAKE@%$SET_MAKE%g
- s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-+s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
- s%@INSTALL_DATA@%$INSTALL_DATA%g
--s%@CC@%$CC%g
--s%@CPP@%$CPP%g
- s%@exeext@%$exeext%g
- s%@U@%$U%g
- s%@ANSI2KNR@%$ANSI2KNR%g
-diff -urN wget-1.5.3.orig/configure.in wget-1.5.3/configure.in
---- wget-1.5.3.orig/configure.in Sat May 22 13:25:03 1999
-+++ wget-1.5.3/configure.in Sat May 22 13:31:36 1999
-@@ -32,12 +32,243 @@
- PACKAGE=wget
- AC_SUBST(PACKAGE)
+ return al;
+ }
++#endif
-+AC_PROG_CC
-+
-+dnl
-+dnl Handle AIX
-+dnl
-+AC_AIX
-+
- dnl
- dnl Get cannonical host
- dnl
- AC_CANONICAL_HOST
- AC_DEFINE_UNQUOTED(OS_TYPE, "$host_os")
+ static void
+ address_list_delete (struct address_list *al)
+ {
++#ifdef INET6
++ freeaddrinfo (al->addresses);
++#else
+ xfree (al->addresses);
++#endif
+ xfree (al);
+ }
-+AC_MSG_CHECKING([whether to enable ipv6])
-+AC_ARG_ENABLE(ipv6,
-+[ --enable-ipv6 Enable ipv6 (with ipv4) support
-+ --disable-ipv6 Disable ipv6 support],
-+[ case "$enableval" in
-+ no)
-+ AC_MSG_RESULT(no)
-+ ipv6=no
-+ ;;
-+ *) AC_MSG_RESULT(yes)
-+ AC_DEFINE(ENABLE_IPV6)
-+ ipv6=yes
-+ ;;
-+ esac ],
-+
-+ AC_TRY_RUN([ /* AF_INET6 avalable check */
-+#include <sys/types.h>
-+#include <sys/socket.h>
-+main()
-+{
-+ if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
-+ exit(1);
-+ else
-+ exit(0);
-+}
-+],
-+ AC_MSG_RESULT(yes)
-+ AC_DEFINE(ENABLE_IPV6)
-+ ipv6=yes,
-+ AC_MSG_RESULT(no)
-+ ipv6=no,
-+ AC_MSG_RESULT(no)
-+ ipv6=no
-+))
-+
-+ipv6type=unknown
-+ipv6lib=none
-+
-+if test "$ipv6" = "yes"; then
-+ AC_MSG_CHECKING([ipv6 stack type])
-+ for i in inria kame linux toshiba v6d zeta; do
-+ case $i in
-+ inria)
-+ dnl http://www.kame.net/
-+ AC_EGREP_CPP(yes, [dnl
-+#include <netinet/in.h>
-+#ifdef IPV6_INRIA_VERSION
-+yes
-+#endif],
-+ [ipv6type=$i;
-+ CFLAGS="-DINET6 $CFLAGS"])
-+ ;;
-+ kame)
-+ dnl http://www.kame.net/
-+ AC_EGREP_CPP(yes, [dnl
-+#include <netinet/in.h>
-+#ifdef __KAME__
-+yes
-+#endif],
-+ [ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"])
-+ ;;
-+ linux)
-+ dnl http://www.v6.linux.or.jp/
-+ if test -d /usr/inet6; then
-+ ipv6type=$i
-+ ipv6lib=inet6
-+ ipv6libdir=/usr/inet6/lib
-+ CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
-+ fi
-+ ;;
-+ toshiba)
-+ AC_EGREP_CPP(yes, [dnl
-+#include <sys/param.h>
-+#ifdef _TOSHIBA_INET6
-+yes
-+#endif],
-+ [ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"])
-+ ;;
-+ v6d)
-+ AC_EGREP_CPP(yes, [dnl
-+#include </usr/local/v6/include/sys/v6config.h>
-+#ifdef __V6D__
-+yes
-+#endif],
-+ [ipv6type=$i;
-+ ipv6lib=v6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-I/usr/local/v6/include $CFLAGS"])
-+ ;;
-+ zeta)
-+ AC_EGREP_CPP(yes, [dnl
-+#include <sys/param.h>
-+#ifdef _ZETA_MINAMI_INET6
-+yes
-+#endif],
-+ [ipv6type=$i;
-+ ipv6lib=inet6;
-+ ipv6libdir=/usr/local/v6/lib;
-+ CFLAGS="-DINET6 $CFLAGS"])
-+ ;;
-+ esac
-+ if test "$ipv6type" != "unknown"; then
-+ break
-+ fi
-+ done
-+ AC_MSG_RESULT($ipv6type)
-+fi
-+
-+if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
-+ if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
-+ LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
-+ else
-+ echo 'Fatal: no $ipv6lib library found. cannot continue.'
-+ echo "You need to fetch lib$ipv6lib.a from appropriate"
-+ echo 'ipv6 kit and compile beforehand.'
-+ exit 1
-+ fi
-+fi
-+
-+AC_MSG_CHECKING(getaddrinfo bug)
-+AC_TRY_RUN([
-+#include <sys/types.h>
-+#include <netdb.h>
-+#include <string.h>
-+#include <sys/socket.h>
-+#include <netinet/in.h>
-+
-+main()
+@@ -203,6 +254,17 @@
+ {
+ return inet_ntoa (*(struct in_addr *)addr);
+ }
++#ifdef INET6
++int
++pretty_print_address_sa (const void *addr, int alen, char *abuf)
+{
-+ int passive, gaierr, inet4 = 0, inet6 = 0;
-+ struct addrinfo hints, *ai, *aitop;
-+ char straddr[INET6_ADDRSTRLEN], strport[16];
-+
-+ for (passive = 0; passive <= 1; passive++) {
-+ memset(&hints, 0, sizeof(hints));
-+ hints.ai_family = AF_UNSPEC;
-+ hints.ai_flags = passive ? AI_PASSIVE : 0;
-+ hints.ai_socktype = SOCK_STREAM;
-+ if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
-+ (void)gai_strerror(gaierr);
-+ goto bad;
-+ }
-+ for (ai = aitop; ai; ai = ai->ai_next) {
-+ if (ai->ai_addr == NULL ||
-+ ai->ai_addrlen == 0 ||
-+ getnameinfo(ai->ai_addr, ai->ai_addrlen,
-+ straddr, sizeof(straddr), strport, sizeof(strport),
-+ NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
-+ goto bad;
-+ }
-+ if (strcmp(strport, "54321") != 0) {
-+ goto bad;
-+ }
-+ switch (ai->ai_family) {
-+ case AF_INET:
-+ if (passive) {
-+ if (strcmp(straddr, "0.0.0.0") != 0) {
-+ goto bad;
-+ }
-+ } else {
-+ if (strcmp(straddr, "127.0.0.1") != 0) {
-+ goto bad;
-+ }
-+ }
-+ inet4++;
-+ break;
-+ case AF_INET6:
-+ if (passive) {
-+ if (strcmp(straddr, "::") != 0) {
-+ goto bad;
-+ }
-+ } else {
-+ if (strcmp(straddr, "::1") != 0) {
-+ goto bad;
-+ }
-+ }
-+ inet6++;
-+ break;
-+ case AF_UNSPEC:
-+ goto bad;
-+ break;
-+ default:
-+ /* another family support? */
-+ break;
-+ }
-+ }
-+ }
-+
-+ if (inet6 != 2 || inet4 != 2)
-+ goto bad;
-+
-+ if (aitop)
-+ freeaddrinfo(aitop);
-+ exit(0);
-+
-+ bad:
-+ if (aitop)
-+ freeaddrinfo(aitop);
-+ exit(1);
++ int err = getnameinfo((struct sockaddr *)addr, alen, abuf, INET6_ADDRSTRLEN,
++ NULL, 0, NI_NUMERICHOST);
++ if (err)
++ strcpy (abuf, "???");
++ return err;
+}
-+],
-+AC_MSG_RESULT(good)
-+buggygetaddrinfo=no,
-+AC_MSG_RESULT(buggy)
-+buggygetaddrinfo=yes,
-+AC_MSG_RESULT(buggy)
-+buggygetaddrinfo=yes)
-+
-+if test "$buggygetaddrinfo" = "yes"; then
-+ if test "$ipv6" = "yes"; then
-+ echo 'Fatal: You must get working getaddrinfo() function.'
-+ echo ' or you can specify "--disable-ipv6"'.
-+ exit 1
-+ else
-+ AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
-+ fi
-+fi
-+
- dnl
- dnl Process features.
- dnl
-@@ -88,8 +319,6 @@
- test -z "$CFLAGS" && CFLAGS= auto_cflags=1
- test -z "$CC" && cc_specified=yes
-
--AC_PROG_CC
--
- dnl
- dnl if the user hasn't specified CFLAGS, then
- dnl if compiler is gcc, then use -O2 and some warning flags
-@@ -106,11 +335,6 @@
- esac
- fi
- fi
--
--dnl
--dnl Handle AIX
--dnl
--AC_AIX
++#endif
- dnl
- dnl In case of {cyg,gnu}win32. Should be a _target_ test.
-diff -urN wget-1.5.3.orig/doc/Makefile.in~ wget-1.5.3/doc/Makefile.in~
---- wget-1.5.3.orig/doc/Makefile.in~ Sat May 22 13:25:03 1999
-+++ wget-1.5.3/doc/Makefile.in~ Thu Jan 1 01:00:00 1970
-@@ -1,145 +0,0 @@
--# Makefile for `wget' utility
--# Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
--
--# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
--
--#
--# Version: @VERSION@
--#
--
--SHELL = /bin/sh
--
--# Program to format Texinfo source into Info files.
--MAKEINFO = @MAKEINFO@
--# Program to format Texinfo source into DVI files.
--TEXI2DVI = texi2dvi
--# Program to convert DVI files to PostScript
--DVIPS = dvips -D 300
--# Program to convert texinfo files to html
--TEXI2HTML = texi2html -expandinfo -split_chapter
--
--top_srcdir = @top_srcdir@
--srcdir = @srcdir@
--VPATH = @srcdir@
--
--prefix = @prefix@
--infodir = @infodir@
--mandir = @mandir@
--manext = 1
--sysconfdir = @sysconfdir@
--
--INSTALL = @INSTALL@
--INSTALL_DATA = @INSTALL_DATA@
--RM = rm -f
--
--MAN = wget.$(manext)
--WGETRC = $(sysconfdir)/wgetrc
--
--#
--# Dependencies for building
--#
--
--all: wget.info # wget.cat
--
--everything: all wget_us.ps wget_a4.ps wget_toc.html
--
--wget.info: wget.texi
-- -$(MAKEINFO)
--
--#wget.cat: $(MAN)
--# nroff -man $(srcdir)/$(MAN) > wget.cat
--
--dvi: wget.dvi
--
--wget.dvi: wget.texi
-- $(TEXI2DVI) $(srcdir)/wget.texi
--
--wget_us.ps: wget.dvi
-- $(DVIPS) -t letter -o $@ wget.dvi
--
--wget_a4.ps: wget.dvi
-- $(DVIPS) -t a4 -o $@ wget.dvi
--
--wget_toc.html: wget.texi
-- $(TEXI2HTML) $(srcdir)/wget.texi
--
--#
--# Dependencies for installing
--#
--
--# install all the documentation
--install: install.info install.wgetrc # install.man
--
--# uninstall all the documentation
--uninstall: uninstall.info # uninstall.man
--
--# install info pages, creating install directory if necessary
--install.info: wget.info
-- $(top_srcdir)/mkinstalldirs $(infodir)
-- -for file in $(srcdir)/wget.info $(srcdir)/wget.info-*[0-9]; do \
-- test -f "$$file" && $(INSTALL_DATA) $$file $(infodir) ; \
-- done
--
--# install man page, creating install directory if necessary
--#install.man:
--# $(top_srcdir)/mkinstalldirs $(mandir)/man$(manext)
--# $(INSTALL_DATA) $(srcdir)/$(MAN) $(mandir)/man$(manext)/$(MAN)
--
--# install sample.wgetrc
--install.wgetrc:
-- $(top_srcdir)/mkinstalldirs $(sysconfdir)
-- @if test -f $(WGETRC); then \
-- if cmp -s $(srcdir)/sample.wgetrc $(WGETRC); then echo ""; \
-- else \
-- echo ' $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(WGETRC).new'; \
-- $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(WGETRC).new; \
-- echo "WARNING: File \`$(WGETRC)' already exists and is spared."; \
-- echo " You might want to consider \`$(WGETRC).new',"; \
-- echo " and merge both into \`$(WGETRC)', for the best."; \
-- fi; \
-- else \
-- $(INSTALL_DATA) $(srcdir)/sample.wgetrc $(WGETRC); \
-- fi
--
--# uninstall info pages
--uninstall.info:
-- $(RM) $(infodir)/wget.info*
--
--# uninstall man page
--#uninstall.man:
--# $(RM) $(mandir)/man$(manext)/$(MAN)
--
--#
--# Dependencies for cleanup
--#
--
--clean:
-- $(RM) *~ *.bak *.cat *.html
-- $(RM) *.dvi *.aux *.cp *.cps *.fn *.toc *.tp *.vr *.ps *.ky *.pg *.log
--
--distclean: clean
-- $(RM) Makefile
--
--realclean: distclean
-- $(RM) wget.info*
--
--#
--# Dependencies for maintenance
--#
--
--subdir = doc
--
--Makefile: Makefile.in ../config.status
-- cd .. && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= ./config.status
-diff -urN wget-1.5.3.orig/src/connect.c wget-1.5.3/src/connect.c
---- wget-1.5.3.orig/src/connect.c Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/connect.c Sat May 22 13:31:40 1999
-@@ -62,6 +62,59 @@
- uerr_t
- make_connection (int *sock, char *hostname, unsigned short port)
- {
+ /* Add host name HOST with the address ADDR_TEXT to the cache.
+ ADDR_LIST is a NULL-terminated list of addresses, as in struct
+@@ -220,10 +282,23 @@
+ #ifdef DEBUG
+ if (opt.debug)
+ {
+#ifdef INET6
-+ struct sockaddr_storage sock_name;
-+ struct sockaddr_in *sin;
-+ struct sockaddr_in6 *sin6;
-+ size_t socksize;
-+
-+ /*
-+ * Get internet address of the host. We can do it either by calling
-+ * ngethostbyname, or by calling store_hostaddress, from host.c.
-+ * storehostaddress is better since it caches calls to
-+ * gethostbyname.
-+ */
-+ if (!store_hostaddress (&sock_name, hostname))
-+ return HOSTERR;
-+
-+ /* Set port and protocol */
-+ switch (sock_name.__ss_family) {
-+ case AF_INET:
-+ sin = (struct sockaddr_in *) &sock_name;
-+ sin->sin_family = AF_INET;
-+#ifdef HAVE_SOCKADDR_SA_LEN
-+ sin->sin_len = sizeof (struct sockaddr_in);
++ struct addrinfo *ai;
++#else
+ int i;
+#endif
-+ sin->sin_port = htons (port);
-+ socksize = sizeof (struct sockaddr_in);
-+ break;
-+ case AF_INET6:
-+ sin6 = (struct sockaddr_in6 *) &sock_name;
-+ sin6->sin6_family = AF_INET6;
-+#ifdef HAVE_SOCKADDR_SA_LEN
-+ sin6->sin6_len = sizeof (struct sockaddr_in6);
+ debug_logprintf ("Caching %s =>", host);
++#ifdef INET6
++ for (ai = al->addresses; ai; ai = ai->ai_next)
++ {
++ char hbuf[INET6_ADDRSTRLEN];
++ pretty_print_address_sa (ai->ai_addr, ai->ai_addrlen, hbuf);
++ debug_logprintf (" %s", hbuf);
++ }
++#else
+ for (i = 0; i < al->count; i++)
+ debug_logprintf (" %s", pretty_print_address (al->addresses + i));
+#endif
-+ sin6->sin6_port = htons (port);
-+ socksize = sizeof (struct sockaddr_in6);
-+ break;
-+ default:
-+ return HOSTERR;
-+ }
-+ /* Make an internet socket, stream type. */
-+ if ((*sock = socket (sock_name.__ss_family, SOCK_STREAM, 0)) == -1)
-+ return CONSOCKERR;
-+
-+ /* Connect the socket to the remote host. */
-+ if (connect (*sock, (struct sockaddr *) &sock_name, socksize))
-+ {
-+ if (errno == ECONNREFUSED)
-+ return CONREFUSED;
-+ else
-+ return CONERROR;
-+ }
-+ DEBUGP (("Created fd %d.\n", *sock));
-+ return NOCONERROR;
-+#else /* !INET6 */
- struct sockaddr_in sock_name;
- /* struct hostent *hptr; */
-
-@@ -97,6 +150,7 @@
+ debug_logprintf ("\n");
}
- DEBUGP (("Created fd %d.\n", *sock));
- return NOCONERROR;
-+#endif /* INET6 */
- }
-
- /* Bind the local port PORT. This does all the necessary work, which
-diff -urN wget-1.5.3.orig/src/host.c wget-1.5.3/src/host.c
---- wget-1.5.3.orig/src/host.c Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/host.c Sat May 22 13:31:50 1999
-@@ -75,12 +75,58 @@
- static struct host *add_hlist PARAMS ((struct host *, const char *,
- const char *, int));
-
+ #endif
+@@ -233,6 +308,24 @@
+ lookup_host (const char *host, int silent)
+ {
+ struct address_list *al = NULL;
+#ifdef INET6
-+/*
-+ * The same as gethostbyname2, but supports internet addresses of the
-+ * form `N.N.N.N' and 'X:X:X:X:X:X:X:X'.
-+ *
-+ * Return the pointer of struct hostent on successful finding of the
-+ * hostname, NULL pointer otherwise.
-+ */
-+struct hostent *
-+ngethostbyname2 (const char *name, int af)
-+{
-+ struct hostent *hp = (struct hostent *) NULL;
-+ char *addr;
-+ size_t socksize;
-+
-+ /* Support only 2 types address family */
-+ if (af != AF_INET6 && af != AF_INET)
-+ return (struct hostent *) NULL;
-+
-+ hp = gethostbyname2(name, af);
-+ if (!hp) {
-+ if (inet_pton(af, name, addr) != -1) {
-+ switch (af) {
-+ case AF_INET:
-+ socksize = sizeof (struct sockaddr_in);
-+ break;
-+ case AF_INET6:
-+ socksize = sizeof (struct sockaddr_in6);
-+ break;
-+ }
-+ hp = gethostbyaddr(addr, socksize, af);
-+ }
-+ }
-+ return hp;
-+}
-+#endif /* INET6 */
++ struct addrinfo hints, *res;
++ int error;
+
- /* The same as gethostbyname, but supports internet addresses of the
- form `N.N.N.N'. */
- struct hostent *
- ngethostbyname (const char *name)
- {
- struct hostent *hp;
-+#ifdef INET6
-+ const int af[] = { AF_INET, AF_INET6 };
-+ int i;
++ memset(&hints, 0, sizeof(hints));
++ if (opt.inet)
++ hints.ai_family = AF_INET;
++ else if (opt.inet6)
++ hints.ai_family = AF_INET6;
++ else
++ hints.ai_family = AF_UNSPEC;
++ hints.ai_socktype = SOCK_STREAM;
++ hints.ai_flags = AI_NUMERICHOST;
++ /* check `N.N.N.N' or 'X:X:X:X:X:X:X:X'. */
++ if (!getaddrinfo(host, NULL, &hints, &res))
++ return address_list_new (res);
+
-+ for (i = 0; i < 2; i++)
-+ if ((hp = ngethostbyname2(name, af[i])) != NULL)
-+ return hp;
-+ return (struct hostent *) NULL;
+#else
unsigned long addr;
+ struct hostent *hptr;
- addr = (unsigned long)inet_addr (name);
-@@ -89,6 +135,7 @@
- else
- hp = gethostbyname (name);
- return hp;
-+#endif
- }
+@@ -254,6 +347,7 @@
+ #endif
+ return address_list_new_one ((char *)&addr + offset);
+ }
++#endif /* INET6 */
- /* Search for HOST in the linked list L, by hostname. Return the
-@@ -117,11 +164,159 @@
- return NULL;
- }
+ /* By now we know that the host name we got is not of the form
+ d.d.d.d. Try to find it in our cache of host names. */
+@@ -270,12 +364,29 @@
+ if (!silent)
+ logprintf (LOG_VERBOSE, _("Resolving %s... "), host);
--/* Store the address of HOSTNAME, internet-style, to WHERE. First
-- check for it in the host list, and (if not found), use
-- ngethostbyname to get it.
+#ifdef INET6
-+int
-+convert_hostaddress(int af, const char *hostname, void *address)
-+{
-+ struct host *t;
-+ int valid;
-+
-+ valid = inet_pton(af, hostname, address);
-+ if (valid == -1 || valid == 0) {
-+ /* If it is not of that form, try to find it in the cache. */
-+ t = search_host (hlist, hostname);
-+ if (t)
-+ valid = inet_pton(af, t->realname, address);
-+ if (valid != -1 && valid != 0)
-+ return 1;
-+ } else
-+ return 1;
-+ return 0;
-+}
-+
-+/*
-+ * Store the address of HOSTNAME, internet-style, to WHERE. First
-+ * check for it in the host list, and (if not found), use
-+ * ngethostbyname to get it.
-+ *
-+ * Return 1 on successful finding of the hostname, 0 otherwise.
-+ */
-+int
-+store_hostaddress (struct sockaddr_storage *where, const char *hostname)
-+{
-+ struct host *t;
-+ struct addrinfo hints, *res;
-+ union {
-+ struct in_addr in;
-+ struct in6_addr in6;
-+ } addr_un;
-+ struct sockaddr_in *sin;
-+ struct sockaddr_in6 *sin6;
-+ char *addr_s;
-+ char addr_st[INET6_ADDRSTRLEN];
-+ int af, valid ,i, err;
-+ int family;
-+ const int afs[] = { AF_INET6, AF_INET };
-+#define MAX_AF 2
-
-- Return 1 on successful finding of the hostname, 0 otherwise. */
++ memset(&hints, 0, sizeof(hints));
+ if (opt.inet)
-+ family = AF_INET;
++ hints.ai_family = AF_INET;
+ else if (opt.inet6)
-+ family = AF_INET6;
++ hints.ai_family = AF_INET6;
+ else
-+ family = 0;
-+ /*
-+ * If the address is of the form d.d.d.d, there will be no trouble
-+ * with it.
-+ */
-+ if (!family) {
-+ for (i = 0; i < MAX_AF; i++) {
-+ valid = convert_hostaddress(afs[i], hostname, &addr_un);
-+ af = afs[i];
-+ }
-+ } else {
-+ valid = convert_hostaddress(family, hostname, &addr_un);
-+ af = family;
-+ }
-+ /* If we have the numeric address, just store it. */
-+ if (valid) {
-+ /* This works on both little and big endian architecture, as
-+ * inet_addr returns the address in the proper order. It
-+ * appears to work on 64-bit machines too.
-+ */
-+ switch (af) {
-+ case AF_INET:
-+ sin = (struct sockaddr_in *) where;
-+ memcpy(&sin->sin_addr, &addr_un.in, sizeof(struct in_addr));
-+ sin->sin_family = AF_INET;
-+ return 1;
-+ case AF_INET6:
-+ sin6 = (struct sockaddr_in6 *) where;
-+ memcpy(&sin6->sin6_addr, &addr_un.in6, sizeof(struct in6_addr));
-+ sin6->sin6_family = AF_INET6;
-+ return 1;
-+ default:
-+ return 0;
-+ }
-+ }
-+ /*
-+ * Since all else has failed, let's try gethostbyname2(). Note that
-+ * we use gethostbyname2() rather than ngethostbyname2(), because we
-+ * *know* the address is not numerical.
-+ */
-+ bzero(&hints, sizeof(hints));
++ hints.ai_family = AF_UNSPEC;
+ hints.ai_socktype = SOCK_STREAM;
-+ hints.ai_protocol = 0;
-+ if (!family) {
-+ hints.ai_family = AF_UNSPEC;
-+ } else {
-+ hints.ai_family = family;
-+ }
-+ err = getaddrinfo(hostname, NULL, &hints, &res);
-+ if (err) {
-+ fprintf(stderr, "%s: %s\n", hostname, gai_strerror(err));
-+ return 0;
-+ }
-+ /*
-+ * Copy the address of the host to socket description.
-+ */
-+ switch (res->ai_family) {
-+ case AF_INET:
-+ sin = (struct sockaddr_in *) where;
-+ memcpy(&sin->sin_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (struct in_addr));
-+ sin->sin_family = AF_INET;
-+ memcpy (&addr_un.in.s_addr, &((struct sockaddr_in *)res->ai_addr)->sin_addr, sizeof (addr_un.in));
-+ inet_ntop(AF_INET, &addr_un.in, addr_st, sizeof (struct in_addr));
-+ STRDUP_ALLOCA (addr_s, addr_st);
-+ freeaddrinfo(res);
-+ break;
-+ case AF_INET6:
-+ sin6 = (struct sockaddr_in6 *) where;
-+ memcpy(&sin6->sin6_addr, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (struct in6_addr));
-+ sin6->sin6_family = AF_INET6;
-+ memcpy (&addr_un.in6, &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr, sizeof (addr_un.in6));
-+ inet_ntop(AF_INET6, &addr_un.in6, addr_st, sizeof (struct in6_addr));
-+ STRDUP_ALLOCA (addr_s, addr_st);
-+ freeaddrinfo(res);
-+ break;
-+ default:
-+ freeaddrinfo(res);
-+ return 0;
-+ }
-+ /*
-+ * Now that we're here, we could as well cache the hostname for
-+ * future use, as in realhost(). First, we have to look for it by
-+ * address to know if it's already in the cache by another name.
-+ */
-+ /*
-+ * Originally, we copied to in.s_addr, but it appears to be missing
-+ * on some systems.
-+ */
-+ t = search_address (hlist, addr_s);
-+ if (t) /* Found in the list, as realname. */
-+ {
-+ /* Set the default, 0 quality. */
-+ hlist = add_hlist (hlist, hostname, addr_s, 0);
-+ return 1;
-+ }
-+ /* Since this is really the first time this host is encountered,
-+ * set quality to 1.
-+ */
-+ hlist = add_hlist (hlist, hostname, addr_s, 1);
-+ return 1;
-+}
-+#undef MAX_AF
-+#else /* INET6 */
- int
- store_hostaddress (unsigned char *where, const char *hostname)
- {
-@@ -131,8 +326,10 @@
- struct in_addr in;
- char *inet_s;
-
-- /* If the address is of the form d.d.d.d, there will be no trouble
-- with it. */
-+ /*
-+ * If the address is of the form d.d.d.d, there will be no trouble
-+ * with it.
-+ */
- addr = (unsigned long)inet_addr (hostname);
- if ((int)addr == -1)
++ error = getaddrinfo(host, NULL, &hints, &res);
++ if (error)
++#else
+ /* Look up the host using gethostbyname(). */
+ hptr = gethostbyname (host);
+ if (!hptr)
++#endif
{
-@@ -178,6 +375,7 @@
- hlist = add_hlist (hlist, hostname, inet_s, 1);
- return 1;
- }
-+#endif /* INET6 */
+ if (!silent)
++#ifdef INET6
++ logprintf (LOG_VERBOSE, _("failed: %s.\n"), gai_strerror(error));
++#else
+ logprintf (LOG_VERBOSE, _("failed: %s.\n"), herrmsg (h_errno));
++#endif
+ return NULL;
+ }
- /* Add a host to the host list. The list is sorted by addresses. For
- equal addresses, the entries with quality should bubble towards the
-diff -urN wget-1.5.3.orig/src/host.h wget-1.5.3/src/host.h
---- wget-1.5.3.orig/src/host.h Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/host.h Sat May 22 13:31:53 1999
-@@ -25,8 +25,11 @@
- /* Function declarations */
+@@ -284,7 +395,11 @@
- struct hostent *ngethostbyname PARAMS ((const char *));
+ /* Do all systems have h_addr_list, or is it a newer thing? If the
+ latter, use address_list_new_one. */
+#ifdef INET6
-+int store_hostaddress PARAMS ((struct sockaddr_storage *, const char *));
++ al = address_list_new (res);
+#else
- int store_hostaddress PARAMS ((unsigned char *, const char *));
--
+ al = address_list_new (hptr->h_addr_list);
++#endif
+
+ /* Cache the lookup information. */
+ cache_host_lookup (host, al);
+diff -ur wget-1.8.1.orig/src/host.h wget-1.8.1/src/host.h
+--- wget-1.8.1.orig/src/host.h Tue Dec 11 17:32:58 2001
++++ wget-1.8.1/src/host.h Wed Feb 13 00:14:42 2002
+@@ -38,6 +38,9 @@
+ /* This was originally going to be a macro, but then every caller
+ would have to #include the netinet stuff. */
+ char *pretty_print_address PARAMS ((const void *));
++#ifdef INET6
++int pretty_print_address_sa PARAMS ((const void *, int, char *));
+#endif
- void clean_hosts PARAMS ((void));
- char *realhost PARAMS ((const char *));
-diff -urN wget-1.5.3.orig/src/init.c wget-1.5.3/src/init.c
---- wget-1.5.3.orig/src/init.c Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/init.c Sat May 22 13:31:56 1999
-@@ -113,6 +113,8 @@
- { "httpproxy", &opt.http_proxy, cmd_string },
- { "httpuser", &opt.http_user, cmd_string },
+ int accept_domain PARAMS ((struct url *));
+ int sufmatch PARAMS ((const char **, const char *));
+diff -ur wget-1.8.1.orig/src/http.c wget-1.8.1/src/http.c
+--- wget-1.8.1.orig/src/http.c Fri Dec 14 01:46:56 2001
++++ wget-1.8.1/src/http.c Sun Jan 27 08:19:10 2002
+@@ -559,6 +559,11 @@
+ /* Whether keep-alive should be inhibited. */
+ int inhibit_keep_alive;
+
++ /* Whether we need to print the host header with braces around host,
++ e.g. "Host: [3ffe:8100:200:2::2]:1234" instead of the usual
++ "Host: symbolic-name:1234". */
++ int squares_around_host = 0;
++
+ #ifdef HAVE_SSL
+ /* initialize ssl_ctx on first run */
+ if (!ssl_ctx)
+@@ -811,6 +816,9 @@
+ "param=value", full_path will be "/foo/bar?param=value". */
+ full_path = url_full_path (u);
+
++ if (strchr (u->host, ':'))
++ squares_around_host = 1;
++
+ /* Allocate the memory for the request. */
+ request = (char *)alloca (strlen (command)
+ + strlen (full_path)
+@@ -832,11 +840,12 @@
+ sprintf (request, "\
+ %s %s HTTP/1.0\r\n\
+ User-Agent: %s\r\n\
+-Host: %s%s\r\n\
++Host: %s%s%s%s\r\n\
+ Accept: %s\r\n\
+ %s%s%s%s%s%s%s%s\r\n",
+ command, full_path,
+- useragent, u->host,
++ useragent,
++ squares_around_host ? "[" : "", u->host, squares_around_host ? "]" : "",
+ port_maybe ? port_maybe : "",
+ HTTP_ACCEPT,
+ request_keep_alive ? request_keep_alive : "",
+diff -ur wget-1.8.1.orig/src/init.c wget-1.8.1/src/init.c
+--- wget-1.8.1.orig/src/init.c Fri Dec 14 04:19:03 2001
++++ wget-1.8.1/src/init.c Tue Feb 19 02:45:18 2002
+@@ -38,6 +38,7 @@
+ #else
+ # include <sys/socket.h>
+ # include <netinet/in.h>
++# include <netdb.h>
+ #ifndef __BEOS__
+ # include <arpa/inet.h>
+ #endif
+@@ -142,6 +143,10 @@
{ "ignorelength", &opt.ignore_length, cmd_boolean },
+ { "ignoretags", &opt.ignore_tags, cmd_vector },
+ { "includedirectories", &opt.includes, cmd_directory_vector },
++#ifdef INET6
+ { "inet", &opt.inet, cmd_boolean },
+ { "inet6", &opt.inet6, cmd_boolean },
- { "includedirectories", &opt.includes, cmd_directory_vector },
- { "input", &opt.input_filename, cmd_string },
++#endif
+ { "input", &opt.input_filename, cmd_file },
{ "killlonger", &opt.kill_longer, cmd_boolean },
-diff -urN wget-1.5.3.orig/src/main.c wget-1.5.3/src/main.c
---- wget-1.5.3.orig/src/main.c Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/main.c Sat May 22 13:32:00 1999
-@@ -157,6 +157,8 @@
- --http-passwd=PASS set http password to PASS.\n\
- -C, --cache=on/off (dis)allow server-cached data (normally allowed).\n\
- --ignore-length ignore `Content-Length\' header field.\n\
-+ --inet use IP version 4 socket.\n\
-+ --inet6 use IP version 6 socket.\n\
- --header=STRING insert STRING among the headers.\n\
- --proxy-user=USER set USER as proxy username.\n\
- --proxy-passwd=PASS set PASS as proxy password.\n\
-@@ -195,7 +197,7 @@
- main (int argc, char *const *argv)
+ { "limitrate", &opt.limit_rate, cmd_bytes },
+@@ -526,10 +531,18 @@
+ cmd_address (const char *com, const char *val, void *closure)
{
- char **url, **t;
-- int i, c, nurl, status, append_to_log;
-+ int i, c, nurl, status, append_to_log, af;
+ struct address_list *al;
++#ifdef INET6
++ struct addrinfo ai;
++ struct sockaddr_storage ss;
++ int slen;
++#else
+ struct sockaddr_in sin;
++#endif
+ struct sockaddr_in **target = (struct sockaddr_in **)closure;
- static struct option long_options[] =
- {
-@@ -211,6 +213,8 @@
- { "force-html", no_argument, NULL, 'F'},
++#ifndef INET6
+ memset (&sin, '\0', sizeof (sin));
++#endif
+
+ al = lookup_host (val, 1);
+ if (!al)
+@@ -538,16 +551,29 @@
+ exec_name, com, val);
+ return 0;
+ }
++#ifdef INET6
++ address_list_copy_one (al, 0, (unsigned char *)&ai);
++ slen = ai.ai_addrlen;
++ memcpy (&ss, ai.ai_addr, slen);
++#else
+ address_list_copy_one (al, 0, (unsigned char *)&sin.sin_addr);
++#endif
+ address_list_release (al);
+
++#ifndef INET6
+ sin.sin_family = AF_INET;
+ sin.sin_port = 0;
++#endif
+
+ FREE_MAYBE (*target);
+
++#ifdef INET6
++ *target = xmalloc (sizeof (ss));
++ memcpy (*target, &ss, slen);
++#else
+ *target = xmalloc (sizeof (sin));
+ memcpy (*target, &sin, sizeof (sin));
++#endif
+
+ return 1;
+ }
+diff -ur wget-1.8.1.orig/src/main.c wget-1.8.1/src/main.c
+--- wget-1.8.1.orig/src/main.c Mon Dec 10 14:31:44 2001
++++ wget-1.8.1/src/main.c Tue Feb 19 02:41:12 2002
+@@ -171,6 +171,12 @@
+ -Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
+ --limit-rate=RATE limit download rate to RATE.\n\
+ \n"), stdout);
++#ifdef INET6
++ fputs (_("\
++ --inet use IP version 4 socket.\n\
++ --inet6 use IP version 6 socket.\n\
++\n"), stdout);
++#endif /* INET6 */
+ fputs (_("\
+ Directories:\n\
+ -nd --no-directories don\'t create directories.\n\
+@@ -256,6 +262,10 @@
{ "help", no_argument, NULL, 'h' },
- { "ignore-length", no_argument, NULL, 10 },
+ { "html-extension", no_argument, NULL, 'E' },
+ { "ignore-length", no_argument, NULL, 138 },
++#ifdef INET6
+ { "inet", no_argument, NULL, '4' },
+ { "inet6", no_argument, NULL, '6' },
++#endif
{ "mirror", no_argument, NULL, 'm' },
- { "no-clobber", no_argument, NULL, 13 },
- { "no-directories", no_argument, NULL, 19 },
-@@ -334,6 +338,12 @@
- case 22:
- setval ("simplehostcheck", "on");
+ { "no-clobber", no_argument, NULL, 141 },
+ { "no-directories", no_argument, NULL, 147 },
+@@ -407,6 +417,16 @@
+ case 165:
+ setval ("randomwait", "on");
break;
++#ifdef INET6
+ case '4':
+ setval ("inet", "on");
++ setval ("inet6", "off");
+ break;
+ case '6':
+ setval ("inet6", "on");
++ setval ("inet", "off");
+ break;
++#endif
case 'b':
setval ("background", "on");
break;
-@@ -572,6 +582,13 @@
+@@ -703,6 +723,14 @@
print_usage ();
exit (1);
}
-+
-+ if (opt.inet && opt.inet6) {
-+ printf (_("Can't inet and inet6 be specified at the same time.\n"));
++#ifdef INET6
++ if (opt.inet && opt.inet6)
++ {
++ printf (_("Can't inet and inet6 be specified at the same time.\n"));
+ print_usage ();
+ exit (1);
-+ }
-+
++ }
++#endif
if (opt.timestamping && opt.noclobber)
{
printf (_("\
-diff -urN wget-1.5.3.orig/src/options.h wget-1.5.3/src/options.h
---- wget-1.5.3.orig/src/options.h Sat May 22 13:25:03 1999
-+++ wget-1.5.3/src/options.h Sat May 22 13:32:17 1999
-@@ -30,6 +30,8 @@
- data than specified in
- content-length? */
- int ignore_length; /* Do we heed content-length at all? */
+diff -ur wget-1.8.1.orig/src/options.h wget-1.8.1/src/options.h
+--- wget-1.8.1.orig/src/options.h Fri Nov 30 16:39:08 2001
++++ wget-1.8.1/src/options.h Tue Feb 19 02:49:40 2002
+@@ -153,7 +153,14 @@
+ int page_requisites; /* Whether we need to download all files
+ necessary to display a page properly. */
+
++#ifdef INET6
+ int inet;
+ int inet6;
- int recursive; /* Are we recursive? */
- int spanhost; /* Do we span across hosts in
- recursion? */
++ int conn_inet6; /* connect IPv6? */
++ struct sockaddr_storage *bind_address;
++#else
+ struct sockaddr_in *bind_address; /* What local IP address to bind to. */
++#endif
+
+ #ifdef HAVE_SSL
+ char *sslcertfile; /* external client cert to use. */
+diff -ur wget-1.8.1.orig/src/url.c wget-1.8.1/src/url.c
+--- wget-1.8.1.orig/src/url.c Sat Dec 15 00:45:59 2001
++++ wget-1.8.1/src/url.c Sun Jan 27 05:43:17 2002
+@@ -111,7 +111,7 @@
+ RU, 0, 0, 0, 0, 0, 0, 0, /* @ A B C D E F G */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* H I J K L M N O */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* P Q R S T U V W */
+- 0, 0, 0, U, U, U, U, 0, /* X Y Z [ \ ] ^ _ */
++ 0, 0, 0, RU, U, RU, U, 0, /* X Y Z [ \ ] ^ _ */
+ U, 0, 0, 0, 0, 0, 0, 0, /* ` a b c d e f g */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* h i j k l m n o */
+ 0, 0, 0, 0, 0, 0, 0, 0, /* p q r s t u v w */
+@@ -528,6 +528,11 @@
+ memcpy (*user, str, len);
+ (*user)[len] = '\0';
+
++ if (*user)
++ decode_string (*user);
++ if (*passwd)
++ decode_string (*passwd);
++
+ return 1;
+ }
+
+@@ -617,16 +622,20 @@
+ }
+
+ static char *parse_errors[] = {
+-#define PE_NO_ERROR 0
++#define PE_NO_ERROR 0
+ "No error",
+-#define PE_UNSUPPORTED_SCHEME 1
++#define PE_UNSUPPORTED_SCHEME 1
+ "Unsupported scheme",
+-#define PE_EMPTY_HOST 2
++#define PE_EMPTY_HOST 2
+ "Empty host",
+-#define PE_BAD_PORT_NUMBER 3
++#define PE_BAD_PORT_NUMBER 3
+ "Bad port number",
+-#define PE_INVALID_USER_NAME 4
+- "Invalid user name"
++#define PE_INVALID_USER_NAME 4
++ "Invalid user name",
++#define PE_UNTERMINATED_IPV6_ADDRESS 5
++ "Unterminated IPv6 numeric address",
++#define PE_INVALID_IPV6_ADDRESS 6
++ "Invalid char in IPv6 numeric address"
+ };
+
+ #define SETERR(p, v) do { \
+@@ -688,8 +697,45 @@
+ fragment_b = fragment_e = NULL;
+
+ host_b = p;
+- p = strpbrk_or_eos (p, ":/;?#");
+- host_e = p;
++
++ if (*p == '[')
++ {
++ /* Support http://[::1]/ used by IPv6. */
++ int invalid = 0;
++ ++p;
++ while (1)
++ {
++ char c = *p++;
++ switch (c)
++ {
++ case ']':
++ goto out;
++ case '\0':
++ SETERR (error, PE_UNTERMINATED_IPV6_ADDRESS);
++ return NULL;
++ case ':': case '.':
++ break;
++ default:
++ if (ISXDIGIT (c))
++ break;
++ invalid = 1;
++ }
++ }
++ out:
++ if (invalid)
++ {
++ SETERR (error, PE_INVALID_IPV6_ADDRESS);
++ return NULL;
++ }
++ /* Don't include brackets in [host_b, host_p). */
++ ++host_b;
++ host_e = p - 1;
++ }
++ else
++ {
++ p = strpbrk_or_eos (p, ":/;?#");
++ host_e = p;
++ }
+
+ if (host_b == host_e)
+ {
+@@ -1575,6 +1621,37 @@
+ memcpy (constr + baselength, link, linklength);
+ constr[baselength + linklength] = '\0';
+ }
++ else if (linklength > 1 && *link == '/' && *(link + 1) == '/')
++ {
++ /* LINK begins with "//" and so is a net path: we need to
++ replace everything after (and including) the double slash
++ with LINK. */
++
++ /* uri_merge("foo", "//new/bar") -> "//new/bar" */
++ /* uri_merge("//old/foo", "//new/bar") -> "//new/bar" */
++ /* uri_merge("http://old/foo", "//new/bar") -> "http://new/bar" */
++
++ int span;
++ const char *slash;
++ const char *start_insert;
++
++ /* Look for first slash. */
++ slash = memchr (base, '/', end - base);
++ /* If found slash and it is a double slash, then replace
++ from this point, else default to replacing from the
++ beginning. */
++ if (slash && *(slash + 1) == '/')
++ start_insert = slash;
++ else
++ start_insert = base;
++
++ span = start_insert - base;
++ constr = (char *)xmalloc (span + linklength + 1);
++ if (span)
++ memcpy (constr, base, span);
++ memcpy (constr + span, link, linklength);
++ constr[span + linklength] = '\0';
++ }
+ else if (*link == '/')
+ {
+ /* LINK is an absolute path: we need to replace everything
+@@ -1734,6 +1811,8 @@
+ char *scheme_str = supported_schemes[url->scheme].leading_string;
+ int fplen = full_path_length (url);
+
++ int brackets_around_host = 0;
++
+ assert (scheme_str != NULL);
+
+ /* Make sure the user name and password are quoted. */
+@@ -1749,8 +1828,12 @@
+ }
+ }
+
++ if (strchr (url->host, ':'))
++ brackets_around_host = 1;
++
+ size = (strlen (scheme_str)
+ + strlen (url->host)
++ + (brackets_around_host ? 2 : 0)
+ + fplen
+ + 1);
+ if (url->port != scheme_port)
+@@ -1776,7 +1859,11 @@
+ *p++ = '@';
+ }
+
++ if (brackets_around_host)
++ *p++ = '[';
+ APPEND (p, url->host);
++ if (brackets_around_host)
++ *p++ = ']';
+ if (url->port != scheme_port)
+ {
+ *p++ = ':';
+--- wget-1.8.2/configure.in.orig Wed Jun 5 20:57:48 2002
++++ wget-1.8.2/configure.in Wed Jun 5 21:02:38 2002
+@@ -74,6 +74,11 @@
+ DEBUG=$enableval, DEBUG=yes)
+ test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG,,[Support for debugging output])
+
++AC_ARG_ENABLE(ipv6,
++[ --enable-ipv6 enable IPv6 support],
++INET6=$enableval, INET6=yes)
++test x"${INET6}" = xyes && AC_DEFINE(INET6,,[IPv6 support])
++
+ wget_need_md5=no
+
+ case "${USE_OPIE}${USE_DIGEST}" in
+--- wget-1.8.2/po/pl.po.orig Sun May 19 05:18:59 2002
++++ wget-1.8.2/po/pl.po Wed Jun 5 21:07:23 2002
+@@ -1227,3 +1227,29 @@
+ #, c-format
+ msgid "Failed to unlink symlink `%s': %s\n"
+ msgstr "Nie uda³o siê usun±æ dowi±zania symbolicznego `%s': %s\n"
++
++#: src/ftp.c:529
++msgid "Cannot initiate EPSV transfer.\n"
++msgstr "Nie mo¿na rozpocz±æ transferu EPSV.\n"
++
++#: src/ftp.c:533
++msgid "Cannot parse EPSV response.\n"
++msgstr "Nie powiod³a siê analiza odpowiedzi EPSV.\n"
++
++#: src/ftp.c:666
++msgid "Invalid EPRT.\n"
++msgstr "B³êdny EPRT.\n"
++
++#: src/main.c:185
++msgid ""
++" --inet use IP version 4 socket.\n"
++" --inet6 use IP version 6 socket.\n"
++"\n"
++msgstr ""
++" --inet u¿ywa gniazd IP w wersji 4.\n"
++" --inet6 u¿ywa gniazd IP w wersji 6.\n"
++"\n"
++
++#: src/main.c:739
++msgid "Can't inet and inet6 be specified at the same time.\n"
++msgstr "Opcje inet i inet6 nie mog± byæ podane jednocze¶nie.\n"