aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--networking/wget.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/networking/wget.c b/networking/wget.c
index cfbaceced..d6c509edc 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -274,15 +274,22 @@ static void parse_url(const char *src_url, struct host_info *h)
274 free(h->allocated); 274 free(h->allocated);
275 h->allocated = url = xstrdup(src_url); 275 h->allocated = url = xstrdup(src_url);
276 276
277 if (strncmp(url, "http://", 7) == 0) { 277 if (strncmp(url, "ftp://", 6) == 0) {
278 h->port = bb_lookup_port("http", "tcp", 80);
279 h->host = url + 7;
280 h->is_ftp = 0;
281 } else if (strncmp(url, "ftp://", 6) == 0) {
282 h->port = bb_lookup_port("ftp", "tcp", 21); 278 h->port = bb_lookup_port("ftp", "tcp", 21);
283 h->host = url + 6; 279 h->host = url + 6;
284 h->is_ftp = 1; 280 h->is_ftp = 1;
285 } else 281 } else
282 if (strncmp(url, "http://", 7) == 0) {
283 h->host = url + 7;
284 http:
285 h->port = bb_lookup_port("http", "tcp", 80);
286 h->is_ftp = 0;
287 } else
288 if (!strstr(url, "//")) {
289 // GNU wget is user-friendly and falls back to http://
290 h->host = url;
291 goto http;
292 } else
286 bb_error_msg_and_die("not an http or ftp url: %s", sanitize_string(url)); 293 bb_error_msg_and_die("not an http or ftp url: %s", sanitize_string(url));
287 294
288 // FYI: 295 // FYI: