From: Dr. David von Oheimb Date: Thu, 28 Apr 2022 13:35:13 +0000 (+0200) Subject: http_client.c: check expected content type only if HTTP status code is 200 (OK) X-Git-Tag: openssl-3.2.0-alpha1~2727 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e3477d3e5ccd971da3d8a90a7d5096b47372d288;p=thirdparty%2Fopenssl.git http_client.c: check expected content type only if HTTP status code is 200 (OK) Reviewed-by: Paul Dale Reviewed-by: Tomas Mraz Reviewed-by: David von Oheimb (Merged from https://github.com/openssl/openssl/pull/18204) --- diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 8fcc9c3445e..088b6cd664e 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -669,7 +669,7 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx) rctx->redirection_url = value; return 0; } - if (rctx->expected_ct != NULL + if (rctx->state == OHS_HEADERS && rctx->expected_ct != NULL && OPENSSL_strcasecmp(key, "Content-Type") == 0) { if (OPENSSL_strcasecmp(rctx->expected_ct, value) != 0) { ERR_raise_data(ERR_LIB_HTTP, HTTP_R_UNEXPECTED_CONTENT_TYPE,