From: Jonathan Nieder Date: Sun, 17 Feb 2013 10:49:39 GMT Subject: Re: [PATCH 2/3] remote-curl: verify smart-http metadata lines Message-ID: <20130217104939.GE6759@elie.Belkin> In-Reply-To: <20130216064707.GB22626@sigill.intra.peff.net> Jeff King wrote: > --- a/remote-curl.c > +++ b/remote-curl.c [...] > @@ -155,11 +166,13 @@ static struct discovery* discover_refs(const char *service) [...] > - strbuf_reset(&buffer); > - while (packet_get_line(&buffer, &last->buf, &last->len) > 0) > - strbuf_reset(&buffer); > + if (read_packets_until_flush(&last->buf, &last->len) < 0) Style nit: this made me wonder "What would it mean if read_packets_until_flush() > 0?" Since the convention for this function is "0 for success", I would personally find if (read_packets_until_flush(...)) handle error; easier to read. > + die("smart-http metadata lines are invalid at %s", > + refs_url); Especially given that other clients would be likely to run into trouble in the same situation, as long as this cooks in "next" for a suitable amount of time to catch bad servers, it looks like a good idea. Reviewed-by: Jonathan Nieder Thanks.