diff options
| -rw-r--r-- | networking/wget.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/networking/wget.c b/networking/wget.c index 028e18c73..19bf8f887 100644 --- a/networking/wget.c +++ b/networking/wget.c | |||
| @@ -363,7 +363,7 @@ int wget_main(int argc, char **argv) | |||
| 363 | } | 363 | } |
| 364 | } | 364 | } |
| 365 | } | 365 | } |
| 366 | } while(status >= 300); | 366 | } while (status >= 300); |
| 367 | 367 | ||
| 368 | dfp = sfp; | 368 | dfp = sfp; |
| 369 | 369 | ||
| @@ -509,7 +509,7 @@ int wget_main(int argc, char **argv) | |||
| 509 | 509 | ||
| 510 | static void parse_url(char *src_url, struct host_info *h) | 510 | static void parse_url(char *src_url, struct host_info *h) |
| 511 | { | 511 | { |
| 512 | char *url, *p, *cp, *sp, *up, *pp; | 512 | char *url, *p, *sp; |
| 513 | 513 | ||
| 514 | /* h->allocated = */ url = xstrdup(src_url); | 514 | /* h->allocated = */ url = xstrdup(src_url); |
| 515 | 515 | ||
| @@ -542,8 +542,8 @@ static void parse_url(char *src_url, struct host_info *h) | |||
| 542 | if (!sp) { | 542 | if (!sp) { |
| 543 | h->path = ""; | 543 | h->path = ""; |
| 544 | } else if (*sp == '/') { | 544 | } else if (*sp == '/') { |
| 545 | *sp++ = '\0'; | 545 | *sp = '\0'; |
| 546 | h->path = sp; | 546 | h->path = sp + 1; |
| 547 | } else { // '#' or '?' | 547 | } else { // '#' or '?' |
| 548 | // http://busybox.net?login=john@doe is a valid URL | 548 | // http://busybox.net?login=john@doe is a valid URL |
| 549 | // memmove converts to: | 549 | // memmove converts to: |
| @@ -554,35 +554,35 @@ static void parse_url(char *src_url, struct host_info *h) | |||
| 554 | h->path = sp; | 554 | h->path = sp; |
| 555 | } | 555 | } |
| 556 | 556 | ||
| 557 | up = strrchr(h->host, '@'); | 557 | sp = strrchr(h->host, '@'); |
| 558 | if (up != NULL) { | 558 | h->user = NULL; |
| 559 | if (sp != NULL) { | ||
| 559 | h->user = h->host; | 560 | h->user = h->host; |
| 560 | *up++ = '\0'; | 561 | *sp = '\0'; |
| 561 | h->host = up; | 562 | h->host = sp + 1; |
| 562 | } else | 563 | } |
| 563 | h->user = NULL; | ||
| 564 | 564 | ||
| 565 | pp = h->host; | 565 | sp = h->host; |
| 566 | 566 | ||
| 567 | #if ENABLE_FEATURE_WGET_IP6_LITERAL | 567 | #if ENABLE_FEATURE_WGET_IP6_LITERAL |
| 568 | if (h->host[0] == '[') { | 568 | if (sp[0] == '[') { |
| 569 | char *ep; | 569 | char *ep; |
| 570 | 570 | ||
| 571 | ep = h->host + 1; | 571 | ep = sp + 1; |
| 572 | while (*ep == ':' || isxdigit(*ep)) | 572 | while (*ep == ':' || isxdigit(*ep)) |
| 573 | ep++; | 573 | ep++; |
| 574 | if (*ep == ']') { | 574 | if (*ep == ']') { |
| 575 | h->host++; | 575 | h->host++; |
| 576 | *ep = '\0'; | 576 | *ep = '\0'; |
| 577 | pp = ep + 1; | 577 | sp = ep + 1; |
| 578 | } | 578 | } |
| 579 | } | 579 | } |
| 580 | #endif | 580 | #endif |
| 581 | 581 | ||
| 582 | cp = strchr(pp, ':'); | 582 | p = strchr(sp, ':'); |
| 583 | if (cp != NULL) { | 583 | if (p != NULL) { |
| 584 | *cp++ = '\0'; | 584 | *p = '\0'; |
| 585 | h->port = htons(xatou16(cp)); | 585 | h->port = htons(xatou16(p + 1)); |
| 586 | } | 586 | } |
| 587 | } | 587 | } |
| 588 | 588 | ||
