summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-01-13 15:16:17 +0100
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-01-13 15:16:17 +0100
commit5ec8a62f0528702a92a1db4fdee7a1c99187dc2e (patch)
tree8ac764e09b971522794ed1d746ebc63ec4f2cd48 /src
parent43f5ad6e968ce25f3752d6ea6f602e2d8f624ac2 (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')
-rw-r--r--src/IO/http.c6
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);
}
}