Skip to content

Commit

Permalink
http2: by default turn off RFC9113 LTWS validation
Browse files Browse the repository at this point in the history
  • Loading branch information
pracj3am committed Jun 22, 2023
1 parent fb84214 commit 30ab865
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AS_IF([test "${with_ssl} ${with_http2}" == "check check"], [
AC_CHECK_LIB([nghttp2], [nghttp2_session_client_new], [
LIBS="-lnghttp2 $LIBS"
AC_DEFINE([HAVE_LIBNGHTTP2], [1], [Define if you have the nghttp2 library (-lnghttp2).])
AC_CHECK_FUNCS([nghttp2_http2_strerror nghttp2_session_callbacks_set_error_callback])
AC_CHECK_FUNCS([nghttp2_http2_strerror nghttp2_session_callbacks_set_error_callback nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation])
AC_CHECK_DECLS([NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL],
[], [], [[#include <nghttp2/nghttp2.h>]])
],
Expand Down
10 changes: 9 additions & 1 deletion src/crawler.c
Original file line number Diff line number Diff line change
Expand Up @@ -1133,8 +1133,16 @@ static int http2_create_session(mcrawler_url *u) {
memset(session_data, 0, sizeof(http2_session_data));
u->http2_session = session_data;

nghttp2_session_client_new(&session_data->session, callbacks, u);
// options
nghttp2_option *option;
nghttp2_option_new(&option);
#ifdef HAVE_NGHTTP2_OPTION_SET_NO_RFC9113_LEADING_AND_TRAILING_WS_VALIDATION
nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation(option, 1);
#endif

nghttp2_session_client_new2(&session_data->session, callbacks, u, option);
nghttp2_session_callbacks_del(callbacks);
nghttp2_option_del(option);

// TCP NODELAY
int val = 1;
Expand Down

0 comments on commit 30ab865

Please sign in to comment.