diff options
author | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-01-13 15:16:17 +0100 |
---|---|---|
committer | Rodrigo Arias Mallo <rodarima@gmail.com> | 2024-01-13 15:16:17 +0100 |
commit | 5ec8a62f0528702a92a1db4fdee7a1c99187dc2e (patch) | |
tree | 8ac764e09b971522794ed1d746ebc63ec4f2cd48 /src/IO/http.c | |
parent | 43f5ad6e968ce25f3752d6ea6f602e2d8f624ac2 (diff) |
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
Diffstat (limited to 'src/IO/http.c')
-rw-r--r-- | src/IO/http.c | 6 |
1 files changed, 5 insertions, 1 deletions
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 <jcid@dillo.org> + * Copyright (C) 2024 Rodrigo Arias Mallo <rodarima@gmail.com> * * 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); } } |