Re: Issue with the H2 state machine

On Fri, Jul 21, 2017 at 11:03:17AM +0200, Willy Tarreau wrote:
> On Fri, Jul 21, 2017 at 11:57:20AM +0300, Ilari Liusvaara wrote:
> > On Fri, Jul 21, 2017 at 10:39:41AM +0200, Willy Tarreau wrote:
> > > On Fri, Jul 21, 2017 at 10:17:44AM +0200, Willy Tarreau wrote:
> > > 
> > > Also I think I found a typo here in 8.1 :
> > > 
> > >    An endpoint that receives a HEADERS
> > >    frame without the END_STREAM flag set after receiving a final (non-
> > >    informational) status code MUST treat the corresponding request or
> > >    response as malformed (Section 8.1.2.6).
> > > 
> > > I think it should use s/END_STREAM/END_HEADERS/ given that DATA frames
> > > are still allowed here. I can file an errata if confirmed.
> > 
> > I think it is correct, just somewhat confusing. This seem to be
> > requirement that there can be at most one header block at the very end
> > after headers that sends the final status code.
> 
> But if a DATA frame follows, the END_STREAM is on the DATA frame, not the
> headers frame. There's even exactly this example in 8.1.3 page 59. That's
> indeed a bit confusing :-/

Those examples are written in bit confusing way. In the last example,
the END_STREAM flag on the DATA frame is NOT set. However, the
END_STREAM flag on the last HEADERS frame IS set.

The last example could be written as:

HEADERS(END_HEADERS):
:status => 100
extension-field => bar

HEADERS(END_HEADERS)
:status => 200
content-length => 123
content-type => image/jpeg
trailer => Foo

DATA()
{binary data}

HEADERS(END_STREAM,END_HEADERS)
foo = bar


Also, END_STREAM in HEADERS is bit special in that if
HEADERS has END_STREAM but not END_HEADERS, then the stream
will go on a bit to receive the CONTINUATION frames until
END_HEADERS is asserted.

Example:

HEADERS(END_HEADERS):
:status => 100
extension-field => bar

HEADERS(END_HEADERS)
:status => 200
content-length => 123
content-type => image/jpeg
trailer => Foo, Zot

DATA()
{binary data}

HEADERS(END_STREAM)
foo = bar

CONTINUATION(END_HEADERS)
zot = qux

<-- The half-stream is closed here.


(But I think CONTINUATION SHOULD NOT be used...).



-Ilari

Received on Friday, 21 July 2017 09:33:55 UTC