OSSL_HTTP_REQ_CTX_add1_headers(): Fix use with host == NULL (relative URLs)
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Sat, 1 May 2021 17:26:53 +0000 (19:26 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Fri, 14 May 2021 17:24:42 +0000 (19:24 +0200)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15053)

crypto/http/http_client.c

index a4eefad31588821ace6030cb7bfc92bc0eae44e5..9f41a31bf7a05040103972dcd50e602abc490bb2 100644 (file)
@@ -286,7 +286,7 @@ static int OSSL_HTTP_REQ_CTX_add1_headers(OSSL_HTTP_REQ_CTX *rctx,
                                           const char *host)
 {
     int i;
-    int add_host = 1;
+    int add_host = host != NULL && *host != '\0';
     CONF_VALUE *hdr;
 
     for (i = 0; i < sk_CONF_VALUE_num(headers); i++) {