diff options
author | Dr. David von Oheimb <David.von.Oheimb@siemens.com> | 2021-05-01 22:04:17 +0200 |
---|---|---|
committer | Dr. David von Oheimb <dev@ddvo.net> | 2021-05-14 19:24:42 +0200 |
commit | 22fe2b129922bc9322c41ce8beff1551c078c838 (patch) | |
tree | 8cb6fe44cb8baf2ec35bdd05dabd9747559ed155 /crypto/http/http_client.c | |
parent | OSSL_HTTP_get(): Do not close connection if redirect to same server (diff) | |
download | openssl-22fe2b129922bc9322c41ce8beff1551c078c838.tar.xz openssl-22fe2b129922bc9322c41ce8beff1551c078c838.zip |
OSSL_HTTP_transfer(): Fix error reporting in case rctx->server is NULL
Also improve doc of OSSL_parse_url() and OSSL_HTTP_parse_url().
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15053)
Diffstat (limited to 'crypto/http/http_client.c')
-rw-r--r-- | crypto/http/http_client.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 50f1e6d378..ee97f64ef6 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -985,17 +985,16 @@ BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url) #endif ) { if (rctx->server != NULL) { - BIO_snprintf(buf, 200, "server=http%s://%s", - rctx->use_ssl ? "s" : "", rctx->server); - if (rctx->port != NULL) - BIO_snprintf(buf + strlen(buf), 200 - strlen(buf), - ":%s", rctx->port); + BIO_snprintf(buf, sizeof(buf), "server=http%s://%s%s%s", + rctx->use_ssl ? "s" : "", rctx->server, + rctx->port != NULL ? ":" : "", + rctx->port != NULL ? rctx->port : ""); + ERR_add_error_data(1, buf); } - ERR_add_error_data(1, buf); if (rctx->proxy != NULL) ERR_add_error_data(2, " proxy=", rctx->proxy); if (err == 0) { - BIO_snprintf(buf, 200, " peer has disconnected%s", + BIO_snprintf(buf, sizeof(buf), " peer has disconnected%s", rctx->use_ssl ? " violating the protocol" : ", likely because it requires the use of TLS"); ERR_add_error_data(1, buf); |