summerwind / h2spec

A conformance testing tool for HTTP/2 implementation.
MIT License
661 stars 73 forks source link

Allow RST_STREAM with code=0 for last 5.1 test #68

Closed daurnimator closed 7 years ago

daurnimator commented 7 years ago
  5.1. Stream States
    ✓ idle: Sends a DATA frame
    ✓ idle: Sends a RST_STREAM frame
    ✓ idle: Sends a WINDOW_UPDATE frame
    ✓ idle: Sends a CONTINUATION frame
    ✓ half closed (remote): Sends a DATA frame
    ✓ half closed (remote): Sends a HEADERS frame
    ✓ half closed (remote): Sends a CONTINUATION frame
    × closed: Sends a CONTINUATION frame
      - The endpoint MUST treat this as a stream error (Section 5.4.2) of type STREAM_CLOSED.
        Expected: GOAWAY frame (ErrorCode: STREAM_CLOSED)
                  RST_STREAM frame (ErrorCode: STREAM_CLOSED)
                  GOAWAY frame (ErrorCode: PROTOCOL_ERROR)
                  RST_STREAM frame (ErrorCode: PROTOCOL_ERROR)
                  Connection close
          Actual: RST_STREAM frame (Length: 4, Flags: 0, ErrorCode: NO_ERROR)

My server's endpoint sends RST_STREAM with code=0 (as it doesn't want to read the body) before the incorrect/unexpected CONTINUATION frame comes through.

debug logs:

WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=0;state="idle";parent=nil;dependees={}}  SETTING Flags=0
HANDLING    http.h2_connection{type="server"}   SETTING Flags=0 StreamID=0
WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=0;state="idle";parent=nil;dependees={}}  SETTING Flags=1
HANDLING    http.h2_connection{type="server"}   SETTING Flags=1 StreamID=0
HANDLING    http.h2_connection{type="server"}   HEADERS Flags=1 StreamID=1
HANDLING    http.h2_connection{type="server"}   CONTINUATION    Flags=4 StreamID=1
[16/Dec/2016:19:23:22 +1100] "GET / HTTP/2"  "-" "-"
WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=1;state="open";parent=0;dependees={}}    HEADERS Flags=4
WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=1;state="open";parent=0;dependees={}}    DATA    FLAGS=1
WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=1;state="half closed (local)";parent=0;dependees={}} RST_STREAM  Flags=0
HANDLING    http.h2_connection{type="server"}   CONTINUATION    Flags=4 StreamID=1
WRITE   http.h2_stream{connection=http.h2_connection{type="server"};id=0;state="idle";parent=nil;dependees={1}} GOAWAY  Flags=0
get_next_incoming_stream on http.h2_connection{type="server"} failed: PROTOCOL_ERROR(0x1): Protocol error detected: 'CONTINUATION' frames MUST be preceded by a 'HEADERS', 'PUSH_PROMISE' or 'CONTINUATION' frame without the 'END_HEADERS' flag set

stack traceback:
    ./http/h2_stream.lua:936: in local 'handler'
    ./http/h2_connection.lua:214: in upvalue 'handle_frame'
    ./http/h2_connection.lua:254: in method 'step'
    ./http/h2_connection.lua:367: in method 'get_next_incoming_stream'
    ./http/server.lua:147: in function <./http/server.lua:127>

I think h2spec should skip through the RST_STREAM?

summerwind commented 7 years ago

Sorry for my delayed reply. As you said, h2spec should skip through the RST_STREAM. I'm going to fix this on the next version.

daurnimator commented 7 years ago

I think this was fixed with ba9081ea08ed52f6c58e94d27e7343bde2c9838f?

summerwind commented 7 years ago

I belive so! Please let me know if you still have the problem.