diff --git a/src/HttpServer.cc b/src/HttpServer.cc index 6a364dca..344fcfd0 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -936,7 +936,7 @@ ssize_t select_padding_callback return frame->hd.length; } if(frame->hd.length == 0) { - return bd; + return std::min(max_payload, bd); } return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd); } diff --git a/src/nghttp.cc b/src/nghttp.cc index 25bec8cf..573b3672 100644 --- a/src/nghttp.cc +++ b/src/nghttp.cc @@ -1136,7 +1136,7 @@ ssize_t select_padding_callback return frame->hd.length; } if(frame->hd.length == 0) { - return bd; + return std::min(max_payload, bd); } return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd); } diff --git a/src/shrpx_http.cc b/src/shrpx_http.cc index 8f5e9dd5..0c1db266 100644 --- a/src/shrpx_http.cc +++ b/src/shrpx_http.cc @@ -100,7 +100,7 @@ ssize_t select_padding_callback { auto bd = get_config()->padding; if(frame->hd.length == 0) { - return bd; + return std::min(max_payload, bd); } return std::min(max_payload, (frame->hd.length + bd - 1) / bd * bd); }