diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-11-21 20:55:35 +0100 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-12-22 12:25:14 +0100 |
commit | e0314df5f21dd537602d4ea8d9272a21aac66356 (patch) | |
tree | 8ff2bd6fd3fcdb90061b1369a3eb97e4d49593ff /crypto/http/http_client.c | |
parent | fbadef597c906711d82d8bfd9c4d5276ea981db7 (diff) |
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)
(cherry picked from commit cdaf072f90399efb9e8e19ee4f387d1425f12274)
Diffstat (limited to 'crypto/http/http_client.c')
-rw-r--r-- | crypto/http/http_client.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 7f8d8fc8d7..c80d4fe519 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -1197,11 +1197,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; } |