Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: update nghttp3 to 1.0.0 #47576

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 98 additions & 40 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ extern "C" {
# endif /* !BUILDING_NGHTTP3 */
#endif /* !defined(WIN32) */

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

/**
* @typedef
*
Expand Down Expand Up @@ -722,6 +728,16 @@ NGHTTP3_EXTERN void nghttp3_buf_reset(nghttp3_buf *buf);
*/
#define NGHTTP3_NV_FLAG_NO_COPY_VALUE 0x04u

/**
* @macro
*
* :macro:`NGHTTP3_NV_FLAG_TRY_INDEX` gives a hint to QPACK encoder to
* index a header field which is not indexed by default. This is just
* a hint, and QPACK encoder might not encode the field in various
* reasons.
*/
#define NGHTTP3_NV_FLAG_TRY_INDEX 0x08u

/**
* @struct
*
Expand Down Expand Up @@ -1071,8 +1087,8 @@ typedef struct nghttp3_qpack_nv {
nghttp3_rcbuf *value;
/**
* :member:`token` is :type:`nghttp3_qpack_token` value of
* :member:`name`. It could be -1 if we have no token for that
* header field name.
* :member:`name`. It could be -1 if we have no token for that
* header field name.
*/
int32_t token;
/**
Expand Down Expand Up @@ -1804,8 +1820,8 @@ typedef int (*nghttp3_reset_stream)(nghttp3_conn *conn, int64_t stream_id,
typedef int (*nghttp3_shutdown)(nghttp3_conn *conn, int64_t id,
void *conn_user_data);

#define NGHTTP3_CALLBACKS_VERSION_V1 1
#define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_VERSION_V1
#define NGHTTP3_CALLBACKS_V1 1
#define NGHTTP3_CALLBACKS_VERSION NGHTTP3_CALLBACKS_V1

/**
* @struct
Expand Down Expand Up @@ -1889,8 +1905,8 @@ typedef struct nghttp3_callbacks {
nghttp3_shutdown shutdown;
} nghttp3_callbacks;

#define NGHTTP3_SETTINGS_VERSION_V1 1
#define NGHTTP3_SETTINGS_VERSION NGHTTP3_SETTINGS_VERSION_V1
#define NGHTTP3_SETTINGS_V1 1
#define NGHTTP3_SETTINGS_VERSION NGHTTP3_SETTINGS_V1

/**
* @struct
Expand Down Expand Up @@ -1924,11 +1940,15 @@ typedef struct nghttp3_settings {
size_t qpack_blocked_streams;
/**
* :member:`enable_connect_protocol`, if set to nonzero, enables
* Extended CONNECT Method (see
* https://www.ietf.org/archive/id/draft-ietf-httpbis-h3-websockets-00.html).
* Client ignores this field.
* Extended CONNECT Method (see :rfc:`9220`). Client ignores this
* field.
*/
int enable_connect_protocol;
uint8_t enable_connect_protocol;
/**
* :member:`h3_datagram`, if set to nonzero, enables HTTP/3
* Datagrams (see :rfc:`9297`).
*/
uint8_t h3_datagram;
} nghttp3_settings;

/**
Expand Down Expand Up @@ -2359,7 +2379,7 @@ NGHTTP3_EXTERN int nghttp3_conn_submit_shutdown_notice(nghttp3_conn *conn);
* called after `nghttp3_conn_submit_shutdown_notice` and a couple of
* RTT. After calling this function, the local endpoint starts
* rejecting new incoming streams. The existing streams are processed
* normally.
* normally. See also `nghttp3_conn_is_drained`.
*/
NGHTTP3_EXTERN int nghttp3_conn_shutdown(nghttp3_conn *conn);

