Skip to content

Commit 840c1a7

Browse files
pimterrygithub-actions[bot]
authored andcommitted
deps: update nghttp2 to 1.69.0
1 parent 58a237b commit 840c1a7

20 files changed

Lines changed: 4558 additions & 4323 deletions

deps/nghttp2/lib/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ set(NGHTTP2_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
5151
set(NGHTTP2_VERSION_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
5252
set(NGHTTP2_PROJECT_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
5353
set(NGHTTP2_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
54-
set(NGHTTP2_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
54+
set(NGHTTP2_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
5555
set(NGHTTP2_NAMESPACE "${PROJECT_NAME}::")
5656
set(NGHTTP2_VERSION ${PROJECT_VERSION})
5757

deps/nghttp2/lib/includes/nghttp2/nghttp2.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3252,7 +3252,7 @@ NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option,
32523252
* regenerated per second. When a suspicious activity is detected,
32533253
* some amount of tokens are consumed. If there is no token
32543254
* available, GOAWAY is sent to tear down the connection. |burst| and
3255-
* |rate| default to 1000 and 33 respectively.
3255+
* |rate| default to 10000 and 330 respectively.
32563256
*/
32573257
NGHTTP2_EXTERN void nghttp2_option_set_glitch_rate_limit(nghttp2_option *option,
32583258
uint64_t burst,

deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@
2929
* @macro
3030
* Version number of the nghttp2 library release
3131
*/
32-
#define NGHTTP2_VERSION "1.68.0"
32+
#define NGHTTP2_VERSION "1.69.0"
3333

3434
/**
3535
* @macro
3636
* Numerical representation of the version number of the nghttp2 library
3737
* release. This is a 24 bit number with 8 bits for major number, 8 bits
3838
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
3939
*/
40-
#define NGHTTP2_VERSION_NUM 0x014400
40+
#define NGHTTP2_VERSION_NUM 0x014500
4141

4242
#endif /* NGHTTP2VER_H */

deps/nghttp2/lib/nghttp2_alpn.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
#include <string.h>
2828

29+
#include "nghttp2_helper.h"
30+
2931
static int select_alpn(const unsigned char **out, unsigned char *outlen,
3032
const unsigned char *in, unsigned int inlen,
3133
const char *key, unsigned int keylen) {
@@ -41,7 +43,7 @@ static int select_alpn(const unsigned char **out, unsigned char *outlen,
4143
}
4244

4345
#define NGHTTP2_HTTP_1_1_ALPN "\x8http/1.1"
44-
#define NGHTTP2_HTTP_1_1_ALPN_LEN (sizeof(NGHTTP2_HTTP_1_1_ALPN) - 1)
46+
#define NGHTTP2_HTTP_1_1_ALPN_LEN nghttp2_strlen_lit(NGHTTP2_HTTP_1_1_ALPN)
4547

4648
int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen,
4749
const unsigned char *in, unsigned int inlen) {

deps/nghttp2/lib/nghttp2_frame.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,16 @@ void nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame,
750750
uint8_t *p;
751751

752752
altsvc = frame->payload;
753+
754+
if (payloadlen == 0) {
755+
altsvc->origin = NULL;
756+
altsvc->origin_len = 0;
757+
altsvc->field_value = NULL;
758+
altsvc->field_value_len = 0;
759+
760+
return;
761+
}
762+
753763
p = payload;
754764

755765
altsvc->origin = p;

deps/nghttp2/lib/nghttp2_frame.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,7 @@
3434
#include "nghttp2_buf.h"
3535

3636
#define NGHTTP2_STREAM_ID_MASK ((1u << 31) - 1)
37-
#define NGHTTP2_PRI_GROUP_ID_MASK ((1u << 31) - 1)
38-
#define NGHTTP2_PRIORITY_MASK ((1u << 31) - 1)
3937
#define NGHTTP2_WINDOW_SIZE_INCREMENT_MASK ((1u << 31) - 1)
40-
#define NGHTTP2_SETTINGS_ID_MASK ((1 << 24) - 1)
4138

4239
/* The number of bytes of frame header. */
4340
#define NGHTTP2_FRAME_HDLEN 9

deps/nghttp2/lib/nghttp2_hd.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@
3535
/* Make scalar initialization form of nghttp2_hd_entry */
3636
#define MAKE_STATIC_ENT(N, V, T, H) \
3737
{ \
38-
{NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1}, \
39-
{NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \
40-
{(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \
38+
{NULL, NULL, (uint8_t *)(N), nghttp2_strlen_lit((N)), -1}, \
39+
{NULL, NULL, (uint8_t *)(V), nghttp2_strlen_lit((V)), -1}, \
40+
{(uint8_t *)(N), (uint8_t *)(V), nghttp2_strlen_lit((N)), \
41+
nghttp2_strlen_lit((V)), 0}, \
4142
T, \
4243
H, \
4344
}
@@ -2058,8 +2059,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
20582059

20592060
inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF;
20602061

2061-
rv =
2062-
nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, mem);
2062+
rv = nghttp2_rcbuf_new(
2063+
&inflater->namercbuf,
2064+
nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem);
20632065
} else {
20642066
inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME;
20652067
rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left + 1, mem);
@@ -2143,8 +2145,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,
21432145

21442146
inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF;
21452147

2146-
rv =
2147-
nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, mem);
2148+
rv = nghttp2_rcbuf_new(
2149+
&inflater->valuercbuf,
2150+
nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem);
21482151
} else {
21492152
inflater->state = NGHTTP2_HD_STATE_READ_VALUE;
21502153

deps/nghttp2/lib/nghttp2_hd_huffman.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src,
104104
}
105105

106106
void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx) {
107-
ctx->fstate = NGHTTP2_HUFF_ACCEPTED;
107+
ctx->fstate = 0;
108+
ctx->flags = NGHTTP2_HUFF_ACCEPTED;
108109
}
109110

110111
nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
111112
nghttp2_buf *buf, const uint8_t *src,
112113
size_t srclen, int final) {
113114
const uint8_t *end = src + srclen;
114-
nghttp2_huff_decode node = {ctx->fstate, 0};
115-
const nghttp2_huff_decode *t = &node;
115+
nghttp2_huff_decode t = {ctx->fstate, ctx->flags, 0};
116116
uint8_t c;
117117

118118
/* We use the decoding algorithm described in
@@ -121,20 +121,21 @@ nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx,
121121
- https://github.com/nghttp2/nghttp2/files/15141264/Prefix.pdf */
122122
for (; src != end;) {
123123
c = *src++;
124-
t = &huff_decode_table[t->fstate & 0x1ff][c >> 4];
125-
if (t->fstate & NGHTTP2_HUFF_SYM) {
126-
*buf->last++ = t->sym;
124+
t = huff_decode_table[t.fstate][c >> 4];
125+
if (t.flags & NGHTTP2_HUFF_SYM) {
126+
*buf->last++ = t.sym;
127127
}
128128

129-
t = &huff_decode_table[t->fstate & 0x1ff][c & 0xf];
130-
if (t->fstate & NGHTTP2_HUFF_SYM) {
131-
*buf->last++ = t->sym;
129+
t = huff_decode_table[t.fstate][c & 0xf];
130+
if (t.flags & NGHTTP2_HUFF_SYM) {
131+
*buf->last++ = t.sym;
132132
}
133133
}
134134

135-
ctx->fstate = t->fstate;
135+
ctx->fstate = t.fstate;
136+
ctx->flags = t.flags;
136137

137-
if (final && !(ctx->fstate & NGHTTP2_HUFF_ACCEPTED)) {
138+
if (final && !(ctx->flags & NGHTTP2_HUFF_ACCEPTED)) {
138139
return NGHTTP2_ERR_HEADER_COMP;
139140
}
140141

deps/nghttp2/lib/nghttp2_hd_huffman.h

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
typedef enum {
3535
/* FSA accepts this state as the end of huffman encoding
3636
sequence. */
37-
NGHTTP2_HUFF_ACCEPTED = 1 << 14,
37+
NGHTTP2_HUFF_ACCEPTED = 1,
3838
/* This state emits symbol */
39-
NGHTTP2_HUFF_SYM = 1 << 15,
39+
NGHTTP2_HUFF_SYM = 1 << 1,
4040
} nghttp2_huff_decode_flag;
4141

4242
typedef struct {
@@ -48,6 +48,7 @@ typedef struct {
4848
a special node and it is a terminal state that means decoding
4949
failed. */
5050
uint16_t fstate;
51+
uint8_t flags;
5152
/* symbol if NGHTTP2_HUFF_SYM flag set */
5253
uint8_t sym;
5354
} nghttp2_huff_decode;
@@ -57,6 +58,7 @@ typedef nghttp2_huff_decode huff_decode_table_type[16];
5758
typedef struct {
5859
/* fstate is the current huffman decoding state. */
5960
uint16_t fstate;
61+
uint8_t flags;
6062
} nghttp2_hd_huff_decode_context;
6163

6264
typedef struct {
@@ -69,4 +71,12 @@ typedef struct {
6971
extern const nghttp2_huff_sym huff_sym_table[];
7072
extern const nghttp2_huff_decode huff_decode_table[][16];
7173

74+
/*
75+
* nghttp2_huff_estimate_decode_length returns the estimated decoded
76+
* length of the huffman encoded string of length |len|.
77+
*/
78+
static inline size_t nghttp2_huff_estimate_decode_length(size_t len) {
79+
return len * 8 / 5;
80+
}
81+
7282
#endif /* !defined(NGHTTP2_HD_HUFFMAN_H) */

0 commit comments

Comments
 (0)