diff options
author | Glenn L McGrath <bug1@ihug.co.nz> | 2003-09-10 23:52:15 +0000 |
---|---|---|
committer | Glenn L McGrath <bug1@ihug.co.nz> | 2003-09-10 23:52:15 +0000 |
commit | cc20ebc11e2fdca0dc08788f663d0351c053df28 (patch) | |
tree | 4048efbf81bba2140aab74fbc7e2ff593303f305 /networking | |
parent | 1cb2622f9c583c0d4a2ac00b7eaf389f85693397 (diff) | |
download | busybox-w32-cc20ebc11e2fdca0dc08788f663d0351c053df28.tar.gz busybox-w32-cc20ebc11e2fdca0dc08788f663d0351c053df28.tar.bz2 busybox-w32-cc20ebc11e2fdca0dc08788f663d0351c053df28.zip |
add ipv6 literal support to wget
Diffstat (limited to 'networking')
-rw-r--r-- | networking/Config.in | 7 | ||||
-rw-r--r-- | networking/wget.c | 30 |
2 files changed, 33 insertions, 4 deletions
diff --git a/networking/Config.in b/networking/Config.in index 2705980bb..534f67205 100644 --- a/networking/Config.in +++ b/networking/Config.in | |||
@@ -589,6 +589,13 @@ config CONFIG_FEATURE_WGET_AUTHENTICATION | |||
589 | help | 589 | help |
590 | Support authenticated HTTP transfers. | 590 | Support authenticated HTTP transfers. |
591 | 591 | ||
592 | config CONFIG_FEATURE_WGET_IP6_LITERAL | ||
593 | bool " Enable IPv6 literal addresses" | ||
594 | default y | ||
595 | depends on CONFIG_WGET | ||
596 | help | ||
597 | Support IPv6 address literal notation in URLs. | ||
598 | |||
592 | source networking/udhcp/Config.in | 599 | source networking/udhcp/Config.in |
593 | 600 | ||
594 | endmenu | 601 | endmenu |
diff --git a/networking/wget.c b/networking/wget.c index 5ea559b89..5f2a39917 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -310,7 +310,12 @@ int wget_main(int argc, char **argv) | |||
310 | * Send HTTP request. | 310 | * Send HTTP request. |
311 | */ | 311 | */ |
312 | if (proxy) { | 312 | if (proxy) { |
313 | fprintf(sfp, "GET %stp://%s:%d/%s HTTP/1.1\r\n", | 313 | const char *format = "GET %stp://%s:%d/%s HTTP/1.1\r\n"; |
314 | #ifdef CONFIG_FEATURE_WGET_IP6_LITERAL | ||
315 | if (strchr (target.host, ':')) | ||
316 | format = "GET %stp://[%s]:%d/%s HTTP/1.1\r\n"; | ||
317 | #endif | ||
318 | fprintf(sfp, format, | ||
314 | target.is_ftp ? "f" : "ht", target.host, | 319 | target.is_ftp ? "f" : "ht", target.host, |
315 | target.port, target.path); | 320 | target.port, target.path); |
316 | } else { | 321 | } else { |
@@ -525,7 +530,7 @@ read_response: | |||
525 | 530 | ||
526 | void parse_url(char *url, struct host_info *h) | 531 | void parse_url(char *url, struct host_info *h) |
527 | { | 532 | { |
528 | char *cp, *sp, *up; | 533 | char *cp, *sp, *up, *pp; |
529 | 534 | ||
530 | if (strncmp(url, "http://", 7) == 0) { | 535 | if (strncmp(url, "http://", 7) == 0) { |
531 | h->port = 80; | 536 | h->port = 80; |
@@ -553,7 +558,24 @@ void parse_url(char *url, struct host_info *h) | |||
553 | } else | 558 | } else |
554 | h->user = NULL; | 559 | h->user = NULL; |
555 | 560 | ||
556 | cp = strchr(h->host, ':'); | 561 | pp = h->host; |
562 | |||
563 | #ifdef CONFIG_FEATURE_WGET_IP6_LITERAL | ||
564 | if (h->host[0] == '[') { | ||
565 | char *ep; | ||
566 | |||
567 | ep = h->host + 1; | ||
568 | while (*ep == ':' || isdigit (*ep)) | ||
569 | ep++; | ||
570 | if (*ep == ']') { | ||
571 | h->host++; | ||
572 | *ep = '\0'; | ||
573 | pp = ep + 1; | ||
574 | } | ||
575 | } | ||
576 | #endif | ||
577 | |||
578 | cp = strchr(pp, ':'); | ||
557 | if (cp != NULL) { | 579 | if (cp != NULL) { |
558 | *cp++ = '\0'; | 580 | *cp++ = '\0'; |
559 | h->port = atoi(cp); | 581 | h->port = atoi(cp); |
@@ -819,7 +841,7 @@ progressmeter(int flag) | |||
819 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 841 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
820 | * SUCH DAMAGE. | 842 | * SUCH DAMAGE. |
821 | * | 843 | * |
822 | * $Id: wget.c,v 1.57 2003/08/29 06:25:04 bug1 Exp $ | 844 | * $Id: wget.c,v 1.58 2003/09/10 23:52:15 bug1 Exp $ |
823 | */ | 845 | */ |
824 | 846 | ||
825 | 847 | ||