From 0fec2b2fd1fe9639e5e685582d3af36f98f79533 Mon Sep 17 00:00:00 2001 From: anton Date: Tue, 5 Oct 2021 05:33:46 +0000 Subject: [PATCH] The HTTP chunked transfer encoding test in regress/usr.sbin/rpki-client/libressl 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@ --- usr.sbin/rpki-client/http.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/usr.sbin/rpki-client/http.c b/usr.sbin/rpki-client/http.c index 486aeda4a13..9c20a964421 100644 --- a/usr.sbin/rpki-client/http.c +++ b/usr.sbin/rpki-client/http.c @@ -1,4 +1,4 @@ -/* $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 * Copyright (c) 2020 Claudio Jeker @@ -1311,6 +1311,9 @@ http_read(struct http_connection *conn) 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); -- 2.20.1