Subject: Re: links-gui eat whitespace at end of pasted URL patch
To: Ignatios Souvatzis <is@netbsd.org>
From: Thomas Klausner <wiz@NetBSD.org>
List: tech-pkg
Date: 12/02/2004 13:36:37
On Wed, Dec 01, 2004 at 04:09:03PM +0100, Ignatios Souvatzis wrote:
> the enclosed patch will eat up surrounding whitespace in pasted
> URLs ... should this become official?
> $NetBSD$
>
> --- session.c.orig Mon Nov 29 22:45:13 2004
> +++ session.c Mon Nov 29 22:45:15 2004
> @@ -1948,6 +1948,17 @@
> /* this doesn't send referer */
> void goto_url(struct session *ses, unsigned char *url)
> {
> + unsigned char *p;
> +
> + while (*url && isspace(*url)) {
> + url++;
> + }
> + p = url;
> + while (*p && !isspace(*p)) {
> + p++;
> + }
> + *p = 0;
> +
> goto_url_f(ses, NULL, url, NULL, NULL, -1, 0, 1, 0);
> }
>
The second part looks wrong; p should start from the right
end of the string and work backwards. Spaces inside a URL
are ok AFAIK (though they should be quoted before being
sent to the web server).
Thomas