OSSL_HTTP_REQ_CTX_add1_headers(): Fix use with host == NULL (relative URLs)
[openssl.git] / 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++) {