From 5cc2ab74af486611def7bcc14105c1a0257b41de Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Fri, 18 Jul 2014 21:30:59 +0200 Subject: [PATCH] HTTP2: Update to nghttp2 lib 0.5.0 Change-Id: Ia63c066e482f633ef5096f2341d74de749422102 Reviewed-on: https://code.wireshark.org/review/3104 Reviewed-by: Evan Huus --- epan/nghttp2/nghttp2.h | 8 +++----- epan/nghttp2/nghttp2_buf.c | 5 +++-- epan/nghttp2/nghttp2_buf.h | 2 +- epan/nghttp2/nghttp2_hd.c | 12 +++++------- epan/nghttp2/nghttp2ver.h | 4 ++-- 5 files changed, 14 insertions(+), 17 deletions(-) diff --git a/epan/nghttp2/nghttp2.h b/epan/nghttp2/nghttp2.h index 0e0166529f..1ddcc8ed9c 100644 --- a/epan/nghttp2/nghttp2.h +++ b/epan/nghttp2/nghttp2.h @@ -35,7 +35,7 @@ extern "C" { #include #include -#include "nghttp2ver.h" +#include /** * @macro @@ -346,10 +346,6 @@ typedef enum { NGHTTP2_ERR_CALLBACK_FAILURE = -902 } nghttp2_error; -typedef enum { - NGHTTP2_MSG_MORE -} nghttp2_io_flag; - /** * @enum * @@ -518,6 +514,8 @@ typedef enum { */ NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE = 0x04 } nghttp2_settings_id; +/* Note: If we add SETTINGS, update the capacity of + NGHTTP2_INBOUND_NUM_IV as well */ /** * @macro diff --git a/epan/nghttp2/nghttp2_buf.c b/epan/nghttp2/nghttp2_buf.c index dcaa469514..af4af4b292 100644 --- a/epan/nghttp2/nghttp2_buf.c +++ b/epan/nghttp2/nghttp2_buf.c @@ -236,8 +236,8 @@ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs) static ssize_t bufs_avail(nghttp2_bufs *bufs) { - return (ssize_t)(nghttp2_buf_avail(&bufs->cur->buf) + - (bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used)); + return (ssize_t)nghttp2_buf_avail(&bufs->cur->buf) + + (bufs->chunk_length - bufs->offset) * (bufs->max_chunk - bufs->chunk_used); } static int bufs_alloc_chain(nghttp2_bufs *bufs) @@ -474,3 +474,4 @@ int nghttp2_bufs_next_present(nghttp2_bufs *bufs) return chain && nghttp2_buf_len(&chain->buf); } + diff --git a/epan/nghttp2/nghttp2_buf.h b/epan/nghttp2/nghttp2_buf.h index cba68790f9..1097ae6a99 100644 --- a/epan/nghttp2/nghttp2_buf.h +++ b/epan/nghttp2/nghttp2_buf.h @@ -368,4 +368,4 @@ int nghttp2_bufs_next_present(nghttp2_bufs *bufs); */ ssize_t nghttp2_bufs_len(nghttp2_bufs *bufs); -#endif /* NGHTTP2_BUF_H */ \ No newline at end of file +#endif /* NGHTTP2_BUF_H */ diff --git a/epan/nghttp2/nghttp2_hd.c b/epan/nghttp2/nghttp2_hd.c index 75410c73fb..0972037304 100644 --- a/epan/nghttp2/nghttp2_hd.c +++ b/epan/nghttp2/nghttp2_hd.c @@ -133,12 +133,6 @@ static uint32_t hash(const uint8_t *s, size_t n) return h; } -typedef struct { - nghttp2_nv *nva; - size_t nvacap; - size_t nvlen; -} nghttp2_nva_out; - int nghttp2_hd_entry_init(nghttp2_hd_entry *ent, uint8_t flags, uint8_t *name, size_t namelen, uint8_t *value, size_t valuelen) @@ -1334,6 +1328,8 @@ int nghttp2_hd_deflate_new(nghttp2_hd_deflater **deflater_ptr, rv = nghttp2_hd_deflate_init2(deflater, deflate_hd_table_bufsize_max); if(rv != 0) { + free(deflater); + return rv; } @@ -2015,7 +2011,7 @@ ssize_t nghttp2_hd_inflate_hd(nghttp2_hd_inflater *inflater, goto fail; } - return (ssize_t)(in - first); + return in - first; fail: DEBUGF(fprintf(stderr, "inflatehd: error return %zd\n", rv)); @@ -2045,6 +2041,8 @@ int nghttp2_hd_inflate_new(nghttp2_hd_inflater **inflater_ptr) rv = nghttp2_hd_inflate_init(inflater); if(rv != 0) { + free(inflater); + return rv; } diff --git a/epan/nghttp2/nghttp2ver.h b/epan/nghttp2/nghttp2ver.h index 0fe2d12caa..2218d90157 100644 --- a/epan/nghttp2/nghttp2ver.h +++ b/epan/nghttp2/nghttp2ver.h @@ -29,7 +29,7 @@ * @macro * Version number of the nghttp2 library release */ -#define NGHTTP2_VERSION "0.4.2-DEV" +#define NGHTTP2_VERSION "0.5.0" /** * @macro @@ -37,6 +37,6 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define NGHTTP2_VERSION_NUM 0x000402 +#define NGHTTP2_VERSION_NUM 0x000500 #endif /* NGHTTP2VER_H */