Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ set(NGHTTP2_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated")
set(NGHTTP2_VERSION_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
set(NGHTTP2_PROJECT_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}Config.cmake")
set(NGHTTP2_TARGETS_EXPORT_NAME "${PROJECT_NAME}Targets")
set(NGHTTP2_CONFIG_INSTALL_DIR "lib/cmake/${PROJECT_NAME}")
set(NGHTTP2_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
set(NGHTTP2_NAMESPACE "${PROJECT_NAME}::")
set(NGHTTP2_VERSION ${PROJECT_VERSION})

Expand Down
2 changes: 1 addition & 1 deletion deps/nghttp2/lib/includes/nghttp2/nghttp2.h
Original file line number Diff line number Diff line change
Expand Up @@ -3252,7 +3252,7 @@ NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option,
* regenerated per second. When a suspicious activity is detected,
* some amount of tokens are consumed. If there is no token
* available, GOAWAY is sent to tear down the connection. |burst| and
* |rate| default to 1000 and 33 respectively.
* |rate| default to 10000 and 330 respectively.
*/
NGHTTP2_EXTERN void nghttp2_option_set_glitch_rate_limit(nghttp2_option *option,
uint64_t burst,
Expand Down
4 changes: 2 additions & 2 deletions deps/nghttp2/lib/includes/nghttp2/nghttp2ver.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@
* @macro
* Version number of the nghttp2 library release
*/
#define NGHTTP2_VERSION "1.68.0"
#define NGHTTP2_VERSION "1.69.0"

/**
* @macro
* Numerical representation of the version number of the nghttp2 library
* release. This is a 24 bit number with 8 bits for major number, 8 bits
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
*/
#define NGHTTP2_VERSION_NUM 0x014400
#define NGHTTP2_VERSION_NUM 0x014500

#endif /* NGHTTP2VER_H */
4 changes: 3 additions & 1 deletion deps/nghttp2/lib/nghttp2_alpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include <string.h>

#include "nghttp2_helper.h"

static int select_alpn(const unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen,
const char *key, unsigned int keylen) {
Expand All @@ -41,7 +43,7 @@ static int select_alpn(const unsigned char **out, unsigned char *outlen,
}

#define NGHTTP2_HTTP_1_1_ALPN "\x8http/1.1"
#define NGHTTP2_HTTP_1_1_ALPN_LEN (sizeof(NGHTTP2_HTTP_1_1_ALPN) - 1)
#define NGHTTP2_HTTP_1_1_ALPN_LEN nghttp2_strlen_lit(NGHTTP2_HTTP_1_1_ALPN)

int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen,
const unsigned char *in, unsigned int inlen) {
Expand Down
10 changes: 10 additions & 0 deletions deps/nghttp2/lib/nghttp2_frame.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,16 @@ void nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame,
uint8_t *p;

altsvc = frame->payload;

if (payloadlen == 0) {
altsvc->origin = NULL;
altsvc->origin_len = 0;
altsvc->field_value = NULL;
altsvc->field_value_len = 0;

return;
}

p = payload;

altsvc->origin = p;
Expand Down
3 changes: 0 additions & 3 deletions deps/nghttp2/lib/nghttp2_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,7 @@
#include "nghttp2_buf.h"

#define NGHTTP2_STREAM_ID_MASK ((1u << 31) - 1)
#define NGHTTP2_PRI_GROUP_ID_MASK ((1u << 31) - 1)
#define NGHTTP2_PRIORITY_MASK ((1u << 31) - 1)
#define NGHTTP2_WINDOW_SIZE_INCREMENT_MASK ((1u << 31) - 1)
#define NGHTTP2_SETTINGS_ID_MASK ((1 << 24) - 1)

/* The number of bytes of frame header. */
#define NGHTTP2_FRAME_HDLEN 9
Expand Down
17 changes: 10 additions & 7 deletions deps/nghttp2/lib/nghttp2_hd.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@
/* Make scalar initialization form of nghttp2_hd_entry */
#define MAKE_STATIC_ENT(N, V, T, H) \
{ \
{NULL, NULL, (uint8_t *)(N), sizeof((N)) - 1, -1}, \
{NULL, NULL, (uint8_t *)(V), sizeof((V)) - 1, -1}, \
{(uint8_t *)(N), (uint8_t *)(V), sizeof((N)) - 1, sizeof((V)) - 1, 0}, \
{NULL, NULL, (uint8_t *)(N), nghttp2_strlen_lit((N)), -1}, \
{NULL, NULL, (uint8_t *)(V), nghttp2_strlen_lit((V)), -1}, \
{(uint8_t *)(N), (uint8_t *)(V), nghttp2_strlen_lit((N)), \
nghttp2_strlen_lit((V)), 0}, \
T, \
H, \
}
Expand Down Expand Up @@ -2058,8 +2059,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,

inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF;

rv =
nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left * 2 + 1, mem);
rv = nghttp2_rcbuf_new(
&inflater->namercbuf,
nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem);
} else {
inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME;
rv = nghttp2_rcbuf_new(&inflater->namercbuf, inflater->left + 1, mem);
Expand Down Expand Up @@ -2143,8 +2145,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater,

inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF;

rv =
nghttp2_rcbuf_new(&inflater->valuercbuf, inflater->left * 2 + 1, mem);
rv = nghttp2_rcbuf_new(
&inflater->valuercbuf,
nghttp2_huff_estimate_decode_length(inflater->left) + 1, mem);
} else {
inflater->state = NGHTTP2_HD_STATE_READ_VALUE;

Expand Down
23 changes: 12 additions & 11 deletions deps/nghttp2/lib/nghttp2_hd_huffman.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,15 @@ int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src,
}

void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx) {
ctx->fstate = NGHTTP2_HUFF_ACCEPTED;
ctx->fstate = 0;
ctx->flags = NGHTTP2_HUFF_ACCEPTED;
}

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

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

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

ctx->fstate = t->fstate;
ctx->fstate = t.fstate;
ctx->flags = t.flags;

if (final && !(ctx->fstate & NGHTTP2_HUFF_ACCEPTED)) {
if (final && !(ctx->flags & NGHTTP2_HUFF_ACCEPTED)) {
return NGHTTP2_ERR_HEADER_COMP;
}

Expand Down
14 changes: 12 additions & 2 deletions deps/nghttp2/lib/nghttp2_hd_huffman.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
typedef enum {
/* FSA accepts this state as the end of huffman encoding
sequence. */
NGHTTP2_HUFF_ACCEPTED = 1 << 14,
NGHTTP2_HUFF_ACCEPTED = 1,
/* This state emits symbol */
NGHTTP2_HUFF_SYM = 1 << 15,
NGHTTP2_HUFF_SYM = 1 << 1,
} nghttp2_huff_decode_flag;

typedef struct {
Expand All @@ -48,6 +48,7 @@ typedef struct {
a special node and it is a terminal state that means decoding
failed. */
uint16_t fstate;
uint8_t flags;
/* symbol if NGHTTP2_HUFF_SYM flag set */
uint8_t sym;
} nghttp2_huff_decode;
Expand All @@ -57,6 +58,7 @@ typedef nghttp2_huff_decode huff_decode_table_type[16];
typedef struct {
/* fstate is the current huffman decoding state. */
uint16_t fstate;
uint8_t flags;
} nghttp2_hd_huff_decode_context;

typedef struct {
Expand All @@ -69,4 +71,12 @@ typedef struct {
extern const nghttp2_huff_sym huff_sym_table[];
extern const nghttp2_huff_decode huff_decode_table[][16];

/*
* nghttp2_huff_estimate_decode_length returns the estimated decoded
* length of the huffman encoded string of length |len|.
*/
static inline size_t nghttp2_huff_estimate_decode_length(size_t len) {
return len * 8 / 5;
}

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