diff --git a/lib/nghttp2_option.c b/lib/nghttp2_option.c index 2201ec6e..fd665112 100644 --- a/lib/nghttp2_option.c +++ b/lib/nghttp2_option.c @@ -70,6 +70,6 @@ void nghttp2_option_set_user_recv_extension_type(nghttp2_option *option, } option->opt_set_mask |= NGHTTP2_OPT_USER_RECV_EXT_TYPES; - option->user_recv_ext_types[type / 8] = (uint8_t)( - option->user_recv_ext_types[type / 8] | (1 << (7 - (type & 0x7)))); + option->user_recv_ext_types[type / 8] = + (uint8_t)(option->user_recv_ext_types[type / 8] | (1 << (type & 0x7))); } diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index 6be3c631..6f3843c8 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -5345,7 +5345,7 @@ ssize_t nghttp2_session_mem_recv(nghttp2_session *session, const uint8_t *in, if (!session->callbacks.unpack_extension_callback || (session->user_recv_ext_types[iframe->frame.hd.type / 8] & - (1 << (7 - (iframe->frame.hd.type & 0x7)))) == 0) { + (1 << (iframe->frame.hd.type & 0x7))) == 0) { /* Silently ignore unknown frame type. */ busy = 1; diff --git a/lib/nghttp2_session.h b/lib/nghttp2_session.h index 0bf12db5..c319c15e 100644 --- a/lib/nghttp2_session.h +++ b/lib/nghttp2_session.h @@ -306,10 +306,11 @@ struct nghttp2_session { WINDOW_UPDATE is not queued. */ uint8_t window_update_queued; /* Bitfield of extension frame types that application is willing to - receive. First most significant 10 bits are standard frame types - and not used. If bit is set, it indicates that incoming frame - with that type is passed to user defined callbacks, otherwise - they are ignored. */ + receive. To designate the bit of given frame type i, use + user_recv_ext_types[i / 8] & (1 << (i & 0x7)). First 10 frame + types are standard frame types and not used in this bitfield. If + bit is set, it indicates that incoming frame with that type is + passed to user defined callbacks, otherwise they are ignored. */ uint8_t user_recv_ext_types[32]; };