Add padding if payload length is zero
This commit is contained in:
parent
68b5ffc1dc
commit
5b58b4ace5
|
@ -669,7 +669,8 @@ ssize_t nghttp2_frame_add_pad(uint8_t **buf_ptr, size_t *buflen_ptr,
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
size_t nextlen =
|
size_t nextlen =
|
||||||
nghttp2_min((payloadlen + boundary - 1) / boundary * boundary,
|
nghttp2_min(((payloadlen == 0 ? 1 : payloadlen) + boundary - 1)
|
||||||
|
/ boundary * boundary,
|
||||||
payloadmax);
|
payloadmax);
|
||||||
size_t padlen = nextlen - payloadlen;
|
size_t padlen = nextlen - payloadlen;
|
||||||
size_t trail_padlen = 0;
|
size_t trail_padlen = 0;
|
||||||
|
|
|
@ -4227,8 +4227,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
|
||||||
frame->hd.flags &= ~(NGHTTP2_FLAG_PAD_HIGH | NGHTTP2_FLAG_PAD_LOW);
|
frame->hd.flags &= ~(NGHTTP2_FLAG_PAD_HIGH | NGHTTP2_FLAG_PAD_LOW);
|
||||||
flags = 0;
|
flags = 0;
|
||||||
|
|
||||||
if(session->padding_boundary &&
|
if(session->padding_boundary && (size_t)payloadlen < datamax) {
|
||||||
payloadlen > 0 && (size_t)payloadlen < datamax) {
|
|
||||||
rv = nghttp2_frame_add_pad(buf_ptr, buflen_ptr, bufoff_ptr,
|
rv = nghttp2_frame_add_pad(buf_ptr, buflen_ptr, bufoff_ptr,
|
||||||
&flags, payloadlen, datamax,
|
&flags, payloadlen, datamax,
|
||||||
session->padding_boundary);
|
session->padding_boundary);
|
||||||
|
|
Loading…
Reference in New Issue