Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot http2的spring boot netty服务器导致413_Spring Boot_Http2 - Fatal编程技术网

Spring boot http2的spring boot netty服务器导致413

Spring boot http2的spring boot netty服务器导致413,spring-boot,http2,Spring Boot,Http2,SpringBoot2.2,使用默认netty作为服务器的curl--http2,对于具有数据体的任何方法,服务器对大型实体作出413响应,即使主体只是{“A”:“B”}。虽然我在没有身体的情况下试过,但效果很好。这是虫子吗 $ curl --http2 -X POST -v http://172.27.12.61:8889/a \ > -H 'content-type: application/json' \ > -d '{ > "A": "B" > } &

SpringBoot2.2,使用默认netty作为服务器的
curl--http2
,对于具有数据体的任何方法,服务器对大型实体作出413响应,即使主体只是
{“A”:“B”}
。虽然我在没有身体的情况下试过,但效果很好。这是虫子吗

$ curl --http2 -X POST -v http://172.27.12.61:8889/a \
>   -H 'content-type: application/json' \
>   -d '{
>   "A": "B"
> }
> '
Note: Unnecessary use of -X or --request, POST is already inferred.
* timeout on name lookup is not supported
*   Trying 172.27.12.61...
* TCP_NODELAY set
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 172.27.12.61 (172.27.12.61) port 8889 (#0)
> POST /a HTTP/1.1
> Host: 172.27.12.61:8889
> User-Agent: curl/7.51.0
> Accept: */*
> Connection: Upgrade, HTTP2-Settings
> Upgrade: h2c
> HTTP2-Settings: AAMAAABkAAQAAP__
> content-type: application/json
> Content-Length: 15
>
} [15 bytes data]
* upload completely sent off: 15 out of 15 bytes
< HTTP/1.1 413 Request Entity Too Large
< content-length: 0
<
* Curl_http_done: called premature == 0
100    15    0     0  100    15      0    483 --:--:-- --:--:-- --:--:--   483
* Connection #0 to host 172.27.12.61 left intact
$curl--http2-X POST-vhttp://172.27.12.61:8889/a \
>-H“内容类型:应用程序/json”\
>-d'{
>“A”:“B”
> }
> '
注意:不必要地使用-X或--request,POST已经推断出来。
*不支持名称查找超时
*正在尝试172.27.12.61。。。
*TCP_节点集
%总接收百分比%x平均速度时间电流
数据加载上载总左速度
0 0 0 0 0 0 0--:-:-:-:---:-:---0*已连接到172.27.12.61(172.27.12.61)端口8889(#0)
>POST/a HTTP/1.1
>主持人:172.27.12.61:8889
>用户代理:curl/7.51.0
>接受:*/*
>连接:升级,HTTP2设置
>升级:h2c
>HTTP2设置:aamaabkaaqaap__
>内容类型:application/json
>内容长度:15
>
}[15字节数据]
*完全发送上传:15个字节中的15个
因为您指定了
http
方案(而不是
https
),并要求
curl
使用http/2,那么
curl
将尝试执行http/1.1升级到http/2,从日志中可以看出

典型的HTTP/1.1升级是使用
GET
,而不是
POST
,尤其是对WebSocket的HTTP/1.1升级

服务器似乎不准备接受带有正文的
帖子作为升级尝试,并以413回复,因为它不希望有正文

如果您尝试不带主体的
GET
,则可能会成功

或者,如果您知道端口8889接受先前的明文HTTP/2(即,您可以直接向该端口发送HTTP/2字节,而无需执行HTTP/1.1升级),则可以尝试:

curl--http2先验知识-X POSThttp://172.27.12.61:8889/a …


如果您使用
https
方案,HTTP/2协议将通过ALPN协商,并且不会进行HTTP/1.1升级,很可能会继承您的
POST
请求。

是的,我认为这是服务器错误。