From d402ba6fa2c98a8ea2a46b19b4fbc3a5edcac511 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 7 Jun 2014 16:37:29 +0900 Subject: [PATCH] Make settings_id 2 bytes field --- lib/nghttp2_frame.c | 8 ++++---- lib/nghttp2_frame.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/nghttp2_frame.c b/lib/nghttp2_frame.c index 7ef34193..e6e6d655 100644 --- a/lib/nghttp2_frame.c +++ b/lib/nghttp2_frame.c @@ -513,8 +513,8 @@ size_t nghttp2_frame_pack_settings_payload(uint8_t *buf, { size_t i; for(i = 0; i < niv; ++i, buf += NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH) { - buf[0] = iv[i].settings_id; - nghttp2_put_uint32be(buf + 1, iv[i].value); + nghttp2_put_uint16be(buf, iv[i].settings_id); + nghttp2_put_uint32be(buf + 2, iv[i].value); } return NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH * niv; } @@ -544,8 +544,8 @@ int nghttp2_frame_unpack_settings_payload(nghttp2_settings *frame, void nghttp2_frame_unpack_settings_entry(nghttp2_settings_entry *iv, const uint8_t *payload) { - iv->settings_id = payload[0]; - iv->value = nghttp2_get_uint32(&payload[1]); + iv->settings_id = nghttp2_get_uint16(&payload[0]); + iv->value = nghttp2_get_uint32(&payload[2]); } int nghttp2_frame_unpack_settings_payload2(nghttp2_settings_entry **iv_ptr, diff --git a/lib/nghttp2_frame.h b/lib/nghttp2_frame.h index cf8e667a..cd9e9d27 100644 --- a/lib/nghttp2_frame.h +++ b/lib/nghttp2_frame.h @@ -55,7 +55,7 @@ #define NGHTTP2_DATA_PAYLOADLEN 4096 /* The number of bytes for each SETTINGS entry */ -#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 5 +#define NGHTTP2_FRAME_SETTINGS_ENTRY_LENGTH 6 /* The maximum header table size in SETTINGS_HEADER_TABLE_SIZE */ #define NGHTTP2_MAX_HEADER_TABLE_SIZE ((1u << 31) - 1)