[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH] wget: User-friendly fallback to http
From:       Lauri Kasanen <curaga () operamail ! com>
Date:       2013-11-25 18:58:05
Message-ID: 1385405885.14906.51904593.32637499 () webmail ! messagingengine ! com
[Download RAW message or body]

Hi,

GNU wget: wget google.com // ok
bb before: wget google.com // wget: not an http or ftp url

This costs 47 bytes here, but improves the usability quite a bit.

- Lauri

-- 
http://www.fastmail.fm - A no graphics, no pop-ups email service


["0001-wget-User-friendly-fallback-to-http.patch" (0001-wget-User-friendly-fallback-to-http.patch)]

From a89587e950bbfe1b3682a2c38405967f197a34e9 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <curaga@operamail.com>
Date: Mon, 25 Nov 2013 20:53:12 +0200
Subject: [PATCH] wget: User-friendly fallback to http

GNU wget: wget google.com // ok
bb before: wget google.com // wget: not an http or ftp url

Signed-off-by: Lauri Kasanen <curaga@operamail.com>
---
 networking/wget.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/networking/wget.c b/networking/wget.c
index cfbacec..3c66665 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -282,6 +282,11 @@ static void parse_url(const char *src_url, struct host_info *h)
 		h->port = bb_lookup_port("ftp", "tcp", 21);
 		h->host = url + 6;
 		h->is_ftp = 1;
+	} else if (!strstr(url, "//")) {
+		// GNU wget is user-friendly and falls back to http://
+		h->port = bb_lookup_port("http", "tcp", 80);
+		h->host = url;
+		h->is_ftp = 0;
 	} else
 		bb_error_msg_and_die("not an http or ftp url: %s", sanitize_string(url));
 
-- 
1.8.3.1



_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic