From 5ec8a62f0528702a92a1db4fdee7a1c99187dc2e Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Mallo Date: Sat, 13 Jan 2024 15:16:17 +0100 Subject: Fix early fd close More data will be written in the SSL_Shutdown() of TLS connections, which causes errors if the file descriptor is closed. In particular, LibreSSL will trigger an assert. Fixes: https://github.com/dillo-browser/dillo/issues/51 --- src/IO/http.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/IO/http.c b/src/IO/http.c index 5179dfab..5e00b6f6 100644 --- a/src/IO/http.c +++ b/src/IO/http.c @@ -2,6 +2,7 @@ * File: http.c * * Copyright (C) 2000-2007 Jorge Arellano Cid + * Copyright (C) 2024 Rodrigo Arias Mallo * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -866,8 +867,11 @@ static void Http_socket_reuse(int SKey) return; } } - dClose(old_sd->SockFD); + /* Free the connection before closing the file descriptor, so more data + * can be written. */ + int old_fd = old_sd->SockFD; Http_socket_free(SKey); + dClose(old_fd); } } -- cgit v1.2.3