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

Re: [PATCH] Verify Content-Type from smart HTTP servers

From
Jeff King <peff@peff.net>
Date
Feb 4, 2013, 08:38 UTC
Message-ID
<20130204083824.GB30835@sigill.intra.peff.net>
In-Reply-To
<7va9rk5z02.fsf@alter.siamese.dyndns.org>
On Sun, Feb 03, 2013 at 11:17:33PM -0800, Junio C Hamano wrote:
Show 28 quoted lines
> Does this look good to both of you (relative to Shawn's patch)?
> 
>  remote-curl.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/remote-curl.c b/remote-curl.c
> index e6f3b63..933c69a 100644
> --- a/remote-curl.c
> +++ b/remote-curl.c
> @@ -134,14 +134,14 @@ static struct discovery* discover_refs(const char *service)
>  	last->buf_alloc = strbuf_detach(&buffer, &last->len);
>  	last->buf = last->buf_alloc;
>  
> -	if (maybe_smart && 5 <= last->len && last->buf[4] == '#') {
> +	strbuf_addf(&exp, "application/x-%s-advertisement", service);
> +	if (maybe_smart &&
> +	    (5 <= last->len && last->buf[4] == '#') &&
> +	    !strbuf_cmp(&exp, &type)) {
>  		/*
>  		 * smart HTTP response; validate that the service
>  		 * pkt-line matches our request.
>  		 */
> -		strbuf_addf(&exp, "application/x-%s-advertisement", service);
> -		if (strbuf_cmp(&exp, &type))
> -			die("invalid content-type %s", type.buf);
>  		if (packet_get_line(&buffer, &last->buf, &last->len) <= 0)
>  			die("%s has invalid packet header", refs_url);
>  		if (buffer.len && buffer.buf[buffer.len - 1] == '\n')
Yeah, I think that's fine. Thanks.
-Peff
Previous: Junio C HamanoNext: Shawn Pearce
Message 6 of 12 in “Verify Content-Type from smart HTTP servers”
  1. Verify Content-Type from smart HTTP serversJunio C Hamano, Jan 31, 2013
  2. Jeff KingFeb 1, 2013
  3. Junio C HamanoFeb 1, 2013
  4. Jeff KingFeb 1, 2013
  5. Junio C HamanoFeb 4, 2013
  6. Jeff KingFeb 4, 2013
  7. Shawn PearceFeb 4, 2013
  8. Junio C HamanoFeb 5, 2013
  9. Michael SchubertFeb 6, 2013
  10. Jeff KingFeb 6, 2013
  11. Junio C HamanoFeb 6, 2013
  12. Jeff KingFeb 6, 2013

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.