Expand Down Expand Up @@ -2417,12 +2437,15 @@ NGHTTP3_EXTERN uint64_t nghttp3_conn_get_frame_payload_left(nghttp3_conn *conn,
*/
#define NGHTTP3_URGENCY_LEVELS (NGHTTP3_URGENCY_LOW + 1)

#define NGHTTP3_PRI_V1 1
#define NGHTTP3_PRI_VERSION NGHTTP3_PRI_V1

/**
* @struct
*
* :type:`nghttp3_pri` represents HTTP priority.
*/
typedef struct nghttp3_pri {
typedef struct NGHTTP3_ALIGN(8) nghttp3_pri {
/**
* :member:`urgency` is the urgency of a stream, it must be in
* [:macro:`NGHTTP3_URGENCY_HIGH`, :macro:`NGHTTP3_URGENCY_LOW`],
Expand All @@ -2435,7 +2458,7 @@ typedef struct nghttp3_pri {
* incrementally. If inc is 1, it can be processed incrementally.
* Other value is not permitted.
*/
int inc;
uint8_t inc;
} nghttp3_pri;

/**
Expand All @@ -2452,26 +2475,53 @@ typedef struct nghttp3_pri {
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
* |stream_id| is not a client initiated bidirectional stream ID.
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found.
*/
NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority(nghttp3_conn *conn,
nghttp3_pri *dest,
int64_t stream_id);
NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority_versioned(
nghttp3_conn *conn, int pri_version, nghttp3_pri *dest, int64_t stream_id);

/**
* @function
*
* `nghttp3_conn_set_client_stream_priority` updates priority of a
* stream denoted by |stream_id| with the value pointed by |data| of
* length |datalen|, which should be a serialized :rfc:`9218` priority
* field value. |stream_id| must identify client initiated
* bidirectional stream.
*
* This function must not be called if |conn| is initialized as
* server.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
* |stream_id| is not a client initiated bidirectional stream ID.
* :macro:`NGHTTP3_ERR_STREAM_NOT_FOUND`
* Stream not found.
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_set_client_stream_priority(nghttp3_conn *conn,
int64_t stream_id,
const uint8_t *data,
size_t datalen);

/**
* @function
*
* `nghttp3_conn_set_stream_priority` updates priority of a stream
* denoted by |stream_id| with the value pointed by |pri|.
* `nghttp3_conn_set_server_stream_priority` updates priority of a
* stream denoted by |stream_id| with the value pointed by |pri|.
* |stream_id| must identify client initiated bidirectional stream.
*
* Both client and server can update stream priority with this
* function.
* This function must not be called if |conn| is initialized as
* client.
*
* If server updates stream priority with this function, it completely
* overrides stream priority set by client and the attempts to update
* priority by client are ignored.
* This function completely overrides stream priority set by client
* and the attempts to update priority by client are ignored.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
Expand All @@ -2483,9 +2533,9 @@ NGHTTP3_EXTERN int nghttp3_conn_get_stream_priority(nghttp3_conn *conn,
* :macro:`NGHTTP3_ERR_NOMEM`
* Out of memory.
*/
NGHTTP3_EXTERN int nghttp3_conn_set_stream_priority(nghttp3_conn *conn,
int64_t stream_id,
const nghttp3_pri *pri);
NGHTTP3_EXTERN int nghttp3_conn_set_server_stream_priority_versioned(
nghttp3_conn *conn, int64_t stream_id, int pri_version,
const nghttp3_pri *pri);

/**
* @function
Expand Down Expand Up @@ -2530,21 +2580,11 @@ NGHTTP3_EXTERN int nghttp3_check_header_value(const uint8_t *value, size_t len);
/**
* @function
*
* `nghttp3_http_parse_priority` parses priority HTTP header field
* stored in the buffer pointed by |value| of length |len|. If it
* successfully processed header field value, it stores the result
* into |*dest|. This function just overwrites what it sees in the
* header field value and does not initialize any field in |*dest|.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
* The function could not parse the provided value.
* `nghttp3_conn_is_drained` returns nonzero if
* `nghttp3_conn_shutdown` has been called, and there is no active
* remote streams. This function is for server use only.
*/
NGHTTP3_EXTERN int nghttp3_http_parse_priority(nghttp3_pri *dest,
const uint8_t *value,
size_t len);
NGHTTP3_EXTERN int nghttp3_conn_is_drained(nghttp3_conn *conn);

/**
* @macrosection
Expand Down Expand Up @@ -2639,6 +2679,24 @@ NGHTTP3_EXTERN int nghttp3_err_is_fatal(int liberr);
(CALLBACKS), NGHTTP3_SETTINGS_VERSION, \
(SETTINGS), (MEM), (USER_DATA))

/*
* `nghttp3_conn_set_server_stream_priority` is a wrapper around
* `nghttp3_conn_set_server_stream_priority_versioned` to set the
* correct struct version.
*/
#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))

/*
* `nghttp3_conn_get_stream_priority` is a wrapper around
* `nghttp3_conn_get_stream_priority_versioned` to set the correct
* struct version.
*/
#define nghttp3_conn_get_stream_priority(CONN, DEST, STREAM_ID) \
nghttp3_conn_get_stream_priority_versioned((CONN), NGHTTP3_PRI_VERSION, \
(DEST), (STREAM_ID))

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 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 "0.11.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 0x000b00

#endif /* NGHTTP3_VERSION_H */
Loading