对基于netty(版本:4.1.31.Final)的服务器的http2请求的结果:
nghttp -v -n -H "http-rpc-type: JsonContent" -H "content-type: application/improved-json" -d 128k.json http://127.0.0.1:12220/com.arthur.HelloService/1.0.0/sayHello
[ 0.002] Connected
[ 0.002] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.002] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 0.002] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 0.002] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 0.002] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 0.002] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 0.002] send HEADERS frame <length=126, flags=0x24, stream_id=13>
; END_HEADERS | PRIORITY
(padlen=0, dep_stream_id=11, weight=16, exclusive=0)
; Open new stream
:method: POST
:path: /com.alibaba.arthur.hsf.HelloService/1.0.0/sayHello
:scheme: http
:authority: 127.0.0.1:12220
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/1.32.0
content-length: 393564
http-rpc-type: JsonContent
content-type: application/improved-json
[ 0.002] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.002] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.002] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.003] send DATA frame <length=16383, flags=0x00, stream_id=13>
[ 10.006] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=SETTINGS_TIMEOUT(0x04), opaque_data(0)=[])
Some requests were not processed. total=1, processed=0
对nghttp服务器的请求结果如下,我们可以看到,数据完全以带有END_STREAM标志的数据帧结尾发送。正常过程具有WINDOW_UPDATE框架,因此我猜netty http2服务器存在一些问题。
[ 0.007] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=32767)
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=13>
(window_size_increment=32767)
[ 0.007] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.007] send DATA frame <length=16383, flags=0x00, stream_id=13>
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=32768)
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=13>
(window_size_increment=32768)
[ 0.007] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.007] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=32767)
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=13>
(window_size_increment=32767)
[ 0.007] send DATA frame <length=16384, flags=0x00, stream_id=13>
[ 0.007] send DATA frame <length=16383, flags=0x00, stream_id=13>
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=32768)
[ 0.007] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=13>
(window_size_increment=32768)
[ 0.007] send DATA frame <length=354, flags=0x01, stream_id=13>
; END_STREAM