summaryrefslogtreecommitdiff
path: root/crypto/http
diff options
context:
space:
mode:
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>2021-11-21 20:55:35 +0100
committerDr. David von Oheimb <dev@ddvo.net>2021-12-22 12:24:24 +0100
commitcdaf072f90399efb9e8e19ee4f387d1425f12274 (patch)
tree69fc775e486dae33d36500faa426124a72111283 /crypto/http
parentc2d1ad0e048dd3bfa60e6aa0b5ee343cc6d97a15 (diff)
downloadopenssl-new-cdaf072f90399efb9e8e19ee4f387d1425f12274.tar.gz
HTTP client: Fix cleanup of TLS BIO via 'bio_update_fn' callback function
Make app_http_tls_cb() tidy up on disconnect the SSL BIO it pushes on connect. Make OSSL_HTTP_close() respect this. Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17318)
Diffstat (limited to 'crypto/http')
-rw-r--r--crypto/http/http_client.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index ef0114240b..f786f831bf 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -1196,11 +1196,17 @@ BIO *OSSL_HTTP_transfer(OSSL_HTTP_REQ_CTX **prctx,
int OSSL_HTTP_close(OSSL_HTTP_REQ_CTX *rctx, int ok)
{
+ BIO *wbio;
int ret = 1;
- /* callback can be used to clean up TLS session on disconnect */
- if (rctx != NULL && rctx->upd_fn != NULL)
- ret = (*rctx->upd_fn)(rctx->wbio, rctx->upd_arg, 0, ok) != NULL;
+ /* callback can be used to finish TLS session and free its BIO */
+ if (rctx != NULL && rctx->upd_fn != NULL) {
+ wbio = (*rctx->upd_fn)(rctx->wbio, rctx->upd_arg,
+ 0 /* disconnect */, ok);
+ ret = wbio != NULL;
+ if (ret)
+ rctx->wbio = wbio;
+ }
OSSL_HTTP_REQ_CTX_free(rctx);
return ret;
}