often fails. It happens when the HTTP parser reads more than one chunk in a
single tls_read() invocation causing the state machine to think it needs to read
more data while buffer already contains unexamined data. Considering a non-empty
buffer before tls_read() fixes the problem.
ok benno@ claudio@
-/* $OpenBSD: http.c,v 1.40 2021/09/23 13:26:51 tb Exp $ */
+/* $OpenBSD: http.c,v 1.41 2021/10/05 05:33:46 anton Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
char *buf;
int done;
+ if (conn->bufpos > 0)
+ goto again;
+
read_more:
s = tls_read(conn->tls, conn->buf + conn->bufpos,
conn->bufsz - conn->bufpos);