Skip to content

Commit

Permalink
deps: update nghttp3 to 1.6.0
Browse files Browse the repository at this point in the history
PR-URL: #56258
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
nodejs-github-bot authored and aduh95 committed Dec 18, 2024
1 parent 7c941d4 commit 8658833
Show file tree
Hide file tree
Showing 54 changed files with 7,274 additions and 6,766 deletions.
110 changes: 70 additions & 40 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@
libcurl) */
#if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32)
# define WIN32
#endif
#endif /* (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) */

#ifdef __cplusplus
extern "C" {
#endif
#endif /* defined(__cplusplus) */

#include <stdlib.h>
#if defined(_MSC_VER) && (_MSC_VER < 1800)
/* MSVC < 2013 does not have inttypes.h because it is not C99
compliant. See compiler macros and version number in
https://sourceforge.net/p/predef/wiki/Compilers/ */
# include <stdint.h>
#else /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#else /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */
# include <inttypes.h>
#endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
#endif /* !(defined(_MSC_VER) && (_MSC_VER < 1800)) */
#include <sys/types.h>
#include <stdarg.h>
#include <stddef.h>
Expand All @@ -57,22 +57,22 @@ extern "C" {
#elif defined(WIN32)
# ifdef BUILDING_NGHTTP3
# define NGHTTP3_EXTERN __declspec(dllexport)
# else /* !BUILDING_NGHTTP3 */
# else /* !defined(BUILDING_NGHTTP3) */
# define NGHTTP3_EXTERN __declspec(dllimport)
# endif /* !BUILDING_NGHTTP3 */
#else /* !defined(WIN32) */
# endif /* !defined(BUILDING_NGHTTP3) */
#else /* !(defined(NGHTTP3_STATICLIB) || defined(WIN32)) */
# ifdef BUILDING_NGHTTP3
# define NGHTTP3_EXTERN __attribute__((visibility("default")))
# else /* !BUILDING_NGHTTP3 */
# else /* !defined(BUILDING_NGHTTP3) */
# define NGHTTP3_EXTERN
# endif /* !BUILDING_NGHTTP3 */
#endif /* !defined(WIN32) */
# endif /* !defined(BUILDING_NGHTTP3) */
#endif /* !(defined(NGHTTP3_STATICLIB) || defined(WIN32)) */

#ifdef _MSC_VER
# define NGHTTP3_ALIGN(N) __declspec(align(N))
#else /* !_MSC_VER */
#else /* !defined(_MSC_VER) */
# define NGHTTP3_ALIGN(N) __attribute__((aligned(N)))
#endif /* !_MSC_VER */
#endif /* !defined(_MSC_VER) */

/**
* @typedef
Expand Down Expand Up @@ -624,7 +624,7 @@ typedef struct nghttp3_buf {
*/
uint8_t *end;
/**
* :member:`pos` pointers to the start of data. Typically, this
* :member:`pos` points to the start of data. Typically, this
* points to the address that next data should be read. Initially,
* it points to :member:`begin`.
*/
Expand Down Expand Up @@ -1161,8 +1161,8 @@ NGHTTP3_EXTERN void nghttp3_qpack_encoder_del(nghttp3_qpack_encoder *encoder);
* anymore.
*/
NGHTTP3_EXTERN int nghttp3_qpack_encoder_encode(
nghttp3_qpack_encoder *encoder, nghttp3_buf *pbuf, nghttp3_buf *rbuf,
nghttp3_buf *ebuf, int64_t stream_id, const nghttp3_nv *nva, size_t nvlen);
nghttp3_qpack_encoder *encoder, nghttp3_buf *pbuf, nghttp3_buf *rbuf,
nghttp3_buf *ebuf, int64_t stream_id, const nghttp3_nv *nva, size_t nvlen);

/**
* @function
Expand All @@ -1182,7 +1182,7 @@ NGHTTP3_EXTERN int nghttp3_qpack_encoder_encode(
* |encoder| is unable to process input because it is malformed.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_encoder_read_decoder(
nghttp3_qpack_encoder *encoder, const uint8_t *src, size_t srclen);
nghttp3_qpack_encoder *encoder, const uint8_t *src, size_t srclen);

/**
* @function
Expand Down Expand Up @@ -1343,7 +1343,7 @@ NGHTTP3_EXTERN void nghttp3_qpack_decoder_del(nghttp3_qpack_decoder *decoder);
* Could not interpret encoder stream instruction.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_decoder_read_encoder(
nghttp3_qpack_decoder *decoder, const uint8_t *src, size_t srclen);
nghttp3_qpack_decoder *decoder, const uint8_t *src, size_t srclen);

/**
* @function
Expand Down Expand Up @@ -1436,9 +1436,9 @@ nghttp3_qpack_decoder_get_icnt(const nghttp3_qpack_decoder *decoder);
* HTTP field is too large.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_qpack_decoder_read_request(
nghttp3_qpack_decoder *decoder, nghttp3_qpack_stream_context *sctx,
nghttp3_qpack_nv *nv, uint8_t *pflags, const uint8_t *src, size_t srclen,
int fin);
nghttp3_qpack_decoder *decoder, nghttp3_qpack_stream_context *sctx,
nghttp3_qpack_nv *nv, uint8_t *pflags, const uint8_t *src, size_t srclen,
int fin);

/**
* @function
Expand Down Expand Up @@ -1568,7 +1568,7 @@ typedef void (*nghttp3_debug_vprintf_callback)(const char *format,
* times because this is important.
*/
NGHTTP3_EXTERN void nghttp3_set_debug_vprintf_callback(
nghttp3_debug_vprintf_callback debug_vprintf_callback);
nghttp3_debug_vprintf_callback debug_vprintf_callback);

/**
* @macrosection
Expand Down Expand Up @@ -2118,9 +2118,10 @@ NGHTTP3_EXTERN int nghttp3_conn_bind_qpack_streams(nghttp3_conn *conn,
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*
* It may return the other error codes. In general, the negative
* error code means that |conn| encountered a connection error, and
* the connection should be closed.
* It may return the other error codes. The negative error code means
* that |conn| encountered a connection error, and the connection must
* be closed. Calling nghttp3 API other than `nghttp3_conn_del`
* causes undefined behavior.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn,
int64_t stream_id,
Expand Down Expand Up @@ -2152,9 +2153,10 @@ NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_read_stream(nghttp3_conn *conn,
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*
* It may return the other error codes. In general, the negative
* error code means that |conn| encountered a connection error, and
* the connection should be closed.
* It may return the other error codes. The negative error code means
* that |conn| encountered a connection error, and the connection must
* be closed. Calling nghttp3 API other than `nghttp3_conn_del`
* causes undefined behavior.
*/
NGHTTP3_EXTERN nghttp3_ssize nghttp3_conn_writev_stream(nghttp3_conn *conn,
int64_t *pstream_id,
Expand Down Expand Up @@ -2198,6 +2200,9 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
* If a stream denoted by |stream_id| is not found, this function
* returns 0.
*
* Alternatively, `nghttp3_conn_update_ack_offset` can be used to
* accomplish the same thing.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
Expand All @@ -2207,6 +2212,31 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
NGHTTP3_EXTERN int nghttp3_conn_add_ack_offset(nghttp3_conn *conn,
int64_t stream_id, uint64_t n);

/**
* @function
*
* `nghttp3_conn_update_ack_offset` tells |conn| that QUIC stack has
* acknowledged the stream data up to |offset| for a stream denoted by
* |stream_id|.
*
* If a stream denoted by |stream_id| is not found, this function
* returns 0.
*
* Alternatively, `nghttp3_conn_add_ack_offset` can be used to
* accomplish the same thing.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
* |offset| is less than the number of bytes acknowledged so far.
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
* User callback failed.
*/
NGHTTP3_EXTERN int nghttp3_conn_update_ack_offset(nghttp3_conn *conn,
int64_t stream_id,
uint64_t offset);

/**
* @function
*
Expand Down Expand Up @@ -2314,9 +2344,9 @@ NGHTTP3_EXTERN int nghttp3_conn_resume_stream(nghttp3_conn *conn,
/**
* @function
*
* `nghttp3_conn_close_stream` closes stream identified by
* |stream_id|. QUIC application error code |app_error_code| is the
* reason of the closure.
* `nghttp3_conn_close_stream` tells the library that a stream
* identified by |stream_id| has been closed. QUIC application error
* code |app_error_code| is the reason of the closure.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
Expand Down Expand Up @@ -2419,8 +2449,8 @@ nghttp3_conn_set_max_concurrent_streams(nghttp3_conn *conn,
* stream.
*/
typedef nghttp3_ssize (*nghttp3_read_data_callback)(
nghttp3_conn *conn, int64_t stream_id, nghttp3_vec *vec, size_t veccnt,
uint32_t *pflags, void *conn_user_data, void *stream_user_data);
nghttp3_conn *conn, int64_t stream_id, nghttp3_vec *vec, size_t veccnt,
uint32_t *pflags, void *conn_user_data, void *stream_user_data);

/**
* @struct
Expand Down Expand Up @@ -2460,8 +2490,8 @@ typedef struct nghttp3_data_reader {
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_submit_request(
nghttp3_conn *conn, int64_t stream_id, const nghttp3_nv *nva, size_t nvlen,
const nghttp3_data_reader *dr, void *stream_user_data);
nghttp3_conn *conn, int64_t stream_id, const nghttp3_nv *nva, size_t nvlen,
const nghttp3_data_reader *dr, void *stream_user_data);

/**
* @function
Expand Down Expand Up @@ -2667,7 +2697,7 @@ typedef struct NGHTTP3_ALIGN(8) nghttp3_pri {
* Stream not found.
*/
NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority_versioned(
nghttp3_conn *conn, int pri_version, nghttp3_pri *dest, int64_t stream_id);
nghttp3_conn *conn, int pri_version, nghttp3_pri *dest, int64_t stream_id);

/**
* @function
Expand Down Expand Up @@ -2720,8 +2750,8 @@ NGHTTP3_EXTERN int nghttp3_conn_set_client_stream_priority(nghttp3_conn *conn,
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_set_server_stream_priority_versioned(
nghttp3_conn *conn, int64_t stream_id, int pri_version,
const nghttp3_pri *pri);
nghttp3_conn *conn, int64_t stream_id, int pri_version,
const nghttp3_pri *pri);

/**
* @function
Expand Down Expand Up @@ -2884,7 +2914,7 @@ NGHTTP3_EXTERN int nghttp3_err_is_fatal(int liberr);
*/
#define nghttp3_conn_set_server_stream_priority(CONN, STREAM_ID, PRI) \
nghttp3_conn_set_server_stream_priority_versioned( \
(CONN), (STREAM_ID), NGHTTP3_PRI_VERSION, (PRI))
(CONN), (STREAM_ID), NGHTTP3_PRI_VERSION, (PRI))

/*
* `nghttp3_conn_get_stream_priority` is a wrapper around
Expand All @@ -2906,6 +2936,6 @@ NGHTTP3_EXTERN int nghttp3_err_is_fatal(int liberr);

#ifdef __cplusplus
}
#endif
#endif /* defined(__cplusplus) */

#endif /* NGHTTP3_H */
#endif /* !defined(NGHTTP3_H) */
6 changes: 3 additions & 3 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
*
* Version number of the nghttp3 library release.
*/
#define NGHTTP3_VERSION "0.7.0"
#define NGHTTP3_VERSION "1.6.0"

/**
* @macro
Expand All @@ -41,6 +41,6 @@
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
* becomes 0x010203.
*/
#define NGHTTP3_VERSION_NUM 0x000700
#define NGHTTP3_VERSION_NUM 0x010600

#endif /* NGHTTP3_VERSION_H */
#endif /* !defined(NGHTTP3_VERSION_H) */
12 changes: 6 additions & 6 deletions deps/ngtcp2/nghttp3/lib/nghttp3_balloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ int nghttp3_balloc_get(nghttp3_balloc *balloc, void **pbuf, size_t n) {
assert(n <= balloc->blklen);

if (nghttp3_buf_left(&balloc->buf) < n) {
p = nghttp3_mem_malloc(balloc->mem, sizeof(nghttp3_memblock_hd) + 0x10u +
balloc->blklen);
p = nghttp3_mem_malloc(balloc->mem,
sizeof(nghttp3_memblock_hd) + 0x8u + balloc->blklen);
if (p == NULL) {
return NGHTTP3_ERR_NOMEM;
}
Expand All @@ -76,10 +76,10 @@ int nghttp3_balloc_get(nghttp3_balloc *balloc, void **pbuf, size_t n) {
hd->next = balloc->head;
balloc->head = hd;
nghttp3_buf_wrap_init(
&balloc->buf,
(uint8_t *)(((uintptr_t)p + sizeof(nghttp3_memblock_hd) + 0xfu) &
~(uintptr_t)0xfu),
balloc->blklen);
&balloc->buf,
(uint8_t *)(((uintptr_t)p + sizeof(nghttp3_memblock_hd) + 0xfu) &
~(uintptr_t)0xfu),
balloc->blklen);
}

assert(((uintptr_t)balloc->buf.last & 0xfu) == 0);
Expand Down
9 changes: 6 additions & 3 deletions deps/ngtcp2/nghttp3/lib/nghttp3_balloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#endif /* defined(HAVE_CONFIG_H) */

#include <nghttp3/nghttp3.h>

Expand All @@ -40,7 +40,10 @@ typedef struct nghttp3_memblock_hd nghttp3_memblock_hd;
* nghttp3_memblock_hd is the header of memory block.
*/
struct nghttp3_memblock_hd {
nghttp3_memblock_hd *next;
union {
nghttp3_memblock_hd *next;
uint64_t pad;
};
};

/*
Expand Down Expand Up @@ -89,4 +92,4 @@ int nghttp3_balloc_get(nghttp3_balloc *balloc, void **pbuf, size_t n);
*/
void nghttp3_balloc_clear(nghttp3_balloc *balloc);

#endif /* NGHTTP3_BALLOC_H */
#endif /* !defined(NGHTTP3_BALLOC_H) */
4 changes: 2 additions & 2 deletions deps/ngtcp2/nghttp3/lib/nghttp3_buf.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#endif /* defined(HAVE_CONFIG_H) */

#include <nghttp3/nghttp3.h>

Expand Down Expand Up @@ -71,4 +71,4 @@ void nghttp3_typed_buf_init(nghttp3_typed_buf *tbuf, const nghttp3_buf *buf,

void nghttp3_typed_buf_free(nghttp3_typed_buf *tbuf);

#endif /* NGHTTP3_BUF_H */
#endif /* !defined(NGHTTP3_BUF_H) */
Loading

0 comments on commit 8658833

Please sign in to comment.