aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/curl/lib
diff options
context:
space:
mode:
authorthegeorg <thegeorg@yandex-team.com>2022-09-15 12:50:39 +0300
committerthegeorg <thegeorg@yandex-team.com>2022-09-15 12:50:39 +0300
commit239edf05410a4716215db2bf9a0027c05b5d8126 (patch)
tree9275e8632007661f1897e73bb8ace977d4e1586a /contrib/libs/curl/lib
parent883652acb26e399a42efb42c90d38480af15cee2 (diff)
downloadydb-239edf05410a4716215db2bf9a0027c05b5d8126.tar.gz
curl + nghttp2: Backport PRs to make ltws validation less picky
This is backport of: * curl [PR #9448](https://github.com/curl/curl/pull/9448) * nghttp2 [PR #1792](https://github.com/nghttp2/nghttp2/pull/1792)
Diffstat (limited to 'contrib/libs/curl/lib')
-rw-r--r--contrib/libs/curl/lib/http2.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/contrib/libs/curl/lib/http2.c b/contrib/libs/curl/lib/http2.c
index f6364d0e022..3a70528e4ab 100644
--- a/contrib/libs/curl/lib/http2.c
+++ b/contrib/libs/curl/lib/http2.c
@@ -1277,6 +1277,27 @@ void Curl_http2_done(struct Curl_easy *data, bool premature)
}
}
+static int client_new(struct connectdata *conn,
+ nghttp2_session_callbacks *callbacks)
+{
+#if NGHTTP2_VERSION_NUM < 0x013200
+ /* before 1.50.0 */
+ return nghttp2_session_client_new(&conn->proto.httpc.h2, callbacks, conn);
+#else
+ nghttp2_option *o;
+ int rc = nghttp2_option_new(&o);
+ if(rc)
+ return rc;
+ /* turn off RFC 9113 leading and trailing white spaces validation against
+ HTTP field value. */
+ nghttp2_option_set_no_rfc9113_leading_and_trailing_ws_validation(o, 1);
+ rc = nghttp2_session_client_new2(&conn->proto.httpc.h2, callbacks, conn,
+ o);
+ nghttp2_option_del(o);
+ return rc;
+#endif
+}
+
/*
* Initialize nghttp2 for a Curl connection
*/
@@ -1317,7 +1338,7 @@ static CURLcode http2_init(struct Curl_easy *data, struct connectdata *conn)
nghttp2_session_callbacks_set_error_callback(callbacks, error_callback);
/* The nghttp2 session is not yet setup, do it */
- rc = nghttp2_session_client_new(&conn->proto.httpc.h2, callbacks, conn);
+ rc = client_new(conn, callbacks);
nghttp2_session_callbacks_del(callbacks);