Request in HTTP Upgrade is ignored
tatsuhiro-t opened this issue · 1 comments
tatsuhiro-t commented
The request in HTTP Upgrade seems to be ignored. If client send 2nd request in the upgraded connection, katana server responds only 2nd request.
The spec says the request in HTTP Upgrade is assumed as stream 1:
The HTTP/1.1 request that is sent prior to upgrade is associated with
stream 1 and is assigned the highest possible priority. Stream 1 is
implicitly half closed from the client toward the server, since the
request is completed as an HTTP/1.1 request. After commencing the
HTTP/2.0 connection, stream 1 is used for the response.
Here is log from nghttp client. In this log, I sent 2 requests http://http2katanatest.cloudapp.net:8080/ and http://http2katanatest.cloudapp.net:8080/index.html in order and first one is sent as HTTP Upgrade. As you see in the log, stream 3 was responded but stream 1 was not. nghttp client waited for the stream 1 response but there was non.
$ src/nghttp --no-tls -nuv -p1 http://http2katanatest.cloudapp.net:8080/ http://http2katanatest.cloudapp.net:8080/index.html
[ 0.321] HTTP Upgrade request
GET / HTTP/1.1
Host: http2katanatest.cloudapp.net:8080
Connection: Upgrade, HTTP2-Settings
Upgrade: HTTP-draft-04/2.0
HTTP2-Settings: AAAABAAAAGQAAAAHAAD__w
Accept: */*
User-Agent: nghttp2/0.1.0-DEV
[ 2.327] HTTP Upgrade response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: HTTP-draft-04/2.0
[ 2.327] HTTP Upgrade success
[ 2.327] send SETTINGS frame <length=16, flags=0x00, stream_id=0>
(niv=2)
[4:100]
[7:65535]
[ 2.327] send HEADERS frame <length=93, flags=0x0d, stream_id=3>
; END_STREAM | END_HEADERS | PRIORITY
(pri=1)
; Open new stream
:host: http2katanatest.cloudapp.net:8080
:method: GET
:path: /index.html
:scheme: http
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/0.1.0-DEV
[ 2.584] recv SETTINGS frame <length=8, flags=0x00, stream_id=0>
(niv=1)
[7:200000]
[ 3.349] recv HEADERS frame <length=17, flags=0x0c, stream_id=3>
; END_HEADERS | PRIORITY
(pri=3)
; First response header
:status: 200
[ 3.603] recv DATA frame (length=148, flags=1, stream_id=3)
; END_STREAM
^C
squirrelfm commented
Should be fixed now.