diff options
author | robot-contrib <robot-contrib@yandex-team.com> | 2024-02-05 10:21:46 +0300 |
---|---|---|
committer | robot-contrib <robot-contrib@yandex-team.com> | 2024-02-05 10:43:47 +0300 |
commit | 772991a84caf0d42202e61c963ca4ffac914dd66 (patch) | |
tree | d2c7807dfe002811e19a0c78353d4ab1444f6ac5 | |
parent | 90c89e699ce3780528788a4539ff3ae2284e8614 (diff) | |
download | ydb-772991a84caf0d42202e61c963ca4ffac914dd66.tar.gz |
Update contrib/libs/nghttp2 to 1.59.0
-rw-r--r-- | contrib/libs/nghttp2/AUTHORS | 3 | ||||
-rw-r--r-- | contrib/libs/nghttp2/README.rst | 49 | ||||
-rw-r--r-- | contrib/libs/nghttp2/config.h | 25 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h | 137 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2ver.h | 4 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/nghttp2_alpn.c (renamed from contrib/libs/nghttp2/lib/nghttp2_npn.c) | 29 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/nghttp2_alpn.h (renamed from contrib/libs/nghttp2/lib/nghttp2_npn.h) | 6 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/nghttp2_extpri.c | 6 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/nghttp2_session.c | 29 | ||||
-rw-r--r-- | contrib/libs/nghttp2/lib/nghttp2_time.c | 19 | ||||
-rw-r--r-- | contrib/libs/nghttp2/ya.make | 6 |
11 files changed, 234 insertions, 79 deletions
diff --git a/contrib/libs/nghttp2/AUTHORS b/contrib/libs/nghttp2/AUTHORS index bb1ae74f12..c5c5eb5b2f 100644 --- a/contrib/libs/nghttp2/AUTHORS +++ b/contrib/libs/nghttp2/AUTHORS @@ -29,10 +29,12 @@ Andy Davies Angus Gratton Anna Henningsen Ant Bryan +Anthony Alayo Asra Ali Benedikt Christoph Wolters Benjamin Peterson Bernard Spil +Bernhard Walle Brendan Heinonen Brian Card Brian Suh @@ -143,6 +145,7 @@ dalf dawg es fangdingjun +hrxi jwchoi kumagi lhuang04 diff --git a/contrib/libs/nghttp2/README.rst b/contrib/libs/nghttp2/README.rst index 1934341bff..2af1bcca5d 100644 --- a/contrib/libs/nghttp2/README.rst +++ b/contrib/libs/nghttp2/README.rst @@ -29,10 +29,10 @@ Public Test Server The following endpoints are available to try out our nghttp2 implementation. -* https://nghttp2.org/ (TLS + ALPN/NPN and HTTP/3) +* https://nghttp2.org/ (TLS + ALPN and HTTP/3) This endpoint supports ``h2``, ``h2-16``, ``h2-14``, and - ``http/1.1`` via ALPN/NPN and requires TLSv1.2 for HTTP/2 + ``http/1.1`` via ALPN and requires TLSv1.2 for HTTP/2 connection. It also supports HTTP/3. @@ -66,15 +66,12 @@ To build and run the application programs (``nghttp``, ``nghttpd``, ``nghttpx`` and ``h2load``) in the ``src`` directory, the following packages are required: -* OpenSSL >= 1.0.1 +* OpenSSL >= 1.1.1; or LibreSSL >= 3.8.1; or aws-lc >= 1.19.0; or + BoringSSL * libev >= 4.11 * zlib >= 1.2.3 * libc-ares >= 1.7.5 -ALPN support requires OpenSSL >= 1.0.2 (released 22 January 2015). -LibreSSL >= 2.2.0 can be used instead of OpenSSL, but OpenSSL has more -features than LibreSSL at the time of this writing. - To enable ``-a`` option (getting linked assets from the downloaded resource) in ``nghttp``, the following package is required: @@ -106,7 +103,7 @@ To mitigate heap fragmentation in long running server programs To enable mruby support for nghttpx, `mruby <https://github.com/mruby/mruby>`_ is required. We need to build mruby with C++ ABI explicitly turned on, and probably need other -mrgems, mruby is manged by git submodule under third-party/mruby +mrgems, mruby is managed by git submodule under third-party/mruby directory. Currently, mruby support for nghttpx is disabled by default. To enable mruby support, use ``--with-mruby`` configure option. Note that at the time of this writing, libmruby-dev and mruby @@ -118,20 +115,21 @@ required: * bison nghttpx supports `neverbleed <https://github.com/h2o/neverbleed>`_, -privilege separation engine for OpenSSL / LibreSSL. In short, it -minimizes the risk of private key leakage when serious bug like -Heartbleed is exploited. The neverbleed is disabled by default. To -enable it, use ``--with-neverbleed`` configure option. +privilege separation engine for OpenSSL. In short, it minimizes the +risk of private key leakage when serious bug like Heartbleed is +exploited. The neverbleed is disabled by default. To enable it, use +``--with-neverbleed`` configure option. To enable the experimental HTTP/3 support for h2load and nghttpx, the following libraries are required: * `OpenSSL with QUIC support <https://github.com/quictls/openssl/tree/OpenSSL_1_1_1w+quic>`_; or + LibreSSL (does not support 0RTT); or aws-lc; or `BoringSSL <https://boringssl.googlesource.com/boringssl/>`_ (commit - 6ca49385b168f47a50e7172d82a590b218f55e4d) + f42be90d665b6a376177648ccbb76fbbd6497c13) * `ngtcp2 <https://github.com/ngtcp2/ngtcp2>`_ >= 1.0.0 -* `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ >= 1.0.0 +* `nghttp3 <https://github.com/ngtcp2/nghttp3>`_ >= 1.1.0 Use ``--enable-http3`` configure option to enable HTTP/3 feature for h2load and nghttpx. @@ -146,7 +144,7 @@ Use ``--with-libbpf`` configure option to build eBPF program. libelf-dev is needed to build libbpf. For Ubuntu 20.04, you can build libbpf from `the source code -<https://github.com/libbpf/libbpf/releases/tag/v1.2.2>`_. nghttpx +<https://github.com/libbpf/libbpf/releases/tag/v1.3.0>`_. nghttpx requires eBPF program for reloading its configuration and hot swapping its executable. @@ -354,7 +352,7 @@ Build nghttp3: .. code-block:: text - $ git clone --depth 1 -b v1.0.0 https://github.com/ngtcp2/nghttp3 + $ git clone --depth 1 -b v1.1.0 https://github.com/ngtcp2/nghttp3 $ cd nghttp3 $ autoreconf -i $ ./configure --prefix=$PWD/build --enable-lib-only @@ -366,7 +364,7 @@ Build ngtcp2: .. code-block:: text - $ git clone --depth 1 -b v1.0.1 https://github.com/ngtcp2/ngtcp2 + $ git clone --depth 1 -b v1.2.0 https://github.com/ngtcp2/ngtcp2 $ cd ngtcp2 $ autoreconf -i $ ./configure --prefix=$PWD/build --enable-lib-only \ @@ -380,7 +378,7 @@ from source: .. code-block:: text - $ git clone --depth 1 -b v1.2.2 https://github.com/libbpf/libbpf + $ git clone --depth 1 -b v1.3.0 https://github.com/libbpf/libbpf $ cd libbpf $ PREFIX=$PWD/build make -C src install $ cd .. @@ -539,7 +537,7 @@ nghttp - client +++++++++++++++ ``nghttp`` is a HTTP/2 client. It can connect to the HTTP/2 server -with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension. +with prior knowledge, HTTP Upgrade and ALPN TLS extension. It has verbose output mode for framing information. Here is sample output from ``nghttp`` client: @@ -765,8 +763,8 @@ nghttpd - server By default, it uses SSL/TLS connection. Use ``--no-tls`` option to disable it. -``nghttpd`` only accepts HTTP/2 connections via NPN/ALPN or direct -HTTP/2 connections. No HTTP Upgrade is supported. +``nghttpd`` only accepts HTTP/2 connections via ALPN or direct HTTP/2 +connections. No HTTP Upgrade is supported. The ``-p`` option allows users to configure server push. @@ -847,7 +845,7 @@ to know how to migrate from earlier releases. ``nghttpx`` implements `important performance-oriented features <https://istlsfastyet.com/#server-performance>`_ in TLS, such as session IDs, session tickets (with automatic key rotation), OCSP -stapling, dynamic record sizing, ALPN/NPN, forward secrecy and HTTP/2. +stapling, dynamic record sizing, ALPN, forward secrecy and HTTP/2. ``nghttpx`` also offers the functionality to share session cache and ticket keys among multiple ``nghttpx`` instances via memcached. @@ -974,12 +972,15 @@ threads to avoid saturating a single core on client side. servers. If the experimental HTTP/3 is enabled, h2load can send requests to -HTTP/3 server. To do this, specify ``h3`` to ``--npn-list`` option +HTTP/3 server. To do this, specify ``h3`` to ``--alpn-list`` option like so: .. code-block:: text - $ h2load --npn-list h3 https://127.0.0.1:4433 + $ h2load --alpn-list h3 https://127.0.0.1:4433 + +For nghttp2 v1.58 or earlier, use ``--npn-list`` instead of +``--alpn-list``. HPACK tools ----------- diff --git a/contrib/libs/nghttp2/config.h b/contrib/libs/nghttp2/config.h index 83cbe7624f..82bd630a37 100644 --- a/contrib/libs/nghttp2/config.h +++ b/contrib/libs/nghttp2/config.h @@ -31,6 +31,10 @@ /* define if the compiler supports basic C++14 syntax */ #define HAVE_CXX14 1 +/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if + you don't. */ +#define HAVE_DECL_CLOCK_MONOTONIC 1 + /* Define to 1 if you have the declaration of `initgroups', and to 0 if you don't. */ #define HAVE_DECL_INITGROUPS 1 @@ -189,9 +193,6 @@ /* Define to 1 if you have `struct tm.tm_gmtoff` member. */ #define HAVE_STRUCT_TM_TM_GMTOFF 1 -/* Define to 1 if you have the <sysinfoapi.h> header file. */ -/* #undef HAVE_SYSINFOAPI_H */ - /* Define to 1 if you have the <syslog.h> header file. */ #define HAVE_SYSLOG_H 1 @@ -213,9 +214,6 @@ /* Define to 1 if you have the `timegm' function. */ #define HAVE_TIMEGM 1 -/* Define to 1 if you have the <time.h> header file. */ -#define HAVE_TIME_H 1 - /* Define to 1 if you have the <unistd.h> header file. */ #define HAVE_UNISTD_H 1 @@ -228,6 +226,9 @@ /* Define to 1 if you have the <wchar.h> header file. */ #define HAVE_WCHAR_H 1 +/* Define to 1 if you have the <windows.h> header file. */ +/* #undef HAVE_WINDOWS_H */ + /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 @@ -259,7 +260,7 @@ #define PACKAGE_NAME "nghttp2" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "nghttp2 1.58.0" +#define PACKAGE_STRING "nghttp2 1.59.0" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "nghttp2" @@ -268,13 +269,7 @@ #define PACKAGE_URL "" /* Define to the version of this package. */ -#define PACKAGE_VERSION "1.58.0" - -/* The size of `int *', as computed by sizeof. */ -#define SIZEOF_INT_P 8 - -/* The size of `time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 8 +#define PACKAGE_VERSION "1.59.0" /* Define to 1 if all of the C90 standard headers exist (not just the ones required in a freestanding environment). This macro is provided for @@ -373,7 +368,7 @@ /* Version number of package */ -#define VERSION "1.58.0" +#define VERSION "1.59.0" /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ diff --git a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h index fa22081c51..7910db230a 100644 --- a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h +++ b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2.h @@ -1997,7 +1997,7 @@ typedef int (*nghttp2_on_extension_chunk_recv_callback)( * ``NULL``. The |*payload| is available as ``frame->ext.payload`` in * :type:`nghttp2_on_frame_recv_callback`. Therefore if application * can free that memory inside :type:`nghttp2_on_frame_recv_callback` - * callback. Of course, application has a liberty not ot use + * callback. Of course, application has a liberty not to use * |*payload|, and do its own mechanism to process extension frames. * * To abort processing this extension frame, return @@ -4961,6 +4961,55 @@ NGHTTP2_EXTERN int nghttp2_session_change_extpri_stream_priority( /** * @function * + * Stores the stream priority of the existing stream denoted by + * |stream_id| in the object pointed by |extpri|. This function is + * meant to be used by server for :rfc:`9218` extensible + * prioritization scheme. + * + * If |session| is initialized as client, this function returns + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE`. + * + * If + * :enum:`nghttp2_settings_id.NGHTTP2_SETTINGS_NO_RFC7540_PRIORITIES` + * of value of 1 is not submitted via `nghttp2_submit_settings()`, + * this function does nothing and returns 0. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_STATE` + * The |session| is initialized as client. + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + * |stream_id| is zero; or a stream denoted by |stream_id| is not + * found. + */ +NGHTTP2_EXTERN int nghttp2_session_get_extpri_stream_priority( + nghttp2_session *session, nghttp2_extpri *extpri, int32_t stream_id); + +/** + * @function + * + * Parses Priority header field value pointed by |value| of length + * |len|, and stores the result in the object pointed by |extpri|. + * Priority header field is defined in :rfc:`9218`. + * + * This function does not initialize the object pointed by |extpri| + * before storing the result. It only assigns the values that the + * parser correctly extracted to fields. + * + * This function returns 0 if it succeeds, or one of the following + * negative error codes: + * + * :enum:`nghttp2_error.NGHTTP2_ERR_INVALID_ARGUMENT` + * Failed to parse the header field value. + */ +NGHTTP2_EXTERN int nghttp2_extpri_parse_priority(nghttp2_extpri *extpri, + const uint8_t *value, + size_t len); + +/** + * @function + * * Compares ``lhs->name`` of length ``lhs->namelen`` bytes and * ``rhs->name`` of length ``rhs->namelen`` bytes. Returns negative * integer if ``lhs->name`` is found to be less than ``rhs->name``; or @@ -4973,11 +5022,14 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, /** * @function * - * A helper function for dealing with NPN in client side or ALPN in - * server side. The |in| contains peer's protocol list in preferable - * order. The format of |in| is length-prefixed and not - * null-terminated. For example, ``h2`` and - * ``http/1.1`` stored in |in| like this:: + * .. warning:: + * + * Deprecated. Use `nghttp2_select_alpn` instead. + * + * A helper function for dealing with ALPN in server side. The |in| + * contains peer's protocol list in preferable order. The format of + * |in| is length-prefixed and not null-terminated. For example, + * ``h2`` and ``http/1.1`` stored in |in| like this:: * * in[0] = 2 * in[1..2] = "h2" @@ -5002,20 +5054,18 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, * * For ALPN, refer to https://tools.ietf.org/html/rfc7301 * - * See http://technotes.googlecode.com/git/nextprotoneg.html for more - * details about NPN. - * - * For NPN, to use this method you should do something like:: + * To use this method you should do something like:: * - * static int select_next_proto_cb(SSL* ssl, - * unsigned char **out, + * static int alpn_select_proto_cb(SSL* ssl, + * const unsigned char **out, * unsigned char *outlen, * const unsigned char *in, * unsigned int inlen, * void *arg) * { * int rv; - * rv = nghttp2_select_next_protocol(out, outlen, in, inlen); + * rv = nghttp2_select_next_protocol((unsigned char**)out, outlen, + * in, inlen); * if (rv == -1) { * return SSL_TLSEXT_ERR_NOACK; * } @@ -5025,7 +5075,7 @@ NGHTTP2_EXTERN int nghttp2_nv_compare_name(const nghttp2_nv *lhs, * return SSL_TLSEXT_ERR_OK; * } * ... - * SSL_CTX_set_next_proto_select_cb(ssl_ctx, select_next_proto_cb, my_obj); + * SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); * */ NGHTTP2_EXTERN int nghttp2_select_next_protocol(unsigned char **out, @@ -5036,6 +5086,65 @@ NGHTTP2_EXTERN int nghttp2_select_next_protocol(unsigned char **out, /** * @function * + * A helper function for dealing with ALPN in server side. The |in| + * contains peer's protocol list in preferable order. The format of + * |in| is length-prefixed and not null-terminated. For example, + * ``h2`` and ``http/1.1`` stored in |in| like this:: + * + * in[0] = 2 + * in[1..2] = "h2" + * in[3] = 8 + * in[4..11] = "http/1.1" + * inlen = 12 + * + * The selection algorithm is as follows: + * + * 1. If peer's list contains HTTP/2 protocol the library supports, + * it is selected and returns 1. The following step is not taken. + * + * 2. If peer's list contains ``http/1.1``, this function selects + * ``http/1.1`` and returns 0. The following step is not taken. + * + * 3. This function selects nothing and returns -1 (So called + * non-overlap case). In this case, |out| and |outlen| are left + * untouched. + * + * Selecting ``h2`` means that ``h2`` is written into |*out| and its + * length (which is 2) is assigned to |*outlen|. + * + * For ALPN, refer to https://tools.ietf.org/html/rfc7301 + * + * To use this method you should do something like:: + * + * static int alpn_select_proto_cb(SSL* ssl, + * const unsigned char **out, + * unsigned char *outlen, + * const unsigned char *in, + * unsigned int inlen, + * void *arg) + * { + * int rv; + * rv = nghttp2_select_alpn(out, outlen, in, inlen); + * if (rv == -1) { + * return SSL_TLSEXT_ERR_NOACK; + * } + * if (rv == 1) { + * ((MyType*)arg)->http2_selected = 1; + * } + * return SSL_TLSEXT_ERR_OK; + * } + * ... + * SSL_CTX_set_alpn_select_cb(ssl_ctx, alpn_select_proto_cb, my_obj); + * + */ +NGHTTP2_EXTERN int nghttp2_select_alpn(const unsigned char **out, + unsigned char *outlen, + const unsigned char *in, + unsigned int inlen); + +/** + * @function + * * Returns a pointer to a nghttp2_info struct with version information * about the run-time library in use. The |least_version| argument * can be set to a 24 bit numerical value for the least accepted diff --git a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2ver.h b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2ver.h index f38fe2b047..518755bbab 100644 --- a/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2ver.h +++ b/contrib/libs/nghttp2/lib/includes/nghttp2/nghttp2ver.h @@ -29,7 +29,7 @@ * @macro * Version number of the nghttp2 library release */ -#define NGHTTP2_VERSION "1.58.0" +#define NGHTTP2_VERSION "1.59.0" /** * @macro @@ -37,6 +37,6 @@ * release. This is a 24 bit number with 8 bits for major number, 8 bits * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. */ -#define NGHTTP2_VERSION_NUM 0x013a00 +#define NGHTTP2_VERSION_NUM 0x013b00 #endif /* NGHTTP2VER_H */ diff --git a/contrib/libs/nghttp2/lib/nghttp2_npn.c b/contrib/libs/nghttp2/lib/nghttp2_alpn.c index d1384c8075..33c5885f8d 100644 --- a/contrib/libs/nghttp2/lib/nghttp2_npn.c +++ b/contrib/libs/nghttp2/lib/nghttp2_alpn.c @@ -22,13 +22,13 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "nghttp2_npn.h" +#include "nghttp2_alpn.h" #include <string.h> -static int select_next_protocol(unsigned char **out, unsigned char *outlen, - const unsigned char *in, unsigned int inlen, - const char *key, unsigned int keylen) { +static int select_alpn(const unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen, + const char *key, unsigned int keylen) { unsigned int i; for (i = 0; i + keylen <= inlen; i += (unsigned int)(in[i] + 1)) { if (memcmp(&in[i], key, keylen) == 0) { @@ -45,12 +45,25 @@ static int select_next_protocol(unsigned char **out, unsigned char *outlen, int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen) { - if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_PROTO_ALPN, - NGHTTP2_PROTO_ALPN_LEN) == 0) { + if (select_alpn((const unsigned char **)out, outlen, in, inlen, + NGHTTP2_PROTO_ALPN, NGHTTP2_PROTO_ALPN_LEN) == 0) { return 1; } - if (select_next_protocol(out, outlen, in, inlen, NGHTTP2_HTTP_1_1_ALPN, - NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { + if (select_alpn((const unsigned char **)out, outlen, in, inlen, + NGHTTP2_HTTP_1_1_ALPN, NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { + return 0; + } + return -1; +} + +int nghttp2_select_alpn(const unsigned char **out, unsigned char *outlen, + const unsigned char *in, unsigned int inlen) { + if (select_alpn(out, outlen, in, inlen, NGHTTP2_PROTO_ALPN, + NGHTTP2_PROTO_ALPN_LEN) == 0) { + return 1; + } + if (select_alpn(out, outlen, in, inlen, NGHTTP2_HTTP_1_1_ALPN, + NGHTTP2_HTTP_1_1_ALPN_LEN) == 0) { return 0; } return -1; diff --git a/contrib/libs/nghttp2/lib/nghttp2_npn.h b/contrib/libs/nghttp2/lib/nghttp2_alpn.h index c6f1c04b68..09810fd821 100644 --- a/contrib/libs/nghttp2/lib/nghttp2_npn.h +++ b/contrib/libs/nghttp2/lib/nghttp2_alpn.h @@ -22,8 +22,8 @@ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#ifndef NGHTTP2_NPN_H -#define NGHTTP2_NPN_H +#ifndef NGHTTP2_ALPN_H +#define NGHTTP2_ALPN_H #ifdef HAVE_CONFIG_H # include <config.h> @@ -31,4 +31,4 @@ #include <nghttp2/nghttp2.h> -#endif /* NGHTTP2_NPN_H */ +#endif /* NGHTTP2_ALPN_H */ diff --git a/contrib/libs/nghttp2/lib/nghttp2_extpri.c b/contrib/libs/nghttp2/lib/nghttp2_extpri.c index 3fd9b78163..ba0263e7c8 100644 --- a/contrib/libs/nghttp2/lib/nghttp2_extpri.c +++ b/contrib/libs/nghttp2/lib/nghttp2_extpri.c @@ -24,6 +24,7 @@ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "nghttp2_extpri.h" +#include "nghttp2_http.h" uint8_t nghttp2_extpri_to_uint8(const nghttp2_extpri *extpri) { return (uint8_t)((uint32_t)extpri->inc << 7 | extpri->urgency); @@ -33,3 +34,8 @@ void nghttp2_extpri_from_uint8(nghttp2_extpri *extpri, uint8_t u8extpri) { extpri->urgency = nghttp2_extpri_uint8_urgency(u8extpri); extpri->inc = nghttp2_extpri_uint8_inc(u8extpri); } + +int nghttp2_extpri_parse_priority(nghttp2_extpri *extpri, const uint8_t *value, + size_t len) { + return nghttp2_http_parse_priority(extpri, value, len); +} diff --git a/contrib/libs/nghttp2/lib/nghttp2_session.c b/contrib/libs/nghttp2/lib/nghttp2_session.c index ec5024d0f2..ce21caf9d7 100644 --- a/contrib/libs/nghttp2/lib/nghttp2_session.c +++ b/contrib/libs/nghttp2/lib/nghttp2_session.c @@ -3302,7 +3302,7 @@ static ssize_t nghttp2_session_mem_send_internal(nghttp2_session *session, } if (rv == NGHTTP2_ERR_HEADER_COMP) { - /* If header compression error occurred, should terminiate + /* If header compression error occurred, should terminate connection. */ rv = nghttp2_session_terminate_session(session, NGHTTP2_INTERNAL_ERROR); @@ -8366,3 +8366,30 @@ int nghttp2_session_change_extpri_stream_priority( return session_update_stream_priority(session, stream, nghttp2_extpri_to_uint8(&extpri)); } + +int nghttp2_session_get_extpri_stream_priority(nghttp2_session *session, + nghttp2_extpri *extpri, + int32_t stream_id) { + nghttp2_stream *stream; + + if (!session->server) { + return NGHTTP2_ERR_INVALID_STATE; + } + + if (session->pending_no_rfc7540_priorities != 1) { + return 0; + } + + if (stream_id == 0) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + stream = nghttp2_session_get_stream_raw(session, stream_id); + if (!stream) { + return NGHTTP2_ERR_INVALID_ARGUMENT; + } + + nghttp2_extpri_from_uint8(extpri, stream->extpri); + + return 0; +} diff --git a/contrib/libs/nghttp2/lib/nghttp2_time.c b/contrib/libs/nghttp2/lib/nghttp2_time.c index 897556fe2c..947b5449e5 100644 --- a/contrib/libs/nghttp2/lib/nghttp2_time.c +++ b/contrib/libs/nghttp2/lib/nghttp2_time.c @@ -24,13 +24,11 @@ */ #include "nghttp2_time.h" -#ifdef HAVE_TIME_H -# include <time.h> -#endif /* HAVE_TIME_H */ +#ifdef HAVE_WINDOWS_H +# include <windows.h> +#endif /* HAVE_WINDOWS_H */ -#ifdef HAVE_SYSINFOAPI_H -# include <sysinfoapi.h> -#endif /* HAVE_SYSINFOAPI_H */ +#include <time.h> #if !defined(HAVE_GETTICKCOUNT64) || defined(__CYGWIN__) static uint64_t time_now_sec(void) { @@ -46,7 +44,8 @@ static uint64_t time_now_sec(void) { #if defined(HAVE_GETTICKCOUNT64) && !defined(__CYGWIN__) uint64_t nghttp2_time_now_sec(void) { return GetTickCount64() / 1000; } -#elif defined(HAVE_CLOCK_GETTIME) +#elif defined(HAVE_CLOCK_GETTIME) && defined(HAVE_DECL_CLOCK_MONOTONIC) && \ + HAVE_DECL_CLOCK_MONOTONIC uint64_t nghttp2_time_now_sec(void) { struct timespec tp; int rv = clock_gettime(CLOCK_MONOTONIC, &tp); @@ -57,6 +56,8 @@ uint64_t nghttp2_time_now_sec(void) { return (uint64_t)tp.tv_sec; } -#else /* (!HAVE_CLOCK_GETTIME || __CYGWIN__) && !HAVE_GETTICKCOUNT64 */ +#else /* (!HAVE_CLOCK_GETTIME || !HAVE_DECL_CLOCK_MONOTONIC) && \ + (!HAVE_GETTICKCOUNT64 || __CYGWIN__)) */ uint64_t nghttp2_time_now_sec(void) { return time_now_sec(); } -#endif /* (!HAVE_CLOCK_GETTIME || __CYGWIN__) && !HAVE_GETTICKCOUNT64 */ +#endif /* (!HAVE_CLOCK_GETTIME || !HAVE_DECL_CLOCK_MONOTONIC) && \ + (!HAVE_GETTICKCOUNT64 || __CYGWIN__)) */ diff --git a/contrib/libs/nghttp2/ya.make b/contrib/libs/nghttp2/ya.make index 03b69f3d9a..0c865394e7 100644 --- a/contrib/libs/nghttp2/ya.make +++ b/contrib/libs/nghttp2/ya.make @@ -9,9 +9,9 @@ LICENSE( LICENSE_TEXTS(.yandex_meta/licenses.list.txt) -VERSION(1.58.0) +VERSION(1.59.0) -ORIGINAL_SOURCE(https://github.com/nghttp2/nghttp2/archive/v1.58.0.tar.gz) +ORIGINAL_SOURCE(https://github.com/nghttp2/nghttp2/archive/v1.59.0.tar.gz) ADDINCL( GLOBAL contrib/libs/nghttp2/lib/includes @@ -29,6 +29,7 @@ CFLAGS( ) SRCS( + lib/nghttp2_alpn.c lib/nghttp2_buf.c lib/nghttp2_callbacks.c lib/nghttp2_debug.c @@ -41,7 +42,6 @@ SRCS( lib/nghttp2_http.c lib/nghttp2_map.c lib/nghttp2_mem.c - lib/nghttp2_npn.c lib/nghttp2_option.c lib/nghttp2_outbound_item.c lib/nghttp2_pq.c |