mirror of
https://gitea.invidious.io/iv-org/litespeed-quic.git
synced 2024-08-15 00:53:43 +00:00
Release 2.24.0
- [FEATURE] QUIC and HTTP/3 Internet Draft 31 support. Drop ID-30 and ID-31 support. - [BUGFIX] Divide-by-zero in newly enabled conn stats code when no packets were sent. - [BUGFIX] Memory leak in gQUIC client when server hello cannot be parsed. - [BUGFIX] Server Initial packet size calculation. - Log user-agent and CONN_CLOSE reason when peer reports error. - Example programs: Specify ALPN for echo and md5 clients and servers (issue #184). - Example programs: Don't add "QUIC_" prefix to lines in keylog file (issue #185). - http_server: Fix fd leak in preadv mode; fix preadv() usage when reading from disk.
This commit is contained in:
parent
078f53798c
commit
4429f8ea1e
33 changed files with 249 additions and 117 deletions
|
@ -213,6 +213,7 @@ main (int argc, char **argv)
|
|||
|
||||
TAILQ_INIT(&sports);
|
||||
prog_init(&prog, 0, &sports, &client_echo_stream_if, &client_ctx);
|
||||
prog.prog_api.ea_alpn = "echo";
|
||||
|
||||
while (-1 != (opt = getopt(argc, argv, PROG_OPTS "h")))
|
||||
{
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "lsquic.h"
|
||||
#include "test_common.h"
|
||||
#include "../src/liblsquic/lsquic_hash.h"
|
||||
#include "test_cert.h"
|
||||
#include "prog.h"
|
||||
|
||||
#include "../src/liblsquic/lsquic_logger.h"
|
||||
|
@ -218,6 +220,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
add_alpn("echo");
|
||||
if (0 != prog_prep(&prog))
|
||||
{
|
||||
LSQ_ERROR("could not prep");
|
||||
|
|
|
@ -582,13 +582,39 @@ my_preadv (void *user_data, const struct iovec *iov, int iovcnt)
|
|||
{
|
||||
#if HAVE_PREADV
|
||||
lsquic_stream_ctx_t *const st_h = user_data;
|
||||
return preadv(st_h->file_fd, iov, iovcnt, st_h->written);
|
||||
ssize_t nread = preadv(st_h->file_fd, iov, iovcnt, st_h->written);
|
||||
LSQ_DEBUG("%s: wrote %zd bytes", __func__, (size_t) nread);
|
||||
return nread;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
pwritev_fallback_read (void *lsqr_ctx, void *buf, size_t count)
|
||||
{
|
||||
lsquic_stream_ctx_t *const st_h = lsqr_ctx;
|
||||
struct iovec iov;
|
||||
size_t ntoread;
|
||||
|
||||
ntoread = st_h->file_size - st_h->written;
|
||||
if (ntoread > count)
|
||||
count = ntoread;
|
||||
iov.iov_base = buf;
|
||||
iov.iov_len = count;
|
||||
return my_preadv(lsqr_ctx, &iov, 1);
|
||||
}
|
||||
|
||||
|
||||
static size_t
|
||||
pwritev_fallback_size (void *lsqr_ctx)
|
||||
{
|
||||
lsquic_stream_ctx_t *const st_h = lsqr_ctx;
|
||||
return st_h->file_size - st_h->written;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
http_server_on_write (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
|
||||
{
|
||||
|
@ -624,11 +650,17 @@ http_server_on_write (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
|
|||
to_write = s_pwritev;
|
||||
nw = lsquic_stream_pwritev(stream, my_preadv, st_h, to_write);
|
||||
if (nw == 0)
|
||||
goto use_reader;
|
||||
{
|
||||
struct lsquic_reader reader = {
|
||||
.lsqr_read = pwritev_fallback_read,
|
||||
.lsqr_size = pwritev_fallback_size,
|
||||
.lsqr_ctx = st_h,
|
||||
};
|
||||
nw = lsquic_stream_writef(stream, &reader);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
use_reader:
|
||||
nw = lsquic_stream_writef(stream, &st_h->reader);
|
||||
}
|
||||
if (nw < 0)
|
||||
|
@ -1006,6 +1038,8 @@ http_server_on_close (lsquic_stream_t *stream, lsquic_stream_ctx_t *st_h)
|
|||
free(st_h->req_path);
|
||||
if (st_h->reader.lsqr_ctx)
|
||||
destroy_lsquic_reader_ctx(st_h->reader.lsqr_ctx);
|
||||
if (s_pwritev)
|
||||
close(st_h->file_fd);
|
||||
if (st_h->req)
|
||||
interop_server_hset_destroy(st_h->req);
|
||||
free(st_h);
|
||||
|
|
|
@ -460,6 +460,7 @@ main (int argc, char **argv)
|
|||
|
||||
TAILQ_INIT(&sports);
|
||||
prog_init(&prog, 0, &sports, &client_file_stream_if, &client_ctx);
|
||||
prog.prog_api.ea_alpn = "md5";
|
||||
|
||||
while (-1 != (opt = getopt(argc, argv, PROG_OPTS "bhr:f:p:")))
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include "lsquic.h"
|
||||
#include "test_common.h"
|
||||
#include "../src/liblsquic/lsquic_hash.h"
|
||||
#include "test_cert.h"
|
||||
#include "prog.h"
|
||||
|
||||
#include "../src/liblsquic/lsquic_logger.h"
|
||||
|
@ -325,6 +327,7 @@ main (int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
add_alpn("md5");
|
||||
if (0 != prog_prep(&prog))
|
||||
{
|
||||
LSQ_ERROR("could not prep");
|
||||
|
|
|
@ -610,11 +610,6 @@ keylog_open (void *ctx, lsquic_conn_t *conn)
|
|||
static void
|
||||
keylog_log_line (void *handle, const char *line)
|
||||
{
|
||||
size_t len;
|
||||
|
||||
len = strlen(line);
|
||||
if (len < sizeof("QUIC_") - 1 || strncmp(line, "QUIC_", 5))
|
||||
fputs("QUIC_", handle);
|
||||
fputs(line, handle);
|
||||
fputs("\n", handle);
|
||||
fflush(handle);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue