"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: add messagelen "field" in notifications
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Wed, 27 Mar 2024 16:35:49 +0100

Download raw body.

Thread
On Wed, Mar 27, 2024 at 04:27:54PM +0100, Omar Polo wrote:
> On 2024/03/27 16:21:30 +0100, Stefan Sperling <stsp@stsp.name> wrote:
> > On Wed, Mar 27, 2024 at 04:16:44PM +0100, Omar Polo wrote:
> > > It's needed un-ambiguosly parsing the standard input and so helps in my
> > > wip got-notify-http.  ok?
> > 
> > ok
> 
> similarly, i'd also like to fix gotd_parse_url().  The path can have
> lenght of 1 (imagine an url of "http://localhost/" where the path is
> just "/") and we shouldn't blindly remove the trailing / from the end of
> the URL.
> 
> ok?

Sure, ok.

If I recall correctly this was inherited from got's command-line parser.
I am not sure if we want to apply the same change there. I recall it
relying on the request path being empty somehow.

> diff /home/op/w/got
> commit - fb5636bebb6e4d59f4bbc0fd78650714474ac681
> path + /home/op/w/got
> blob - b8cb49b93ee649511f7600e9a0f0644e63abffa9
> file + gotd/parse.y
> --- gotd/parse.y
> +++ gotd/parse.y
> @@ -1744,7 +1744,7 @@ gotd_parse_url(char **proto, char **host, char **port,
>  	s = p + 3;
>  
>  	p = strstr(s, "/");
> -	if (p == NULL || strlen(p) == 1) {
> +	if (p == NULL) {
>  		err = got_error(GOT_ERR_PARSE_URI);
>  		goto done;
>  	}
> @@ -1788,7 +1788,6 @@ gotd_parse_url(char **proto, char **host, char **port,
>  		err = got_error_from_errno("strdup");
>  		goto done;
>  	}
> -	got_path_strip_trailing_slashes(*request_path);
>  	if ((*request_path)[0] == '\0') {
>  		err = got_error(GOT_ERR_PARSE_URI);
>  		goto done;
> 
>