diff --git a/doc/Makefile.am b/doc/Makefile.am index 7c03bb2d..07cd34e8 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -143,6 +143,7 @@ APIDOCS= \ nghttp2_session_set_local_window_size.rst \ nghttp2_session_set_next_stream_id.rst \ nghttp2_session_set_stream_user_data.rst \ + nghttp2_session_set_user_data.rst \ nghttp2_session_terminate_session.rst \ nghttp2_session_terminate_session2.rst \ nghttp2_session_upgrade.rst \ diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 13cda9f2..14f8950b 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -3081,6 +3081,16 @@ NGHTTP2_EXTERN int nghttp2_session_set_stream_user_data(nghttp2_session *session, int32_t stream_id, void *stream_user_data); +/** + * @function + * + * Sets |user_data| to |session|, overwriting the existing user data + * specified in `nghttp2_session_client_new()`, or + * `nghttp2_session_server_new()`. + */ +NGHTTP2_EXTERN void nghttp2_session_set_user_data(nghttp2_session *session, + void *user_data); + /** * @function * diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index c4bbf274..c58f059b 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -7521,3 +7521,7 @@ size_t nghttp2_session_get_hd_deflate_dynamic_table_size(nghttp2_session *session) { return nghttp2_hd_deflate_get_dynamic_table_size(&session->hd_deflater); } + +void nghttp2_session_set_user_data(nghttp2_session *session, void *user_data) { + session->user_data = user_data; +}