Hi Robert, On Tue, Feb 27, 2018 at 08:26:01PM +0000, Robert Samuel Newson wrote: > Hi, > > I use haproxy (1.8.4) with http/2 support in front of a server that speaks > http 1.1. This is working great with one exception. Several http/2 client > libraries are sending PUT requests without sending the Content-Length header > (as it' not strictly needed due to the framing).
At first I thought this was not valid but in fact it obviously is since it is the equivalent of chunked encoding for HTTP/1. Interestingly, just like chunked uploads are not much documented in the HTTP/1 specs, this frame-only transfer is never mentionned in the HTTP/2 spec and I totally overlooked it. > The http 1.1 request issued > to the backend is therefore malformed as the header is required there. > > I think the right thing here is for haproxy to convert the PUT to a chunked > transfer request to the backend. Yes I think so as well. It will be a bit tricky though. From what I'm imagining, we'll have to add "Transfer-encoding: chunked" if the HEADERS frame doesn't carry the END_STREAM flag and there is no Content-length header, then all DATA frames will have to be prefixed with a chunk size and the frame carrying the ES flag will have to cause the final empty chunk to be sent. This one will be a bit delicate I think, as we don't want to lose it if the output buffer is full and we want not to miss the event. Also we must not do this for the CONNECT method! I'm adding this to the todo list of fixes for H2. I don't promise to have it by 1.8.5 though, but I'll try. Thanks! Willy