Warp 有一个settingsMaxTotalHeaderLength
默认为 50*1024 的字段:https ://hackage.haskell.org/package/warp-3.3.10/docs/src/Network.Wai.Handler.Warp.Settings.html#defaultSettings
我想这意味着50KB?但是,当我尝试发送一个 ~33KB 的标头时,服务器会抛出错误的请求:
curl -v -w '%{size_request} %{size_upload}' -H @temp.log localhost:8080/v1/version
结果:
* Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8080 (#0)
> GET /v1/version HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/7.58.0
> Accept: */*
> myheader2: <big header snipped>
>
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
< Date: Wed, 22 Jul 2020 13:15:19 GMT
< Server: Warp/3.3.10
< Content-Type: text/plain; charset=utf-8
<
* Closing connection 0
Bad Request33098 0
(注意请求大小为33098)
同样的事情也适用于 32.5KB 的头文件。
我真正的问题实际上是我需要设置settingsMaxTotalHeaderLength = 160000
发送大小约为 55KB 的标头。不确定这是一个错误还是我误读了什么?