git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] http-push: support full URI in handle_remote_ls_ctx()

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 2, 2009, 07:26 UTC
Message-ID
<7v7i5edv7u.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1230879195-8567-1-git-send-email-catap@catap.ru>
"Kirill A. Korinskiy" <catap@catap.ru> writes:
Show 12 quoted lines
> @@ -1424,9 +1425,19 @@ static void handle_remote_ls_ctx(struct xml_ctx *ctx, int tag_closed)
>  				ls->userFunc(ls);
>  			}
>  		} else if (!strcmp(ctx->name, DAV_PROPFIND_NAME) && ctx->cdata) {
> -			ls->dentry_name = xmalloc(strlen(ctx->cdata) -
> +			char *path = ctx->cdata;
> +			if (*ctx->cdata == 'h') {
> +				path = strstr(path, "://");
> +				if (path) {
> +					path = strchr(path+3, '/');
> +				}
> +			}

Is this "://" (and +3) the only change from the previous one that has already been queued? I didn't have a problem with the old "//" one.

The check to see if it begins with 'h' bothers me much much more.

If you want to be defensively tight, you should be checking if it begins with either "http://" or "https://", the only two protocols you are prepared to handle, and nothing else, so that you won't trigger this codepath when the other end gave you "hqrt://..", on the basis that your code won't know if hqrt:// protocol works the same way as http and https.

On the other hand, if you want to be optimistically loose, expecting whatever people would implement that can be handled with the existing DAV code would behave the same way as http and https, you shouldn't be limiting yourself to an unknown protocol name that happens to begin with an 'h', only accepting "hqrt://" but not "ittp://" URLs.

Your "first byte of the protocol name must be 'h'" does not do either.
Previous: Kirill A. KorinskiyNext: Junio C Hamano
Message 6 of 7 in “handle_remote_ls_ctx can parsing href starting at http://”
  1. handle_remote_ls_ctx can parsing href starting at http://Kirill A. Korinskiy, Dec 23, 2008
  2. Junio C HamanoDec 25, 2008
  3. http-push: support full URI in handle_remote_ls_ctx()Kirill A. Korinskiy, Dec 29, 2008
  4. Mike HommeyDec 29, 2008
  5. http-push: support full URI in handle_remote_ls_ctx()Kirill A. Korinskiy, Jan 2, 2009
  6. Junio C HamanoJan 2, 2009
  7. Junio C HamanoDec 29, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.