| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 04ce9df commit 537825a
20 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -51,7 +51,7 @@ set(NGHTTP2_GENERATED_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") | |||
| 51 | 51 | set(NGHTTP2_VERSION_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}ConfigVersion.cmake") | |
| 52 | 52 | set(NGHTTP2_PROJECT_CONFIG "${NGHTTP2_GENERATED_DIR}/${PROJECT_NAME}Config.cmake") | |
| 53 | 53 | 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}") | ||
| 55 | 55 | set(NGHTTP2_NAMESPACE "${PROJECT_NAME}::") | |
| 56 | 56 | set(NGHTTP2_VERSION ${PROJECT_VERSION}) | |
| 57 | 57 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3252,7 +3252,7 @@ NGHTTP2_EXTERN void nghttp2_option_set_max_continuations(nghttp2_option *option, | |||
| 3252 | 3252 | * regenerated per second. When a suspicious activity is detected, | |
| 3253 | 3253 | * some amount of tokens are consumed. If there is no token | |
| 3254 | 3254 | * 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. | ||
| 3256 | 3256 | */ | |
| 3257 | 3257 | NGHTTP2_EXTERN void nghttp2_option_set_glitch_rate_limit(nghttp2_option *option, | |
| 3258 | 3258 | uint64_t burst, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,14 +29,14 @@ | |||
| 29 | 29 | * @macro | |
| 30 | 30 | * Version number of the nghttp2 library release | |
| 31 | 31 | */ | |
| 32 | - #define NGHTTP2_VERSION "1.68.0" | ||
| 32 | + #define NGHTTP2_VERSION "1.69.0" | ||
| 33 | 33 | ||
| 34 | 34 | /** | |
| 35 | 35 | * @macro | |
| 36 | 36 | * Numerical representation of the version number of the nghttp2 library | |
| 37 | 37 | * release. This is a 24 bit number with 8 bits for major number, 8 bits | |
| 38 | 38 | * for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203. | |
| 39 | 39 | */ | |
| 40 | - #define NGHTTP2_VERSION_NUM 0x014400 | ||
| 40 | + #define NGHTTP2_VERSION_NUM 0x014500 | ||
| 41 | 41 | ||
| 42 | 42 | #endif /* NGHTTP2VER_H */ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,8 @@ | |||
| 26 | 26 | ||
| 27 | 27 | #include <string.h> | |
| 28 | 28 | ||
| 29 | + #include "nghttp2_helper.h" | ||
| 30 | + | ||
| 29 | 31 | static int select_alpn(const unsigned char **out, unsigned char *outlen, | |
| 30 | 32 | const unsigned char *in, unsigned int inlen, | |
| 31 | 33 | const char *key, unsigned int keylen) { | |
@@ -41,7 +43,7 @@ static int select_alpn(const unsigned char **out, unsigned char *outlen, | |||
| 41 | 43 | } | |
| 42 | 44 | ||
| 43 | 45 | #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) | ||
| 45 | 47 | ||
| 46 | 48 | int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen, | |
| 47 | 49 | const unsigned char *in, unsigned int inlen) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -750,6 +750,16 @@ void nghttp2_frame_unpack_altsvc_payload(nghttp2_extension *frame, | |||
| 750 | 750 | uint8_t *p; | |
| 751 | 751 | ||
| 752 | 752 | 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 | + | ||
| 753 | 763 | p = payload; | |
| 754 | 764 | ||
| 755 | 765 | altsvc->origin = p; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,10 +34,7 @@ | |||
| 34 | 34 | #include "nghttp2_buf.h" | |
| 35 | 35 | ||
| 36 | 36 | #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) | ||
| 39 | 37 | #define NGHTTP2_WINDOW_SIZE_INCREMENT_MASK ((1u << 31) - 1) | |
| 40 | - #define NGHTTP2_SETTINGS_ID_MASK ((1 << 24) - 1) | ||
| 41 | 38 | ||
| 42 | 39 | /* The number of bytes of frame header. */ | |
| 43 | 40 | #define NGHTTP2_FRAME_HDLEN 9 | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,9 +35,10 @@ | |||
| 35 | 35 | /* Make scalar initialization form of nghttp2_hd_entry */ | |
| 36 | 36 | #define MAKE_STATIC_ENT(N, V, T, H) \ | |
| 37 | 37 | { \ | |
| 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}, \ | ||
| 41 | 42 | T, \ | |
| 42 | 43 | H, \ | |
| 43 | 44 | } | |
@@ -2058,8 +2059,9 @@ nghttp2_ssize nghttp2_hd_inflate_hd_nv(nghttp2_hd_inflater *inflater, | |||
| 2058 | 2059 | ||
| 2059 | 2060 | inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAMEHUFF; | |
| 2060 | 2061 | ||
| 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); | ||
| 2063 | 2065 | } else { | |
| 2064 | 2066 | inflater->state = NGHTTP2_HD_STATE_NEWNAME_READ_NAME; | |
| 2065 | 2067 | 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, | |||
| 2143 | 2145 | ||
| 2144 | 2146 | inflater->state = NGHTTP2_HD_STATE_READ_VALUEHUFF; | |
| 2145 | 2147 | ||
| 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); | ||
| 2148 | 2151 | } else { | |
| 2149 | 2152 | inflater->state = NGHTTP2_HD_STATE_READ_VALUE; | |
| 2150 | 2153 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -104,15 +104,15 @@ int nghttp2_hd_huff_encode(nghttp2_bufs *bufs, const uint8_t *src, | |||
| 104 | 104 | } | |
| 105 | 105 | ||
| 106 | 106 | 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; | ||
| 108 | 109 | } | |
| 109 | 110 | ||
| 110 | 111 | nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, | |
| 111 | 112 | nghttp2_buf *buf, const uint8_t *src, | |
| 112 | 113 | size_t srclen, int final) { | |
| 113 | 114 | 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}; | ||
| 116 | 116 | uint8_t c; | |
| 117 | 117 | ||
| 118 | 118 | /* We use the decoding algorithm described in | |
@@ -121,20 +121,21 @@ nghttp2_ssize nghttp2_hd_huff_decode(nghttp2_hd_huff_decode_context *ctx, | |||
| 121 | 121 | - https://github.com/nghttp2/nghttp2/files/15141264/Prefix.pdf */ | |
| 122 | 122 | for (; src != end;) { | |
| 123 | 123 | 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; | ||
| 127 | 127 | } | |
| 128 | 128 | ||
| 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; | ||
| 132 | 132 | } | |
| 133 | 133 | } | |
| 134 | 134 | ||
| 135 | - ctx->fstate = t->fstate; | ||
| 135 | + ctx->fstate = t.fstate; | ||
| 136 | + ctx->flags = t.flags; | ||
| 136 | 137 | ||
| 137 | - if (final && !(ctx->fstate & NGHTTP2_HUFF_ACCEPTED)) { | ||
| 138 | + if (final && !(ctx->flags & NGHTTP2_HUFF_ACCEPTED)) { | ||
| 138 | 139 | return NGHTTP2_ERR_HEADER_COMP; | |
| 139 | 140 | } | |
| 140 | 141 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -34,9 +34,9 @@ | |||
| 34 | 34 | typedef enum { | |
| 35 | 35 | /* FSA accepts this state as the end of huffman encoding | |
| 36 | 36 | sequence. */ | |
| 37 | - NGHTTP2_HUFF_ACCEPTED = 1 << 14, | ||
| 37 | + NGHTTP2_HUFF_ACCEPTED = 1, | ||
| 38 | 38 | /* This state emits symbol */ | |
| 39 | - NGHTTP2_HUFF_SYM = 1 << 15, | ||
| 39 | + NGHTTP2_HUFF_SYM = 1 << 1, | ||
| 40 | 40 | } nghttp2_huff_decode_flag; | |
| 41 | 41 | ||
| 42 | 42 | typedef struct { | |
@@ -48,6 +48,7 @@ typedef struct { | |||
| 48 | 48 | a special node and it is a terminal state that means decoding | |
| 49 | 49 | failed. */ | |
| 50 | 50 | uint16_t fstate; | |
| 51 | + uint8_t flags; | ||
| 51 | 52 | /* symbol if NGHTTP2_HUFF_SYM flag set */ | |
| 52 | 53 | uint8_t sym; | |
| 53 | 54 | } nghttp2_huff_decode; | |
@@ -57,6 +58,7 @@ typedef nghttp2_huff_decode huff_decode_table_type[16]; | |||
| 57 | 58 | typedef struct { | |
| 58 | 59 | /* fstate is the current huffman decoding state. */ | |
| 59 | 60 | uint16_t fstate; | |
| 61 | + uint8_t flags; | ||
| 60 | 62 | } nghttp2_hd_huff_decode_context; | |
| 61 | 63 | ||
| 62 | 64 | typedef struct { | |
@@ -69,4 +71,12 @@ typedef struct { | |||
| 69 | 71 | extern const nghttp2_huff_sym huff_sym_table[]; | |
| 70 | 72 | extern const nghttp2_huff_decode huff_decode_table[][16]; | |
| 71 | 73 | ||
| 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 | + | ||
| 72 | 82 | #endif /* !defined(NGHTTP2_HD_HUFFMAN_H) */ | |
| Back | FazBrowse Home | New Git URL |
0 commit comments