diff options
author | NIIBE Yutaka <[email protected]> | 2024-02-16 07:24:26 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2024-02-21 14:12:16 +0000 |
commit | 41c022072599bc3f12f659e962653548cd86fa3a (patch) | |
tree | 158e27beb23b9827d26402455c9bf8175d2c4cb2 | |
parent | dirmngr: Fix the regression of use of proxy for TLS connection. (diff) | |
download | gnupg-41c022072599bc3f12f659e962653548cd86fa3a.tar.gz gnupg-41c022072599bc3f12f659e962653548cd86fa3a.zip |
dirmngr: Fix keep-alive flag handling.
* dirmngr/http.c (run_proxy_connect): Set KEEP_ALIVE if not Basic
Authentication. Fix resource leak of FP_WRITE.
--
GnuPG-bug-id: 6997
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | dirmngr/http.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/dirmngr/http.c b/dirmngr/http.c index a2185ab19..7fe3b50f9 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -2520,7 +2520,7 @@ run_proxy_connect (http_t hd, proxy_info_t proxy, * RFC-4559 - SPNEGO-based Kerberos and NTLM HTTP Authentication */ auth_basic = !!proxy->uri->auth; - hd->keep_alive = 0; + hd->keep_alive = !auth_basic; /* We may need to send more requests. */ /* For basic authentication we need to send just one request. */ if (auth_basic @@ -2684,6 +2684,14 @@ run_proxy_connect (http_t hd, proxy_info_t proxy, } leave: + if (hd->keep_alive) + { + es_fclose (hd->fp_write); + hd->fp_write = NULL; + /* The close has released the cookie and thus we better set it + * to NULL. */ + hd->write_cookie = NULL; + } /* Restore flags, destroy stream, reset state. */ hd->flags = saved_flags; es_fclose (hd->fp_read); |