1 diff -ur wget-1.8.1.orig/src/connect.c wget-1.8.1/src/connect.c
2 --- wget-1.8.1.orig/src/connect.c Tue Nov 27 23:55:40 2001
3 +++ wget-1.8.1/src/connect.c Tue Feb 19 03:02:05 2002
6 connect_to_one (const unsigned char *addr, unsigned short port, int silent)
9 + struct addrinfo hints, *res;
10 + struct sockaddr_storage sock_name;
11 + char portstr[NI_MAXSERV];
14 struct sockaddr_in sock_name;
15 - int sock, save_errno;
17 + int sock, save_errno, salen;
19 /* Set port and protocol */
21 + memset(&hints, 0, sizeof(hints));
22 + hints.ai_family = PF_UNSPEC;
23 + hints.ai_socktype = SOCK_STREAM;
24 + hints.ai_flags = AI_NUMERICHOST;
25 + snprintf(portstr, sizeof(portstr), "%d", port);
26 + err = getaddrinfo(addr, portstr, &hints, &res);
30 + logprintf (LOG_VERBOSE, "getaddrinfo: %s.\n", gai_strerror (err));
33 + memset (&sock_name, 0, sizeof (sock_name));
34 + memcpy (&sock_name, res->ai_addr, res->ai_addrlen);
35 + salen = res->ai_addrlen;
38 sock_name.sin_family = AF_INET;
39 sock_name.sin_port = htons (port);
40 memcpy ((unsigned char *)&sock_name.sin_addr, addr, 4);
41 + salen = sizeof (sock_name);
47 + char pretty_addr[INET6_ADDRSTRLEN];
48 + pretty_print_address_sa (&sock_name, salen, pretty_addr);
50 char *pretty_addr = pretty_print_address (addr);
52 if (connection_host_name
53 && 0 != strcmp (connection_host_name, pretty_addr))
54 logprintf (LOG_VERBOSE, _("Connecting to %s[%s]:%hu... "),
58 /* Make an internet socket, stream type. */
59 - sock = socket (AF_INET, SOCK_STREAM, 0);
60 + sock = socket (((struct sockaddr *)&sock_name)->sa_family, SOCK_STREAM, 0);
66 /* Bind the client side to the requested address. */
67 - if (bind (sock, (struct sockaddr *)opt.bind_address,
68 - sizeof (*opt.bind_address)))
69 + if (bind (sock, (struct sockaddr *)opt.bind_address, salen))
80 /* Connect the socket to the remote host. */
81 - if (connect (sock, (struct sockaddr *)&sock_name, sizeof (sock_name)) < 0)
82 + if (connect (sock, (struct sockaddr *)&sock_name, salen) < 0)
93 logprintf (LOG_VERBOSE, _("connected.\n"));
94 DEBUGP (("Created socket %d.\n", sock));
96 + opt.conn_inet6 = ((struct sockaddr *)&sock_name)->sa_family == AF_INET6 ?
102 @@ -151,10 +190,28 @@
103 address_list_get_bounds (al, &start, &end);
104 for (i = start; i < end; i++)
107 + struct addrinfo ai;
108 + unsigned char *addr = (unsigned char *)&ai;
109 + char hbuf[INET6_ADDRSTRLEN];
112 unsigned char addr[4];
115 address_list_copy_one (al, i, addr);
118 + err = getnameinfo(ai.ai_addr, ai.ai_addrlen, hbuf, sizeof (hbuf),
119 + NULL, 0, NI_NUMERICHOST);
123 + logprintf (LOG_VERBOSE, "getnameinfo: %s.\n", gai_strerror (err));
126 + addr = (unsigned char *)hbuf;
128 sock = connect_to_one (addr, port, silent);
131 @@ -207,14 +264,27 @@
132 internal variable MPORT is set to the value of the ensuing master
133 socket. Call acceptport() to block for and accept a connection. */
135 -bindport (unsigned short *port)
136 +bindport_af (unsigned short *port, int af)
140 + static struct sockaddr_storage srv;
142 static struct sockaddr_in srv;
147 addr = (struct sockaddr *) &srv;
148 - if ((msock = socket (AF_INET, SOCK_STREAM, 0)) < 0)
150 + alen = sizeof (struct sockaddr_in);
152 + else if (af == AF_INET6)
153 + alen = sizeof (struct sockaddr_in6);
157 + if ((msock = socket (af, SOCK_STREAM, 0)) < 0)
159 if (setsockopt (msock, SOL_SOCKET, SO_REUSEADDR,
160 (char *)&optval, sizeof (optval)) < 0)
161 @@ -222,14 +292,18 @@
163 if (opt.bind_address == NULL)
165 - srv.sin_family = AF_INET;
166 + memset (&srv, 0, sizeof (srv));
167 + ((struct sockaddr *)&srv)->sa_family = af;
168 + /* in6addr_any : all 0 */
170 srv.sin_addr.s_addr = htonl (INADDR_ANY);
174 srv = *opt.bind_address;
176 - srv.sin_port = htons (*port);
177 - if (bind (msock, addr, sizeof (struct sockaddr_in)) < 0)
178 + ((struct sockaddr_in *)&srv)->sin_port = htons (*port); /* same sin6 */
179 + if (bind (msock, addr, alen) < 0)
183 @@ -241,14 +315,14 @@
184 /* #### addrlen should be a 32-bit type, which int is not
185 guaranteed to be. Oh, and don't try to make it a size_t,
186 because that can be 64-bit. */
187 - int addrlen = sizeof (struct sockaddr_in);
188 + int addrlen = sizeof (srv);
189 if (getsockname (msock, addr, &addrlen) < 0)
195 - *port = ntohs (srv.sin_port);
196 + *port = ntohs (((struct sockaddr_in *)addr)->sin_port); /* same sin6 */
198 if (listen (msock, 1) < 0)
207 +bindport (unsigned short *port)
209 + return bindport_af (port, AF_INET);
213 diff -ur wget-1.8.1.orig/src/connect.h wget-1.8.1/src/connect.h
214 --- wget-1.8.1.orig/src/connect.h Fri Nov 30 03:22:18 2001
215 +++ wget-1.8.1/src/connect.h Mon Feb 11 23:53:31 2002
218 int test_socket_open PARAMS ((int));
219 int select_fd PARAMS ((int, int, int));
220 +uerr_t bindport_af PARAMS ((unsigned short *, int));
221 uerr_t bindport PARAMS ((unsigned short *));
222 uerr_t acceptport PARAMS ((int *));
223 void closeport PARAMS ((int));
224 diff -ur wget-1.8.1.orig/src/ftp-basic.c wget-1.8.1/src/ftp-basic.c
225 --- wget-1.8.1.orig/src/ftp-basic.c Mon Dec 10 11:29:11 2001
226 +++ wget-1.8.1/src/ftp-basic.c Tue Feb 19 00:29:13 2002
230 # include <winsock.h>
232 +#include <sys/socket.h>
233 +#include <netinet/in.h>
240 @@ -340,6 +345,137 @@
246 +/* Bind a port and send the appropriate EPRT command to the FTP
247 + server. Use acceptport after RETR, to get the socket of data
250 +ftp_eprt (struct rbuf *rbuf)
253 + char *request, *respline, *bytes;
255 + unsigned short port;
256 + struct sockaddr_storage ss;
258 + char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV];
261 + /* Get the address of this side of the connection. */
262 + sslen = sizeof(ss);
263 + if (getsockname(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
265 + /* Construct the argument of EPRT. */
266 + if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, sizeof(hbuf),
267 + NULL, 0, NI_NUMERICHOST) != 0)
269 + /* Setting port to 0 lets the system choose a free port. */
271 + /* Bind the port. */
272 + err = bindport_af (&port, ((struct sockaddr *)&ss)->sa_family);
275 + sprintf(pbuf, "%u", port);
276 + af = ((struct sockaddr *)&ss)->sa_family == AF_INET6 ? 2 : 1;
277 + bytes = (char *)alloca (1 + strlen(hbuf) + strlen(pbuf) + 4 + 1);
278 + sprintf (bytes, "|%d|%s|%s|", af, hbuf, pbuf);
279 + /* Send EPRT request. */
280 + request = ftp_request ("EPRT", bytes);
281 + nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
285 + return WRITEFAILED;
288 + /* Get appropriate response. */
289 + err = ftp_response (rbuf, &respline);
295 + if (*respline != '2')
304 +/* Similar to ftp_eprt, but uses `EPSV' to initiate the passive FTP
305 + transfer. Reads the response from server and parses it. Reads the
306 + host and port addresses and returns them. */
308 +ftp_epsv (struct rbuf *rbuf, char *hbuf, unsigned short *pport)
310 + char *request, *respline, *s, *ep, delim;
314 + struct sockaddr_storage ss;
315 + int sslen = sizeof(ss);
317 + if (getpeername(RBUF_FD (rbuf), (struct sockaddr *)&ss, &sslen) < 0)
319 + if (getnameinfo((struct sockaddr *)&ss, sslen, hbuf, INET6_ADDRSTRLEN,
320 + NULL, 0, NI_NUMERICHOST) != 0)
323 + /* Form the request. */
324 + request = ftp_request ("EPSV", NULL);
326 + nwritten = iwrite (RBUF_FD (rbuf), request, strlen (request));
330 + return WRITEFAILED;
333 + /* Get the server response. */
334 + err = ftp_response (rbuf, &respline);
337 + if (strncmp(respline, "229", 3) != 0)
342 + /* Parse the request. */
344 + for (s += 4; *s && *s != '('; s++);
351 + if (s[0] && s[0] == s[1] && s[0] == s[2])
361 + rcv = strtol (s, &ep, 10);
362 + if (rcv <= 0 || rcv > USHRT_MAX || *ep != delim)
367 + *pport = (unsigned short)rcv;
376 /* Sends the TYPE request to the server. */
378 diff -ur wget-1.8.1.orig/src/ftp.c wget-1.8.1/src/ftp.c
379 --- wget-1.8.1.orig/src/ftp.c Tue Dec 4 02:22:05 2001
380 +++ wget-1.8.1/src/ftp.c Tue Feb 19 03:35:12 2002
382 #include <sys/types.h>
385 +#include <sys/socket.h>
386 +#include <netinet/in.h>
387 +#include <arpa/inet.h>
393 if (opt.ftp_pasv > 0)
395 + unsigned short tport;
399 + if (!opt.conn_inet6)
401 + if (!opt.server_response)
402 + logputs (LOG_VERBOSE, "==> EPSV ... ");
403 + err = ftp_epsv (&con->rbuf, thost, &tport);
404 + /* FTPRERR, WRITEFAILED, FTPNOPASV, FTPINVPASV, HOSTERR */
408 + logputs (LOG_VERBOSE, "\n");
409 + logputs (LOG_NOTQUIET, _("\
410 +Error in server response, closing control connection.\n"));
413 + logputs (LOG_VERBOSE, "\n");
414 + logputs (LOG_NOTQUIET,
415 + _("Write failed, closing control connection.\n"));
418 + logputs (LOG_VERBOSE, "\n");
419 + logputs (LOG_NOTQUIET, _("Cannot initiate EPSV transfer.\n"));
422 + logputs (LOG_VERBOSE, "\n");
423 + logputs (LOG_NOTQUIET, _("Cannot parse EPSV response.\n"));
426 + logputs (LOG_VERBOSE, "\n");
427 + logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
430 + /* fine and dandy */
431 + inet_aton(thost, (struct in_addr *)pasv_addr);
438 + rbuf_uninitialize (&con->rbuf);
443 if (!opt.server_response)
444 logputs (LOG_VERBOSE, "==> PASV ... ");
445 err = ftp_pasv (&con->rbuf, pasv_addr);
446 @@ -528,10 +579,17 @@
450 - unsigned short tport;
453 + inet_ntop (AF_INET, pasv_addr, thost, sizeof (thost));
455 tport = (pasv_addr[4] << 8) + pasv_addr[5];
459 + dtsock = connect_to_one (thost, tport, 1);
461 dtsock = connect_to_one (pasv_addr, tport, 1);
468 rbuf_uninitialize (&con->rbuf);
469 logprintf (LOG_VERBOSE, _("couldn't connect to %s:%hu: %s\n"),
473 pretty_print_address (pasv_addr), tport,
475 strerror (save_errno));
476 return save_errno == ECONNREFUSED ? CONREFUSED : CONERROR;
480 if (!passive_mode_open) /* Try to use a port command if PASV failed */
483 + if (!opt.conn_inet6)
486 + if (!opt.server_response)
487 + logputs (LOG_VERBOSE, "==> EPRT ... ");
488 + err = ftp_eprt (&con->rbuf);
489 + /* FTPRERR, WRITEFAILED, bindport (CONSOCKERR, CONPORTERR, BINDERR,
490 + LISTENERR), HOSTERR, FTPPORTERR */
494 + logputs (LOG_VERBOSE, "\n");
495 + logputs (LOG_NOTQUIET, _("\
496 +Error in server response, closing control connection.\n"));
499 + logputs (LOG_VERBOSE, "\n");
500 + logputs (LOG_NOTQUIET,
501 + _("Write failed, closing control connection.\n"));
504 + logputs (LOG_VERBOSE, "\n");
505 + logprintf (LOG_NOTQUIET, "socket: %s\n", strerror (errno));
507 + case CONPORTERR: case BINDERR: case LISTENERR:
508 + /* What now? These problems are local... */
509 + logputs (LOG_VERBOSE, "\n");
510 + logprintf (LOG_NOTQUIET, _("Bind error (%s).\n"),
512 + closeport (dtsock);
516 + logputs (LOG_VERBOSE, "\n");
517 + logprintf (LOG_NOTQUIET, "%s: error\n", u->host);
520 + logputs (LOG_VERBOSE, "\n");
521 + logputs (LOG_NOTQUIET, _("Invalid EPRT.\n"));
524 + /* fine and dandy */
529 + } /* eprt switch */
531 + closeport (dtsock);
532 + rbuf_uninitialize (&con->rbuf);
537 if (!opt.server_response)
538 logputs (LOG_VERBOSE, "==> PORT ... ");
539 err = ftp_port (&con->rbuf);
547 if (!opt.server_response)
548 logputs (LOG_VERBOSE, _("done. "));
550 diff -ur wget-1.8.1.orig/src/ftp.h wget-1.8.1/src/ftp.h
551 --- wget-1.8.1.orig/src/ftp.h Thu Nov 22 09:24:27 2001
552 +++ wget-1.8.1/src/ftp.h Tue Feb 19 00:32:35 2002
554 uerr_t ftp_login PARAMS ((struct rbuf *, const char *, const char *));
555 uerr_t ftp_port PARAMS ((struct rbuf *));
556 uerr_t ftp_pasv PARAMS ((struct rbuf *, unsigned char *));
558 +uerr_t ftp_eprt PARAMS ((struct rbuf *));
559 +uerr_t ftp_epsv PARAMS ((struct rbuf *, char *, unsigned short *));
561 uerr_t ftp_type PARAMS ((struct rbuf *, int));
562 uerr_t ftp_cwd PARAMS ((struct rbuf *, const char *));
563 uerr_t ftp_retr PARAMS ((struct rbuf *, const char *));
564 diff -ur wget-1.8.1.orig/src/host.c wget-1.8.1/src/host.c
565 --- wget-1.8.1.orig/src/host.c Tue Dec 11 17:32:57 2001
566 +++ wget-1.8.1/src/host.c Wed Feb 13 04:14:11 2002
569 struct address_list {
570 int count; /* number of adrresses */
572 + struct addrinfo *addresses;
574 ipv4_address *addresses; /* pointer to the string of addresses */
577 int faulty; /* number of addresses known not to
580 address_list_copy_one (struct address_list *al, int index,
581 unsigned char *ip_store)
584 + struct addrinfo *ai;
585 + assert (index >= al->faulty && index < al->count);
586 + for (ai = al->addresses; ai; ai = ai->ai_next, index--)
589 + memcpy (ip_store, ai, sizeof (*ai));
591 assert (index >= al->faulty && index < al->count);
592 memcpy (ip_store, al->addresses + index, sizeof (ipv4_address));
596 /* Check whether two address lists have all their IPs in common. */
597 @@ -109,12 +122,27 @@
599 address_list_match_all (struct address_list *al1, struct address_list *al2)
602 + struct addrinfo *ai1, *ai2;
606 if (al1->count != al2->count)
609 + for (ai1 = al1->addresses, ai2 = al2->addresses; ai1;
610 + ai1 = ai1->ai_next, ai2 = ai2->ai_next)
612 + if (ai1->ai_addrlen != ai2->ai_addrlen)
614 + if (memcmp (ai1->ai_addr, ai2->ai_addr, ai1->ai_addrlen))
619 return 0 == memcmp (al1->addresses, al2->addresses,
620 al1->count * sizeof (ipv4_address));
624 /* Mark the INDEXth element of AL as faulty, so that the next time
625 @@ -141,26 +169,44 @@
626 as returned by gethostbyname. */
628 static struct address_list *
630 +address_list_new (struct addrinfo *ai)
632 + struct addrinfo *res;
634 address_list_new (char **h_addr_list)
641 struct address_list *al = xmalloc (sizeof (struct address_list));
644 + for (res = ai; res; res = res->ai_next)
646 while (h_addr_list[count])
653 + al->addresses = ai;
655 al->addresses = xmalloc (count * sizeof (ipv4_address));
660 for (i = 0; i < count; i++)
661 memcpy (al->addresses + i, h_addr_list[i], sizeof (ipv4_address));
668 /* Like address_list_new, but initialized with only one address. */
670 static struct address_list *
671 @@ -175,11 +221,16 @@
678 address_list_delete (struct address_list *al)
681 + freeaddrinfo (al->addresses);
683 xfree (al->addresses);
690 return inet_ntoa (*(struct in_addr *)addr);
694 +pretty_print_address_sa (const void *addr, int alen, char *abuf)
696 + int err = getnameinfo((struct sockaddr *)addr, alen, abuf, INET6_ADDRSTRLEN,
697 + NULL, 0, NI_NUMERICHOST);
699 + strcpy (abuf, "???");
704 /* Add host name HOST with the address ADDR_TEXT to the cache.
705 ADDR_LIST is a NULL-terminated list of addresses, as in struct
706 @@ -220,10 +282,23 @@
711 + struct addrinfo *ai;
715 debug_logprintf ("Caching %s =>", host);
717 + for (ai = al->addresses; ai; ai = ai->ai_next)
719 + char hbuf[INET6_ADDRSTRLEN];
720 + pretty_print_address_sa (ai->ai_addr, ai->ai_addrlen, hbuf);
721 + debug_logprintf (" %s", hbuf);
724 for (i = 0; i < al->count; i++)
725 debug_logprintf (" %s", pretty_print_address (al->addresses + i));
727 debug_logprintf ("\n");
731 lookup_host (const char *host, int silent)
733 struct address_list *al = NULL;
735 + struct addrinfo hints, *res;
738 + memset(&hints, 0, sizeof(hints));
740 + hints.ai_family = AF_INET;
741 + else if (opt.inet6)
742 + hints.ai_family = AF_INET6;
744 + hints.ai_family = AF_UNSPEC;
745 + hints.ai_socktype = SOCK_STREAM;
746 + hints.ai_flags = AI_NUMERICHOST;
747 + /* check `N.N.N.N' or 'X:X:X:X:X:X:X:X'. */
748 + if (!getaddrinfo(host, NULL, &hints, &res))
749 + return address_list_new (res);
753 struct hostent *hptr;
757 return address_list_new_one ((char *)&addr + offset);
761 /* By now we know that the host name we got is not of the form
762 d.d.d.d. Try to find it in our cache of host names. */
763 @@ -270,12 +364,29 @@
765 logprintf (LOG_VERBOSE, _("Resolving %s... "), host);
768 + memset(&hints, 0, sizeof(hints));
770 + hints.ai_family = AF_INET;
771 + else if (opt.inet6)
772 + hints.ai_family = AF_INET6;
774 + hints.ai_family = AF_UNSPEC;
775 + hints.ai_socktype = SOCK_STREAM;
776 + error = getaddrinfo(host, NULL, &hints, &res);
779 /* Look up the host using gethostbyname(). */
780 hptr = gethostbyname (host);
786 + logprintf (LOG_VERBOSE, _("failed: %s.\n"), gai_strerror(error));
788 logprintf (LOG_VERBOSE, _("failed: %s.\n"), herrmsg (h_errno));
795 /* Do all systems have h_addr_list, or is it a newer thing? If the
796 latter, use address_list_new_one. */
798 + al = address_list_new (res);
800 al = address_list_new (hptr->h_addr_list);
803 /* Cache the lookup information. */
804 cache_host_lookup (host, al);
805 diff -ur wget-1.8.1.orig/src/host.h wget-1.8.1/src/host.h
806 --- wget-1.8.1.orig/src/host.h Tue Dec 11 17:32:58 2001
807 +++ wget-1.8.1/src/host.h Wed Feb 13 00:14:42 2002
809 /* This was originally going to be a macro, but then every caller
810 would have to #include the netinet stuff. */
811 char *pretty_print_address PARAMS ((const void *));
813 +int pretty_print_address_sa PARAMS ((const void *, int, char *));
816 int accept_domain PARAMS ((struct url *));
817 int sufmatch PARAMS ((const char **, const char *));
818 diff -ur wget-1.8.1.orig/src/http.c wget-1.8.1/src/http.c
819 --- wget-1.8.1.orig/src/http.c Fri Dec 14 01:46:56 2001
820 +++ wget-1.8.1/src/http.c Sun Jan 27 08:19:10 2002
822 /* Whether keep-alive should be inhibited. */
823 int inhibit_keep_alive;
825 + /* Whether we need to print the host header with braces around host,
826 + e.g. "Host: [3ffe:8100:200:2::2]:1234" instead of the usual
827 + "Host: symbolic-name:1234". */
828 + int squares_around_host = 0;
831 /* initialize ssl_ctx on first run */
834 "param=value", full_path will be "/foo/bar?param=value". */
835 full_path = url_full_path (u);
837 + if (strchr (u->host, ':'))
838 + squares_around_host = 1;
840 /* Allocate the memory for the request. */
841 request = (char *)alloca (strlen (command)
843 @@ -832,11 +840,12 @@
850 %s%s%s%s%s%s%s%s\r\n",
852 - useragent, u->host,
854 + squares_around_host ? "[" : "", u->host, squares_around_host ? "]" : "",
855 port_maybe ? port_maybe : "",
857 request_keep_alive ? request_keep_alive : "",
858 diff -ur wget-1.8.1.orig/src/init.c wget-1.8.1/src/init.c
859 --- wget-1.8.1.orig/src/init.c Fri Dec 14 04:19:03 2001
860 +++ wget-1.8.1/src/init.c Tue Feb 19 02:45:18 2002
863 # include <sys/socket.h>
864 # include <netinet/in.h>
867 # include <arpa/inet.h>
870 { "ignorelength", &opt.ignore_length, cmd_boolean },
871 { "ignoretags", &opt.ignore_tags, cmd_vector },
872 { "includedirectories", &opt.includes, cmd_directory_vector },
874 + { "inet", &opt.inet, cmd_boolean },
875 + { "inet6", &opt.inet6, cmd_boolean },
877 { "input", &opt.input_filename, cmd_file },
878 { "killlonger", &opt.kill_longer, cmd_boolean },
879 { "limitrate", &opt.limit_rate, cmd_bytes },
880 @@ -526,10 +531,18 @@
881 cmd_address (const char *com, const char *val, void *closure)
883 struct address_list *al;
885 + struct addrinfo ai;
886 + struct sockaddr_storage ss;
889 struct sockaddr_in sin;
891 struct sockaddr_in **target = (struct sockaddr_in **)closure;
894 memset (&sin, '\0', sizeof (sin));
897 al = lookup_host (val, 1);
899 @@ -538,16 +551,29 @@
900 exec_name, com, val);
904 + address_list_copy_one (al, 0, (unsigned char *)&ai);
905 + slen = ai.ai_addrlen;
906 + memcpy (&ss, ai.ai_addr, slen);
908 address_list_copy_one (al, 0, (unsigned char *)&sin.sin_addr);
910 address_list_release (al);
913 sin.sin_family = AF_INET;
917 FREE_MAYBE (*target);
920 + *target = xmalloc (sizeof (ss));
921 + memcpy (*target, &ss, slen);
923 *target = xmalloc (sizeof (sin));
924 memcpy (*target, &sin, sizeof (sin));
929 diff -ur wget-1.8.1.orig/src/main.c wget-1.8.1/src/main.c
930 --- wget-1.8.1.orig/src/main.c Mon Dec 10 14:31:44 2001
931 +++ wget-1.8.1/src/main.c Tue Feb 19 02:41:12 2002
933 -Q, --quota=NUMBER set retrieval quota to NUMBER.\n\
934 --limit-rate=RATE limit download rate to RATE.\n\
938 + --inet use IP version 4 socket.\n\
939 + --inet6 use IP version 6 socket.\n\
944 -nd --no-directories don\'t create directories.\n\
946 { "help", no_argument, NULL, 'h' },
947 { "html-extension", no_argument, NULL, 'E' },
948 { "ignore-length", no_argument, NULL, 138 },
950 + { "inet", no_argument, NULL, '4' },
951 + { "inet6", no_argument, NULL, '6' },
953 { "mirror", no_argument, NULL, 'm' },
954 { "no-clobber", no_argument, NULL, 141 },
955 { "no-directories", no_argument, NULL, 147 },
958 setval ("randomwait", "on");
962 + setval ("inet", "on");
963 + setval ("inet6", "off");
966 + setval ("inet6", "on");
967 + setval ("inet", "off");
971 setval ("background", "on");
978 + if (opt.inet && opt.inet6)
980 + printf (_("Can't inet and inet6 be specified at the same time.\n"));
985 if (opt.timestamping && opt.noclobber)
988 diff -ur wget-1.8.1.orig/src/options.h wget-1.8.1/src/options.h
989 --- wget-1.8.1.orig/src/options.h Fri Nov 30 16:39:08 2001
990 +++ wget-1.8.1/src/options.h Tue Feb 19 02:49:40 2002
992 int page_requisites; /* Whether we need to download all files
993 necessary to display a page properly. */
998 + int conn_inet6; /* connect IPv6? */
999 + struct sockaddr_storage *bind_address;
1001 struct sockaddr_in *bind_address; /* What local IP address to bind to. */
1005 char *sslcertfile; /* external client cert to use. */
1006 diff -ur wget-1.8.1.orig/src/url.c wget-1.8.1/src/url.c
1007 --- wget-1.8.1.orig/src/url.c Sat Dec 15 00:45:59 2001
1008 +++ wget-1.8.1/src/url.c Sun Jan 27 05:43:17 2002
1010 RU, 0, 0, 0, 0, 0, 0, 0, /* @ A B C D E F G */
1011 0, 0, 0, 0, 0, 0, 0, 0, /* H I J K L M N O */
1012 0, 0, 0, 0, 0, 0, 0, 0, /* P Q R S T U V W */
1013 - 0, 0, 0, U, U, U, U, 0, /* X Y Z [ \ ] ^ _ */
1014 + 0, 0, 0, RU, U, RU, U, 0, /* X Y Z [ \ ] ^ _ */
1015 U, 0, 0, 0, 0, 0, 0, 0, /* ` a b c d e f g */
1016 0, 0, 0, 0, 0, 0, 0, 0, /* h i j k l m n o */
1017 0, 0, 0, 0, 0, 0, 0, 0, /* p q r s t u v w */
1018 @@ -528,6 +528,11 @@
1019 memcpy (*user, str, len);
1020 (*user)[len] = '\0';
1023 + decode_string (*user);
1025 + decode_string (*passwd);
1030 @@ -617,16 +622,20 @@
1033 static char *parse_errors[] = {
1034 -#define PE_NO_ERROR 0
1035 +#define PE_NO_ERROR 0
1037 -#define PE_UNSUPPORTED_SCHEME 1
1038 +#define PE_UNSUPPORTED_SCHEME 1
1039 "Unsupported scheme",
1040 -#define PE_EMPTY_HOST 2
1041 +#define PE_EMPTY_HOST 2
1043 -#define PE_BAD_PORT_NUMBER 3
1044 +#define PE_BAD_PORT_NUMBER 3
1046 -#define PE_INVALID_USER_NAME 4
1047 - "Invalid user name"
1048 +#define PE_INVALID_USER_NAME 4
1049 + "Invalid user name",
1050 +#define PE_UNTERMINATED_IPV6_ADDRESS 5
1051 + "Unterminated IPv6 numeric address",
1052 +#define PE_INVALID_IPV6_ADDRESS 6
1053 + "Invalid char in IPv6 numeric address"
1056 #define SETERR(p, v) do { \
1057 @@ -688,8 +697,45 @@
1058 fragment_b = fragment_e = NULL;
1061 - p = strpbrk_or_eos (p, ":/;?#");
1066 + /* Support http://[::1]/ used by IPv6. */
1077 + SETERR (error, PE_UNTERMINATED_IPV6_ADDRESS);
1079 + case ':': case '.':
1090 + SETERR (error, PE_INVALID_IPV6_ADDRESS);
1093 + /* Don't include brackets in [host_b, host_p). */
1099 + p = strpbrk_or_eos (p, ":/;?#");
1103 if (host_b == host_e)
1105 @@ -1575,6 +1621,37 @@
1106 memcpy (constr + baselength, link, linklength);
1107 constr[baselength + linklength] = '\0';
1109 + else if (linklength > 1 && *link == '/' && *(link + 1) == '/')
1111 + /* LINK begins with "//" and so is a net path: we need to
1112 + replace everything after (and including) the double slash
1115 + /* uri_merge("foo", "//new/bar") -> "//new/bar" */
1116 + /* uri_merge("//old/foo", "//new/bar") -> "//new/bar" */
1117 + /* uri_merge("http://old/foo", "//new/bar") -> "http://new/bar" */
1120 + const char *slash;
1121 + const char *start_insert;
1123 + /* Look for first slash. */
1124 + slash = memchr (base, '/', end - base);
1125 + /* If found slash and it is a double slash, then replace
1126 + from this point, else default to replacing from the
1128 + if (slash && *(slash + 1) == '/')
1129 + start_insert = slash;
1131 + start_insert = base;
1133 + span = start_insert - base;
1134 + constr = (char *)xmalloc (span + linklength + 1);
1136 + memcpy (constr, base, span);
1137 + memcpy (constr + span, link, linklength);
1138 + constr[span + linklength] = '\0';
1140 else if (*link == '/')
1142 /* LINK is an absolute path: we need to replace everything
1143 @@ -1734,6 +1811,8 @@
1144 char *scheme_str = supported_schemes[url->scheme].leading_string;
1145 int fplen = full_path_length (url);
1147 + int brackets_around_host = 0;
1149 assert (scheme_str != NULL);
1151 /* Make sure the user name and password are quoted. */
1152 @@ -1749,8 +1828,12 @@
1156 + if (strchr (url->host, ':'))
1157 + brackets_around_host = 1;
1159 size = (strlen (scheme_str)
1160 + strlen (url->host)
1161 + + (brackets_around_host ? 2 : 0)
1164 if (url->port != scheme_port)
1165 @@ -1776,7 +1859,11 @@
1169 + if (brackets_around_host)
1171 APPEND (p, url->host);
1172 + if (brackets_around_host)
1174 if (url->port != scheme_port)
1177 --- wget-1.8.2/configure.in.orig Wed Jun 5 20:57:48 2002
1178 +++ wget-1.8.2/configure.in Wed Jun 5 21:02:38 2002
1180 DEBUG=$enableval, DEBUG=yes)
1181 test x"${DEBUG}" = xyes && AC_DEFINE(DEBUG,,[Support for debugging output])
1183 +AC_ARG_ENABLE(ipv6,
1184 +[ --enable-ipv6 enable IPv6 support],
1185 +INET6=$enableval, INET6=yes)
1186 +test x"${INET6}" = xyes && AC_DEFINE(INET6,,[IPv6 support])
1190 case "${USE_OPIE}${USE_DIGEST}" in
1191 --- wget-1.8.2/po/pl.po.orig Sun May 19 05:18:59 2002
1192 +++ wget-1.8.2/po/pl.po Wed Jun 5 21:07:23 2002
1193 @@ -1227,3 +1227,29 @@
1195 msgid "Failed to unlink symlink `%s': %s\n"
1196 msgstr "Nie uda³o siê usun±æ dowi±zania symbolicznego `%s': %s\n"
1199 +msgid "Cannot initiate EPSV transfer.\n"
1200 +msgstr "Nie mo¿na rozpocz±æ transferu EPSV.\n"
1203 +msgid "Cannot parse EPSV response.\n"
1204 +msgstr "Nie powiod³a siê analiza odpowiedzi EPSV.\n"
1207 +msgid "Invalid EPRT.\n"
1208 +msgstr "B³êdny EPRT.\n"
1212 +" --inet use IP version 4 socket.\n"
1213 +" --inet6 use IP version 6 socket.\n"
1216 +" --inet u¿ywa gniazd IP w wersji 4.\n"
1217 +" --inet6 u¿ywa gniazd IP w wersji 6.\n"
1221 +msgid "Can't inet and inet6 be specified at the same time.\n"
1222 +msgstr "Opcje inet i inet6 nie mog± byæ podane jednocze¶nie.\n"