Release 2.22.0

- [FEATURE] Extensible HTTP Priorities (HTTP/3 only).
- [FEATURE] Add conn context to packet-out memory interface (PR #175).
- [BUGFIX] gQUIC proof generation: allocate buffer big enough for
  signature (issue #173).
- [BUGFIX] Make library thread-safe: drop use of global variables
  (issue #133, issue #167).
- [BUGFIX] Deactivate only *recent* HQ frame, not any HQ frame.
- [BUGFIX] gQUIC server: associate compressed cert with SSL_CTX,
  instead of keeping them in a separate hash, potentially leading
  to mismatches.
- [BUGFIX] Stream data discard infinite loop: break on FIN.
- cmake: add install target via -DCMAKE_INSTALL_PREFIX (PR #171).
- Support randomized packet number to begin a connection.
- Mini and full IETF connection size optimization.
- http_client: specify HTTP priorities based on stream conditions.
This commit is contained in:
Dmitri Tikhonov 2020-10-07 09:41:26 -04:00
parent cb1e8c1022
commit fbc6cc0413
55 changed files with 6557 additions and 391 deletions

View file

@ -18,6 +18,11 @@ struct test
{
int lineno;
enum {
TEST_NO_FLAGS = 0,
TEST_NUL_OUT_LEST_FULL = 1 << 0,
} flags;
unsigned char input[0x100];
size_t input_sz;
@ -30,6 +35,7 @@ static const struct test tests[] =
{
{
__LINE__,
TEST_NO_FLAGS,
{
0x03,
0x04,
@ -42,6 +48,7 @@ static const struct test tests[] =
{
__LINE__,
TEST_NO_FLAGS,
{
HQFT_MAX_PUSH_ID,
0x02,
@ -54,6 +61,7 @@ static const struct test tests[] =
{
__LINE__,
TEST_NO_FLAGS,
{
HQFT_SETTINGS,
0x00,
@ -65,6 +73,7 @@ static const struct test tests[] =
{ /* Frame contents do not match frame length */
__LINE__,
TEST_NO_FLAGS,
{
HQFT_MAX_PUSH_ID,
0x03,
@ -77,6 +86,7 @@ static const struct test tests[] =
{
__LINE__,
TEST_NO_FLAGS,
{
HQFT_SETTINGS,
13,
@ -93,6 +103,58 @@ static const struct test tests[] =
,
},
{
__LINE__,
TEST_NO_FLAGS,
{
0x80, 0x0F, 0x07, 0x00, /* HQFT_PRIORITY_UPDATE_STREAM */
7,
0x52, 0x34,
0x41, 0x42, 0x43, 0x44, 0x45, /* ABCDE */
HQFT_MAX_PUSH_ID,
0x02,
0x41, 0x23,
},
16,
0,
"on_priority_update: stream=0x1234, [ABCDE]\n"
"on_max_push_id: 291\n"
,
},
{
__LINE__,
TEST_NO_FLAGS,
{
0x80, 0x0F, 0x07, 0x01, /* HQFT_PRIORITY_UPDATE_PUSH */
6,
0x08,
0x50, 0x51, 0x52, 0x53, 0x54, /* PQRST */
},
11,
0,
"on_priority_update: push=0x8, [PQRST]\n"
,
},
{
__LINE__,
TEST_NUL_OUT_LEST_FULL,
{
0x80, 0x0F, 0x07, 0x01, /* HQFT_PRIORITY_UPDATE_PUSH */
21,
0x08,
0x50, 0x51, 0x52, 0x53, 0x54, /* PQRST */
0x50, 0x51, 0x52, 0x53, 0x54, /* PQRST */
0x50, 0x51, 0x52, 0x53, 0x54, /* PQRST */
0x50, 0x51, 0x52, 0x53, 0x54, /* PQRST */
},
26,
0,
"on_priority_update: push=0x8, [PQRSTPQRSTPQRSTPQRST]\n"
,
},
};
@ -132,6 +194,24 @@ on_unexpected_frame (void *ctx, uint64_t frame_type)
fprintf(ctx, "%s: %"PRIu64"\n", __func__, frame_type);
}
static void
on_priority_update (void *ctx, enum hq_frame_type frame_type,
/* PFV: Priority Field Value */
uint64_t id, const char *pfv, size_t pfv_sz)
{
const char *type;
switch (frame_type)
{
case HQFT_PRIORITY_UPDATE_STREAM: type = "stream"; break;
case HQFT_PRIORITY_UPDATE_PUSH: type = "push"; break;
default: assert(0); return;
}
fprintf(ctx, "%s: %s=0x%"PRIX64", [%.*s]\n", __func__, type, id,
(int) pfv_sz, pfv);
}
static const struct hcsi_callbacks callbacks =
{
.on_cancel_push = on_cancel_push,
@ -140,6 +220,7 @@ static const struct hcsi_callbacks callbacks =
.on_setting = on_setting,
.on_goaway = on_goaway,
.on_unexpected_frame = on_unexpected_frame,
.on_priority_update = on_priority_update,
};
@ -167,7 +248,7 @@ run_test (const struct test *test)
struct lsquic_conn lconn = LSCONN_INITIALIZER_CIDLEN(lconn, 0);
lconn.cn_if = &conn_iface;
for (read_sz = 1; read_sz < test->input_sz; ++read_sz)
for (read_sz = 1; read_sz <= test->input_sz; ++read_sz)
{
out_f = open_memstream(&output, &out_sz);
lsquic_hcsi_reader_init(&reader, &lconn, &callbacks, out_f);
@ -188,7 +269,11 @@ run_test (const struct test *test)
assert(s == test->retval);
fclose(out_f);
assert(0 == strcmp(test->output, output));
if (test->retval == 0 && read_sz < test->input_sz
&& (test->flags & TEST_NUL_OUT_LEST_FULL))
assert(0 == strcmp(output, ""));
else
assert(0 == strcmp(test->output, output));
free(output);
}
}
@ -204,7 +289,7 @@ main (void)
memset(&coalesced_test, 0, sizeof(coalesced_test));
for (test = tests; test < tests + sizeof(tests) / sizeof(tests[0]); ++test)
if (test->retval == 0)
if (test->retval == 0 && !(test->flags & TEST_NUL_OUT_LEST_FULL))
{
memcpy(coalesced_test.input + coalesced_test.input_sz,
test->input, test->input_sz);