[git commit master 1/1] wget: --post-data=STR should not encode STR, should send it verbatim

Denys Vlasenko vda.linux at googlemail.com
Sun Mar 27 20:33:13 UTC 2011


commit: http://git.busybox.net/busybox/commit/?id=700fbc308dd1f2e063180786cddfcc4abd6c10c0
branch: http://git.busybox.net/busybox/commit/?id=refs/heads/master

This matches GNU Wget 1.12 behavior.

Signed-off-by: Vitaly Magerya <vmagerya at gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 networking/wget.c |   42 +-----------------------------------------
 1 files changed, 1 insertions(+), 41 deletions(-)

diff --git a/networking/wget.c b/networking/wget.c
index c22a76b..2f89c8f 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -344,44 +344,6 @@ static char *gethdr(FILE *fp)
 	return hdrval;
 }
 
-#if ENABLE_FEATURE_WGET_LONG_OPTIONS
-static char *URL_escape(const char *str)
-{
-	/* URL encode, see RFC 2396 */
-	char *dst;
-	char *res = dst = xmalloc(strlen(str) * 3 + 1);
-	unsigned char c;
-
-	while (1) {
-		c = *str++;
-		if (c == '\0'
-		/* || strchr("!&'()*-.=_~", c) - more code */
-		 || c == '!'
-		 || c == '&'
-		 || c == '\''
-		 || c == '('
-		 || c == ')'
-		 || c == '*'
-		 || c == '-'
-		 || c == '.'
-		 || c == '='
-		 || c == '_'
-		 || c == '~'
-		 || (c >= '0' && c <= '9')
-		 || ((c|0x20) >= 'a' && (c|0x20) <= 'z')
-		) {
-			*dst++ = c;
-			if (c == '\0')
-				return res;
-		} else {
-			*dst++ = '%';
-			*dst++ = bb_hexdigits_upcase[c >> 4];
-			*dst++ = bb_hexdigits_upcase[c & 0xf];
-		}
-	}
-}
-#endif
-
 static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_sockaddr *lsa)
 {
 	FILE *sfp;
@@ -716,15 +678,13 @@ static void download_one_url(const char *url)
 			fputs(G.extra_headers, sfp);
 
 		if (option_mask32 & WGET_OPT_POST_DATA) {
-			char *estr = URL_escape(G.post_data);
 			fprintf(sfp,
 				"Content-Type: application/x-www-form-urlencoded\r\n"
 				"Content-Length: %u\r\n"
 				"\r\n"
 				"%s",
-				(int) strlen(estr), estr
+				(int) strlen(G.post_data), G.post_data
 			);
-			free(estr);
 		} else
 #endif
 		{
-- 
1.7.3.4



More information about the busybox-cvs mailing list