Subject: Re: [PATCH 5/6] remote-curl: error on incomplete packet

From: Denton Liu <[email-masked]>
Date: Mon, 18 May 2020 05:08:57 -0400

Hi Peff,

On Fri, May 15, 2020 at 05:38:44PM -0400, Jeff King wrote:
> On Wed, May 13, 2020 at 02:04:57PM -0400, Denton Liu wrote:
> 
> > Currently, remote-curl acts as a proxy and blindly forwards packets
> > between an HTTP server and fetch-pack. In the case of a stateless RPC
> > connection where the connection is terminated with a partially written
> > packet, remote-curl will blindly send the partially written packet
> > before waiting on more input from fetch-pack. Meanwhile, fetch-pack will
> > read the partial packet and continue reading, expecting more input. This
> > results in a deadlock between the two processes.
> > 
> > Instead of blindly forwarding packets, inspect each packet to ensure
> > that it is a full packet, erroring out if a partial packet is sent.
> 
> Hmm. Right now there's no assumption in rpc_in that we're writing
> pktlines. Will this always be the case?
> 
> I think the answer is probably yes. If there's a case where it isn't, it
> might be something like v0 git-over-http against a server which doesn't
> have the sideband capability.

As far as I can tell from skimming the code, v0 uses always pktlines
although I'm far from being an expert on Git's networking stuff. Perhaps
we could implement this such that the line-length checking only happens
for stateless_connect()?