From 83cc2511e33ef3bd486261454030c038b10852cc Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 17 Nov 2015 21:29:21 +0900 Subject: [PATCH] Remove flags parameter from nghttp2_pack_extension_callback It has no usecase at the moment. It is most likely that applications know the flags when it submitted extension frame, no need to modify it later. Possibly feature bloat. --- lib/includes/nghttp2/nghttp2.h | 11 ++++------- lib/nghttp2_session.c | 7 ++----- tests/nghttp2_session_test.c | 3 +-- 3 files changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 926d730d..09e2dba5 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -1747,11 +1747,9 @@ typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session, * extension payload in its wire format. The frame header will be * packed by library. Application must pack payload only. * frame->ext.payload is the object passed to - * `nghttp2_submit_extension()` as payload parameter. The |*flags| is - * initialized to the flags parameter passed in - * `nghttp2_submit_extension()`. Application can modify flags value - * if it wants. Application must pack extension payload to the |buf| - * of its capacity |len| bytes. + * `nghttp2_submit_extension()` as payload parameter. Application + * must pack extension payload to the |buf| of its capacity |len| + * bytes. * * The implementation of this function returns the number of bytes * written into |buf| when it succeeds. @@ -1770,8 +1768,7 @@ typedef int (*nghttp2_unpack_extension_callback)(nghttp2_session *session, * :enum:`NGHTTP2_ERR_CALLBACK_FAILURE`. */ typedef ssize_t (*nghttp2_pack_extension_callback)(nghttp2_session *session, - uint8_t *flags, uint8_t *buf, - size_t len, + uint8_t *buf, size_t len, const nghttp2_frame *frame, void *user_data); diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 9c6d34ac..84f90a5b 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -1738,19 +1738,17 @@ static size_t session_estimate_headers_payload(nghttp2_session *session, static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs, nghttp2_frame *frame) { ssize_t rv; - uint8_t flags; nghttp2_buf *buf; size_t buflen; size_t framelen; assert(session->callbacks.pack_extension_callback); - flags = frame->hd.flags; buf = &bufs->head->buf; buflen = nghttp2_min(nghttp2_buf_avail(buf), NGHTTP2_MAX_PAYLOADLEN); - rv = session->callbacks.pack_extension_callback( - session, &flags, buf->last, buflen, frame, session->user_data); + rv = session->callbacks.pack_extension_callback(session, buf->last, buflen, + frame, session->user_data); if (rv == NGHTTP2_ERR_CANCEL) { return (int)rv; } @@ -1761,7 +1759,6 @@ static int session_pack_extension(nghttp2_session *session, nghttp2_bufs *bufs, framelen = (size_t)rv; - frame->hd.flags = flags; frame->hd.length = framelen; assert(buf->pos == buf->last); diff --git a/tests/nghttp2_session_test.c b/tests/nghttp2_session_test.c index dcde6d93..86c9e711 100644 --- a/tests/nghttp2_session_test.c +++ b/tests/nghttp2_session_test.c @@ -435,8 +435,7 @@ static int on_stream_close_callback(nghttp2_session *session _U_, } static ssize_t pack_extension_callback(nghttp2_session *session _U_, - uint8_t *flags _U_, uint8_t *buf, - size_t len _U_, + uint8_t *buf, size_t len _U_, const nghttp2_frame *frame, void *user_data _U_) { nghttp2_buf *p = frame->ext.payload;