From: Dr. David von Oheimb Date: Tue, 28 Jun 2022 15:47:40 +0000 (+0200) Subject: OSSL_HTTP_open(): improve use of use_ssl and its documentation X-Git-Tag: openssl-3.2.0-alpha1~2427 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=35750cb9af007702dad92d62da57200fdf9ddaf4;p=thirdparty%2Fopenssl.git OSSL_HTTP_open(): improve use of use_ssl and its documentation Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Hugo Landau (Merged from https://github.com/openssl/openssl/pull/18674) --- diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index ad7574e6955..96b18dc9d38 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -975,7 +975,7 @@ OSSL_HTTP_REQ_CTX *OSSL_HTTP_open(const char *server, const char *port, if (bio_update_fn != NULL) { BIO *orig_bio = cbio; - cbio = (*bio_update_fn)(cbio, arg, 1 /* connect */, use_ssl); + cbio = (*bio_update_fn)(cbio, arg, 1 /* connect */, use_ssl != 0); if (cbio == NULL) { if (bio == NULL) /* cbio was not provided by caller */ BIO_free_all(orig_bio); diff --git a/doc/man3/OSSL_HTTP_transfer.pod b/doc/man3/OSSL_HTTP_transfer.pod index bb29a5d3e65..e44ee9761ef 100644 --- a/doc/man3/OSSL_HTTP_transfer.pod +++ b/doc/man3/OSSL_HTTP_transfer.pod @@ -102,8 +102,8 @@ The callback function may modify the BIO provided in the I argument, whereby it may make use of a custom defined argument I, which may for instance point to an B structure. During connection establishment, just after calling BIO_do_connect_retry(), the -callback function is invoked with the I argument being 1 and the I -argument being 1 if HTTPS is requested, i.e., SSL/TLS should be enabled, else 0. +callback function is invoked with the I argument being 1 and +I being 1 if I is nonzero (i.e., HTTPS is requested), else 0. On disconnect I is 0 and I is 1 if no error occurred, else 0. For instance, on connect the callback may push an SSL BIO to implement HTTPS; after disconnect it may do some diagnostic output and pop and free the SSL BIO.