tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: VIS_HTTPSTYLE
On Mon, 23 Nov 2009, Robert Elz wrote:
> Date: Sun, 22 Nov 2009 20:57:48 +0000 (GMT)
> From: Iain Hibbert <plunky%rya-online.net@localhost>
> Message-ID:
> <1258923468.118935.10202.nullmailer%galant.ukfsn.org@localhost>
>
> | but I think it should actually have been "strchr() == NULL" to escape the
> | unmatched characters..
>
> No, that wasn't the bug, the strchr(str, c) != NULL is the same as
> c == str[0] || c == str[2] || ...
> and that's exactly what we want (and what you translated it into).
Yeah, but if it matched any of the chars in the string, it specifically
encoded them which was not the intention.. logic was reversed
> Personally I'd prefer a smaller change to the code, to just correct the
> obvious bugs, without the unnecessary style change, that would be
> something more like
>
> if (!isascii(c) || !(isalnum(c) || (c != '\0' &&
> strchr("$-_.+!*'(),", c) != NULL))) {
I thought about this but think its too confusing, and all that negativity
was getting me down.
> After that, if we (or someone) think(s) that the style is wrong
I think the code could use a fairly major rethink. For example, even with
my change we get
ORIG: http://www.netbsd.org/
HTTP: http%3a%2f%2fwww.netbsd.org%2f
Which I'm not sure is right.. and for example then in this
ORIG: http://www.netbsd.org/~plunky/Some File
HTTP: http%3a%2f%2fwww.netbsd.org%2f%7eplunky%2fSome%20File
I think only the space and tilde properly needed to be encoded. I'm
lacking in time until after new year though and I'm not sure if the URL
needs to be parsed or just have the number of exceptions increased.
My overall thought is that an URL should be able to be passed through
vis() and copy-pasted to the address bar in a browser or shell commandline
for wget or ftp. The VIS_HTTPSTYLE came from FreeBSD originally though so
I guess the original design intention needs to be discovered..
iain
Home |
Main Index |
Thread Index |
Old Index