How do we distinguish between a short response and a complete response for diffs and patches?
The following discussion from !200 (merged) should be addressed:
-
@nick.thomas started a discussion: (+3 comments)
How does the client distinguish between a valid response and a short response without a content-length header?
🤔
This is anywhere in the code where we don't know how many bytes will be generated by an upstream process (gitaly or a git
subprocess), and don't want to cache the whole response in memory before sending, so call w.Header().Del("Content-Length")
to active chunked transfer encoding.
If the upstream process dies partway through, how does the client know that all the chunks that should be there, are there?
They get a 200 response and a number of chunks of data. They don't know what the size of the patch/diff should be, and they don't know how many chunks they should have received.
I can't see the solution offhand in https://tools.ietf.org/html/rfc7230#section-4.1 but didn't want to lose track of this.