http-extensions
http-extensions copied to clipboard
Speak about considerations of byte counting and transfer-encoding
Ted Hardie asked:
How does the upload offset calculation interact with transfer encoding/compression? I'm reporting how many bytes came through the network, is that right?
We probably would benefit from some consideration text to mention how HTTP/1.1 transfer-encoding might be a footgun if the server counted those bytes naiively.
I agree, we should clarify this. I was also confused about the exact behavior until you helped me clear it up. Is the following summary correct?
- From a client's perspective, the offset is counted after Content-Encoding is applied but before Transfer-Encoding is applied.
- From a server's perspective, the offset is counted after the message is decoded using Transfer-Encoding but before decoding using Content-Encoding.
To add to Marius' list above: Can the server do anything about a request where only part of a message with transfer-encoding arrives? E.g. a partial message with transfer-encoding: gzip might not be possible to decode.
HTTP/1.1 Transfer-Encoding
is a hop-by-hop header at an HTTP protocol layer and should be ignored by application frameworks such as resumable upload.