-/* $OpenBSD: http.c,v 1.79 2024/01/30 10:16:13 claudio Exp $ */
+/* $OpenBSD: http.c,v 1.80 2024/01/30 11:15:05 claudio Exp $ */
/*
* Copyright (c) 2020 Nils Fisher <nils_fisher@hotmail.com>
* Copyright (c) 2020 Claudio Jeker <claudio@openbsd.org>
LIST_FOREACH_SAFE(conn, &idle, entry, nc) {
if (conn->pfd != NULL && conn->pfd->revents != 0)
http_do(conn, http_handle);
- else if (conn->idle_time <= now)
+ else if (conn->idle_time <= now) {
+ conn->io_time = 0;
http_do(conn, http_close);
+ }
if (conn->state == STATE_FREE)
http_free(conn);
/* check if event is ready */
if (conn->pfd != NULL && conn->pfd->revents != 0)
http_do(conn, http_handle);
- else if (conn->io_time <= now) {
+ else if (conn->io_time != 0 && conn->io_time <= now) {
conn->io_time = 0;
if (conn->state == STATE_CONNECT) {
warnx("%s: connect timeout",