On Friday 18 February 2005 09:01 pm, Hrvoje Niksic wrote: > Donny Viszneki <[EMAIL PROTECTED]> writes: > > But as I noted, the source code does NOT appear to escape the tilde > > under any conditions. > > Take a look at urlchr_table at url.c. ~ is marked as an unsafe > character, which is why it gets escaped.
i was actually looking if there is a single point in the wget code where all the URLs are escaped. the answer seem to be negative: [EMAIL PROTECTED] src]$ grep "\<url_escape\>" * ChangeLog: (url_escape): Use it. ChangeLog~: (url_escape): Use it. ftp-ls.c: tmpu = url_escape (u->user); ftp-ls.c: tmpp = u->passwd ? url_escape (u->passwd) : NULL; Binary file ftp-ls.o matches url.c:url_escape (const char *s) url.c: with url_escape. But what if we're requested to download url.c: `abc%20def'? url_escape transforms "%" to "%25", which would leave url.c: that in that case Wget should not call url_escape, but leave the url.c: url_escape, we end up with `/abc%2520%20def', which is almost url.c: certainly not intended. If we don't call url_escape, we are left url.h:char *url_escape PARAMS ((const char *)); Binary file url.o matches Binary file wget matches [EMAIL PROTECTED] src]$ grep url_escape *.c ftp-ls.c: tmpu = url_escape (u->user); ftp-ls.c: tmpp = u->passwd ? url_escape (u->passwd) : NULL; url.c:/* The core of url_escape_* functions. Escapes the characters that url.c:url_escape_1 (const char *s, unsigned char mask, int allow_passthrough) url.c:url_escape (const char *s) url.c: return url_escape_1 (s, urlchr_unsafe, 0); url.c:url_escape_allow_passthrough (const char *s) url.c: return url_escape_1 (s, urlchr_unsafe, 1); url.c: with url_escape. But what if we're requested to download url.c: `abc%20def'? url_escape transforms "%" to "%25", which would leave url.c: that in that case Wget should not call url_escape, but leave the url.c: url_escape, we end up with `/abc%2520%20def', which is almost url.c: certainly not intended. If we don't call url_escape, we are left url.c:url_escape_dir (const char *dir) url.c: char *newdir = url_escape_1 (dir, urlchr_unsafe | urlchr_reserved, 1); url.c: /* url_escape_1 having converted '/' to "%2F" exactly. */ url.c: edir = url_escape_dir (u->dir); url.c: efile = url_escape_1 (u->file, urlchr_unsafe | urlchr_reserved, 1); url.c: quoted_user = url_escape_allow_passthrough (url->user); url.c: quoted_passwd = url_escape_allow_passthrough (url->passwd); -- Aequam memento rebus in arduis servare mentem... Mauro Tortonesi University of Ferrara - Dept. of Eng. http://www.ing.unife.it Institute of Human & Machine Cognition http://www.ihmc.us Deep Space 6 - IPv6 for Linux http://www.deepspace6.net Ferrara Linux User Group http://www.ferrara.linux.it