Skip to content

Commit 7301dfd

Browse files
deps: update nghttp3 to 1.2.0
1 parent 792842f commit 7301dfd

File tree

9 files changed

+59
-1567
lines changed

9 files changed

+59
-1567
lines changed

deps/ngtcp2/nghttp3/lib/includes/nghttp3/nghttp3.h

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ typedef struct nghttp3_buf {
624624
*/
625625
uint8_t *end;
626626
/**
627-
* :member:`pos` pointers to the start of data. Typically, this
627+
* :member:`pos` points to the start of data. Typically, this
628628
* points to the address that next data should be read. Initially,
629629
* it points to :member:`begin`.
630630
*/
@@ -2198,6 +2198,9 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
21982198
* If a stream denoted by |stream_id| is not found, this function
21992199
* returns 0.
22002200
*
2201+
* Alternatively, `nghttp3_conn_update_ack_offset` can be used to
2202+
* accomplish the same thing.
2203+
*
22012204
* This function returns 0 if it succeeds, or one of the following
22022205
* negative error codes:
22032206
*
@@ -2207,6 +2210,31 @@ NGHTTP3_EXTERN int nghttp3_conn_add_write_offset(nghttp3_conn *conn,
22072210
NGHTTP3_EXTERN int nghttp3_conn_add_ack_offset(nghttp3_conn *conn,
22082211
int64_t stream_id, uint64_t n);
22092212

2213+
/**
2214+
* @function
2215+
*
2216+
* `nghttp3_conn_update_ack_offset` tells |conn| that QUIC stack has
2217+
* acknowledged the stream data up to |offset| for a stream denoted by
2218+
* |stream_id|.
2219+
*
2220+
* If a stream denoted by |stream_id| is not found, this function
2221+
* returns 0.
2222+
*
2223+
* Alternatively, `nghttp3_conn_add_ack_offset` can be used to
2224+
* accomplish the same thing.
2225+
*
2226+
* This function returns 0 if it succeeds, or one of the following
2227+
* negative error codes:
2228+
*
2229+
* :macro:`NGHTTP3_ERR_INVALID_ARGUMENT`
2230+
* |offset| is less than the number of bytes acknowledged so far.
2231+
* :macro:`NGHTTP3_ERR_CALLBACK_FAILURE`
2232+
* User callback failed.
2233+
*/
2234+
NGHTTP3_EXTERN int nghttp3_conn_update_ack_offset(nghttp3_conn *conn,
2235+
int64_t stream_id,
2236+
uint64_t offset);
2237+
22102238
/**
22112239
* @function
22122240
*

deps/ngtcp2/nghttp3/lib/includes/nghttp3/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*
3232
* Version number of the nghttp3 library release.
3333
*/
34-
#define NGHTTP3_VERSION "1.1.0"
34+
#define NGHTTP3_VERSION "1.2.0"
3535

3636
/**
3737
* @macro
@@ -41,6 +41,6 @@
4141
* number, 8 bits for minor and 8 bits for patch. Version 1.2.3
4242
* becomes 0x010203.
4343
*/
44-
#define NGHTTP3_VERSION_NUM 0x010100
44+
#define NGHTTP3_VERSION_NUM 0x010200
4545

4646
#endif /* NGHTTP3_VERSION_H */

deps/ngtcp2/nghttp3/lib/nghttp3_conn.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,6 +2098,21 @@ int nghttp3_conn_add_ack_offset(nghttp3_conn *conn, int64_t stream_id,
20982098
return nghttp3_stream_add_ack_offset(stream, n);
20992099
}
21002100

2101+
int nghttp3_conn_update_ack_offset(nghttp3_conn *conn, int64_t stream_id,
2102+
uint64_t offset) {
2103+
nghttp3_stream *stream = nghttp3_conn_find_stream(conn, stream_id);
2104+
2105+
if (stream == NULL) {
2106+
return 0;
2107+
}
2108+
2109+
if (stream->ack_total > offset) {
2110+
return NGHTTP3_ERR_INVALID_ARGUMENT;
2111+
}
2112+
2113+
return nghttp3_stream_add_ack_offset(stream, offset - stream->ack_total);
2114+
}
2115+
21012116
static int conn_submit_headers_data(nghttp3_conn *conn, nghttp3_stream *stream,
21022117
const nghttp3_nv *nva, size_t nvlen,
21032118
const nghttp3_data_reader *dr) {

deps/ngtcp2/nghttp3/lib/nghttp3_http.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include "nghttp3_macro.h"
3333
#include "nghttp3_conv.h"
3434
#include "nghttp3_unreachable.h"
35-
#include "sfparse.h"
35+
#include "sfparse/sfparse.h"
3636

3737
static uint8_t downcase(uint8_t c) {
3838
return 'A' <= c && c <= 'Z' ? (uint8_t)(c - 'A' + 'a') : c;

deps/ngtcp2/nghttp3/lib/nghttp3_qpack.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -880,19 +880,19 @@ int nghttp3_qpack_decoder_dtable_duplicate_add(nghttp3_qpack_decoder *decoder);
880880
int nghttp3_qpack_decoder_dtable_literal_add(nghttp3_qpack_decoder *decoder);
881881

882882
struct nghttp3_qpack_stream_context {
883-
/* state is a current state of reading request stream. */
884-
nghttp3_qpack_request_stream_state state;
885883
/* rstate is a set of intermediate state which are used to process
886884
request stream. */
887885
nghttp3_qpack_read_state rstate;
888886
const nghttp3_mem *mem;
889-
/* opcode is a request stream opcode being processed. */
890-
nghttp3_qpack_request_stream_opcode opcode;
891887
int64_t stream_id;
892888
/* ricnt is Required Insert Count to decode this header block. */
893889
uint64_t ricnt;
894890
/* base is Base in Header Block Prefix. */
895891
uint64_t base;
892+
/* state is a current state of reading request stream. */
893+
nghttp3_qpack_request_stream_state state;
894+
/* opcode is a request stream opcode being processed. */
895+
nghttp3_qpack_request_stream_opcode opcode;
896896
/* dbase_sign is the delta base sign in Header Block Prefix. */
897897
int dbase_sign;
898898
};

deps/ngtcp2/nghttp3/lib/nghttp3_stream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -979,6 +979,7 @@ int nghttp3_stream_add_ack_offset(nghttp3_stream *stream, uint64_t n) {
979979
}
980980

981981
stream->ack_offset = offset;
982+
stream->ack_total += n;
982983

983984
return 0;
984985
}

deps/ngtcp2/nghttp3/lib/nghttp3_stream.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ typedef struct nghttp3_varint_read_state {
8888
typedef struct nghttp3_stream_read_state {
8989
nghttp3_varint_read_state rvint;
9090
nghttp3_frame fr;
91-
int state;
9291
int64_t left;
92+
int state;
9393
} nghttp3_stream_read_state;
9494

9595
/* NGHTTP3_STREAM_FLAG_NONE indicates that no flag is set. */
@@ -186,16 +186,16 @@ typedef struct nghttp3_stream_callbacks {
186186
} nghttp3_stream_callbacks;
187187

188188
typedef struct nghttp3_http_state {
189-
/* status_code is HTTP status code received. This field is used
190-
if connection is initialized as client. */
191-
int32_t status_code;
192189
/* content_length is the value of received content-length header
193190
field. */
194191
int64_t content_length;
195192
/* recv_content_length is the number of body bytes received so
196193
far. */
197194
int64_t recv_content_length;
198195
nghttp3_pri pri;
196+
/* status_code is HTTP status code received. This field is used
197+
if connection is initialized as client. */
198+
int32_t status_code;
199199
uint32_t flags;
200200
} nghttp3_http_state;
201201

@@ -233,6 +233,9 @@ struct nghttp3_stream {
233233
they are acknowledged inside the first outq element if it is of
234234
type NGHTTP3_BUF_TYPE_ALIEN. */
235235
uint64_t ack_done;
236+
/* ack_total is the cumulative number of bytes acknowledged so
237+
far. */
238+
uint64_t ack_total;
236239
uint64_t unscheduled_nwrite;
237240
nghttp3_stream_type type;
238241
nghttp3_stream_read_state rstate;

0 commit comments

Comments
 (0)