Add padding if payload length is zero

This commit is contained in:
Tatsuhiro Tsujikawa 2014-02-09 22:01:07 +09:00
parent 68b5ffc1dc
commit 5b58b4ace5
2 changed files with 3 additions and 3 deletions

View File

@ -669,7 +669,8 @@ ssize_t nghttp2_frame_add_pad(uint8_t **buf_ptr, size_t *buflen_ptr,
{
int rv;
size_t nextlen =
nghttp2_min((payloadlen + boundary - 1) / boundary * boundary,
nghttp2_min(((payloadlen == 0 ? 1 : payloadlen) + boundary - 1)
/ boundary * boundary,
payloadmax);
size_t padlen = nextlen - payloadlen;
size_t trail_padlen = 0;

View File

@ -4227,8 +4227,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
frame->hd.flags &= ~(NGHTTP2_FLAG_PAD_HIGH | NGHTTP2_FLAG_PAD_LOW);
flags = 0;
if(session->padding_boundary &&
payloadlen > 0 && (size_t)payloadlen < datamax) {
if(session->padding_boundary && (size_t)payloadlen < datamax) {
rv = nghttp2_frame_add_pad(buf_ptr, buflen_ptr, bufoff_ptr,
&flags, payloadlen, datamax,
session->padding_boundary);