Re: [PATCH 2/3] remote-curl: verify smart-http metadata lines

2013-02-18 Thread Jeff King
On Sun, Feb 17, 2013 at 04:54:43PM -0800, Jonathan Nieder wrote: > > My intent was that it followed the error convention of "negative is > > error, 0 is success, and positive is not used, but reserved for > > future use". > > From a maintainability perspective, that kind of contract would be > da

Re: [PATCH 2/3] remote-curl: verify smart-http metadata lines

2013-02-17 Thread Jonathan Nieder
Jeff King wrote: > On Sun, Feb 17, 2013 at 02:49:39AM -0800, Jonathan Nieder wrote: >> Jeff King wrote: >>> --- a/remote-curl.c [...] >>> + 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()

Re: [PATCH 2/3] remote-curl: verify smart-http metadata lines

2013-02-17 Thread Jeff King
On Sun, Feb 17, 2013 at 02:49:39AM -0800, Jonathan Nieder wrote: > 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); > > - w

Re: [PATCH 2/3] remote-curl: verify smart-http metadata lines

2013-02-17 Thread Jonathan Nieder
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) > -

[PATCH 2/3] remote-curl: verify smart-http metadata lines

2013-02-15 Thread Jeff King
A smart http ref advertisement starts with a packet containing the service header, followed by an arbitrary number of packets containing other metadata headers, followed by a flush packet. We don't currently recognize any other metadata headers, so we just parse through any extra packets, throwing