diff options
author | Ron Yorston <rmy@pobox.com> | 2018-05-13 08:15:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2018-05-13 08:15:58 +0100 |
commit | 3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d (patch) | |
tree | a527d0db15f34a137fc11df5538c7f2f7c6d72de /networking/wget.c | |
parent | 6f7d1af269eed4b42daeb9c6dfd2ba62f9cd47e4 (diff) | |
parent | d80eecb86812c1fbda652f9b995060c26ba0b155 (diff) | |
download | busybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.tar.gz busybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.tar.bz2 busybox-w32-3ce461fdf3b7adfd44ea058fa0c5ca6d91a5bc5d.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'networking/wget.c')
-rw-r--r-- | networking/wget.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/networking/wget.c b/networking/wget.c index 5ff31d278..85eae061b 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
@@ -511,23 +511,23 @@ static void parse_url(const char *src_url, struct host_info *h) | |||
511 | *p = '\0'; | 511 | *p = '\0'; |
512 | h->host = p + 3; | 512 | h->host = p + 3; |
513 | if (strcmp(url, P_FTP) == 0) { | 513 | if (strcmp(url, P_FTP) == 0) { |
514 | h->port = bb_lookup_port(P_FTP, "tcp", 21); | 514 | h->port = bb_lookup_std_port(P_FTP, "tcp", 21); |
515 | } else | 515 | } else |
516 | #if SSL_SUPPORTED | 516 | #if SSL_SUPPORTED |
517 | # if ENABLE_FEATURE_WGET_HTTPS | 517 | # if ENABLE_FEATURE_WGET_HTTPS |
518 | if (strcmp(url, P_FTPS) == 0) { | 518 | if (strcmp(url, P_FTPS) == 0) { |
519 | h->port = bb_lookup_port(P_FTPS, "tcp", 990); | 519 | h->port = bb_lookup_std_port(P_FTPS, "tcp", 990); |
520 | h->protocol = P_FTPS; | 520 | h->protocol = P_FTPS; |
521 | } else | 521 | } else |
522 | # endif | 522 | # endif |
523 | if (strcmp(url, P_HTTPS) == 0) { | 523 | if (strcmp(url, P_HTTPS) == 0) { |
524 | h->port = bb_lookup_port(P_HTTPS, "tcp", 443); | 524 | h->port = bb_lookup_std_port(P_HTTPS, "tcp", 443); |
525 | h->protocol = P_HTTPS; | 525 | h->protocol = P_HTTPS; |
526 | } else | 526 | } else |
527 | #endif | 527 | #endif |
528 | if (strcmp(url, P_HTTP) == 0) { | 528 | if (strcmp(url, P_HTTP) == 0) { |
529 | http: | 529 | http: |
530 | h->port = bb_lookup_port(P_HTTP, "tcp", 80); | 530 | h->port = bb_lookup_std_port(P_HTTP, "tcp", 80); |
531 | h->protocol = P_HTTP; | 531 | h->protocol = P_HTTP; |
532 | } else { | 532 | } else { |
533 | *p = ':'; | 533 | *p = ':'; |
@@ -545,7 +545,7 @@ static void parse_url(const char *src_url, struct host_info *h) | |||
545 | // and saves 'index.html?var=a%2Fb' (we save 'b') | 545 | // and saves 'index.html?var=a%2Fb' (we save 'b') |
546 | // wget 'http://busybox.net?login=john@doe': | 546 | // wget 'http://busybox.net?login=john@doe': |
547 | // request: 'GET /?login=john@doe HTTP/1.0' | 547 | // request: 'GET /?login=john@doe HTTP/1.0' |
548 | // saves: 'index.html?login=john@doe' (we save '?login=john@doe') | 548 | // saves: 'index.html?login=john@doe' (we save 'login=john@doe') |
549 | // wget 'http://busybox.net#test/test': | 549 | // wget 'http://busybox.net#test/test': |
550 | // request: 'GET / HTTP/1.0' | 550 | // request: 'GET / HTTP/1.0' |
551 | // saves: 'index.html' (we save 'test') | 551 | // saves: 'index.html' (we save 'test') |
@@ -559,13 +559,13 @@ static void parse_url(const char *src_url, struct host_info *h) | |||
559 | } else if (*sp == '/') { | 559 | } else if (*sp == '/') { |
560 | *sp = '\0'; | 560 | *sp = '\0'; |
561 | h->path = sp + 1; | 561 | h->path = sp + 1; |
562 | } else { // '#' or '?' | 562 | } else { |
563 | // sp points to '#' or '?' | ||
564 | // Note: | ||
563 | // http://busybox.net?login=john@doe is a valid URL | 565 | // http://busybox.net?login=john@doe is a valid URL |
564 | // memmove converts to: | 566 | // (without '/' between ".net" and "?"), |
565 | // http:/busybox.nett?login=john@doe... | 567 | // can't store NUL at sp[-1] - this destroys hostname. |
566 | memmove(h->host - 1, h->host, sp - h->host); | 568 | *sp++ = '\0'; |
567 | h->host--; | ||
568 | sp[-1] = '\0'; | ||
569 | h->path = sp; | 569 | h->path = sp; |
570 | } | 570 | } |
571 | 571 | ||