Re: [PATCH v3 9/9] fixup! remote-curl: error on incomplete packet
- From
Jeff King <peff@peff.net>
- Date
- May 22, 2020, 15:54 UTC
- Message-ID
- <20200522155410.GA2146293@coredump.intra.peff.net>
- In-Reply-To
- <4364b38bd027c219d41282bad3f8476daec936f9.1590154401.git.liu.denton@gmail.com>
On Fri, May 22, 2020 at 09:33:47AM -0400, Denton Liu wrote:
> In the CGI scripts which emulate a connection being prematurely > terminated, it doesn't make sense for there to be a trailing newline > after the simulated connection cut. Remove these newlines.
Ah, good catch. I think in the first one it doesn't matter:
> -printf "%s%s\n" "0079" "45" > +printf "%s%s" "0079" "45"
because we have a too-short packet, so the fact that it is 3 bytes and not 2 does not change that.
I agree it's clearer without the newline, though. I wonder if:
printf "0079" "fewer than 0x79 bytes"
would make it even more self-documenting. :)
> -printf "%s\n" "00" > +printf "%s" "00"
This one is a behavior improvement: we were probably hitting "oops, newline isn't a valid line-length character" before, and now we're really hitting the truncated packet.
I don't know if it's worth adding an extra test with a bogus line-length. I'm OK with with it either way.
-Peff