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.5.0 #51321

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
33 changes: 29 additions & 4 deletions deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h
Original file line number Diff line number Diff line change
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 @@ -2198,6 +2198,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 +2210,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 @@ -2278,9 +2306,6 @@ NGHTTP3_EXTERN void nghttp3_conn_shutdown_stream_write(nghttp3_conn *conn,
* stream, this function returns 0. If the stream has already
* shutdown read-side stream, this function returns 0.
*
* This function does not fail if a stream denoted by |stream_id| is
* not found, although it may fail with the other reasons.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
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 "1.2.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 0x010200

#endif /* NGHTTP3_VERSION_H */
15 changes: 15 additions & 0 deletions deps/ngtcp2/nghttp3/lib/nghttp3_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,21 @@ int nghttp3_conn_add_ack_offset(nghttp3_conn *conn, int64_t stream_id,
return nghttp3_stream_add_ack_offset(stream, n);
}

int nghttp3_conn_update_ack_offset(nghttp3_conn *conn, int64_t stream_id,
uint64_t offset) {
nghttp3_stream *stream = nghttp3_conn_find_stream(conn, stream_id);

if (stream == NULL) {
return 0;
}

if (stream->ack_total > offset) {
return NGHTTP3_ERR_INVALID_ARGUMENT;
}

return nghttp3_stream_add_ack_offset(stream, offset - stream->ack_total);
}

static int conn_submit_headers_data(nghttp3_conn *conn, nghttp3_stream *stream,
const nghttp3_nv *nva, size_t nvlen,
const nghttp3_data_reader *dr) {
Expand Down
2 changes: 1 addition & 1 deletion deps/ngtcp2/nghttp3/lib/nghttp3_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "nghttp3_macro.h"
#include "nghttp3_conv.h"
#include "nghttp3_unreachable.h"
#include "sfparse.h"
#include "sfparse/sfparse.h"

static uint8_t downcase(uint8_t c) {
return 'A' <= c && c <= 'Z' ? (uint8_t)(c - 'A' + 'a') : c;
Expand Down
8 changes: 4 additions & 4 deletions deps/ngtcp2/nghttp3/lib/nghttp3_qpack.h
Original file line number Diff line number Diff line change
Expand Up @@ -880,19 +880,19 @@ int nghttp3_qpack_decoder_dtable_duplicate_add(nghttp3_qpack_decoder *decoder);
int nghttp3_qpack_decoder_dtable_literal_add(nghttp3_qpack_decoder *decoder);

struct nghttp3_qpack_stream_context {
/* state is a current state of reading request stream. */
nghttp3_qpack_request_stream_state state;
/* rstate is a set of intermediate state which are used to process
request stream. */
nghttp3_qpack_read_state rstate;
const nghttp3_mem *mem;
/* opcode is a request stream opcode being processed. */
nghttp3_qpack_request_stream_opcode opcode;
int64_t stream_id;
/* ricnt is Required Insert Count to decode this header block. */
uint64_t ricnt;
/* base is Base in Header Block Prefix. */
uint64_t base;
/* state is a current state of reading request stream. */
nghttp3_qpack_request_stream_state state;
/* opcode is a request stream opcode being processed. */
nghttp3_qpack_request_stream_opcode opcode;
/* dbase_sign is the delta base sign in Header Block Prefix. */
int dbase_sign;
};
Expand Down
1 change: 1 addition & 0 deletions deps/ngtcp2/nghttp3/lib/nghttp3_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,7 @@ int nghttp3_stream_add_ack_offset(nghttp3_stream *stream, uint64_t n) {
}

stream->ack_offset = offset;
stream->ack_total += n;

return 0;
}
Expand Down
11 changes: 7 additions & 4 deletions deps/ngtcp2/nghttp3/lib/nghttp3_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ typedef struct nghttp3_varint_read_state {
typedef struct nghttp3_stream_read_state {
nghttp3_varint_read_state rvint;
nghttp3_frame fr;
int state;
int64_t left;
int state;
} nghttp3_stream_read_state;

/* NGHTTP3_STREAM_FLAG_NONE indicates that no flag is set. */
Expand Down Expand Up @@ -186,16 +186,16 @@ typedef struct nghttp3_stream_callbacks {
} nghttp3_stream_callbacks;

typedef struct nghttp3_http_state {
/* status_code is HTTP status code received. This field is used
if connection is initialized as client. */
int32_t status_code;
/* content_length is the value of received content-length header
field. */
int64_t content_length;
/* recv_content_length is the number of body bytes received so
far. */
int64_t recv_content_length;
nghttp3_pri pri;
/* status_code is HTTP status code received. This field is used
if connection is initialized as client. */
int32_t status_code;
uint32_t flags;
} nghttp3_http_state;

Expand Down Expand Up @@ -233,6 +233,9 @@ struct nghttp3_stream {
they are acknowledged inside the first outq element if it is of
type NGHTTP3_BUF_TYPE_ALIEN. */
uint64_t ack_done;
/* ack_total is the cumulative number of bytes acknowledged so
far. */
uint64_t ack_total;
uint64_t unscheduled_nwrite;
nghttp3_stream_type type;
nghttp3_stream_read_state rstate;
Expand Down
Loading
Loading