From 1723912f35a5c7f4fcf335d5b658c2759a468d10 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 3 Sep 2013 21:41:22 +0900 Subject: [PATCH] Call nghttp2_hd_end_headers from nghttp2_hd_deflate_hd --- lib/nghttp2_hd.c | 1 + lib/nghttp2_hd.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/lib/nghttp2_hd.c b/lib/nghttp2_hd.c index cb84a799..723109f3 100644 --- a/lib/nghttp2_hd.c +++ b/lib/nghttp2_hd.c @@ -874,6 +874,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater, nghttp2_hd_entry *ent = deflater->hd_table[i]; ent->flags &= ~(NGHTTP2_HD_FLAG_EMIT | NGHTTP2_HD_FLAG_IMPLICIT_EMIT); } + nghttp2_hd_end_headers(deflater); return offset - nv_offset; fail: deflater->bad = 1; diff --git a/lib/nghttp2_hd.h b/lib/nghttp2_hd.h index 120c1c0e..a67acc0f 100644 --- a/lib/nghttp2_hd.h +++ b/lib/nghttp2_hd.h @@ -164,6 +164,14 @@ void nghttp2_hd_inflate_free(nghttp2_hd_context *inflater); * |*buf_ptr| may change. |*buf_ptr| and |*buflen_ptr| are updated * accordingly. * + * This function copies necessary data into |*buf_ptr|. After this + * function returns, it is safe to delete the |nva|. + * + * TODO: The rest of the code call nghttp2_hd_end_headers() after this + * call, but it is just a regacy of the first implementation. Now it + * is called in this function and the caller does not need to call it + * by itself. + * * This function returns the number of bytes outputted if it succeeds, * or one of the following negative error codes: * @@ -183,6 +191,12 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater, * result on successful decompression. The caller must free |*nva_ptr| * using nghttp2_nv_array_del(). * + * The |*nva_ptr| includes pointers to the memory region in the + * |in|. The caller must retain the |in| while the |*nva_ptr| is + * used. After the use of |*nva_ptr| is over, if the caller intends to + * inflate another set of headers, the caller must call + * nghttp2_hd_end_headers(). + * * This function returns the number of name/value pairs in |*nva_ptr| * if it succeeds, or one of the following negative error codes: *