From: Dr. David von Oheimb Date: Tue, 14 Oct 2025 08:07:04 +0000 (+0200) Subject: http_client.c: make sure to raise error 404 (also in case of further errors like... X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5aaf9746f649d15b3ad006acdc6a958819acc536;p=thirdparty%2Fopenssl.git http_client.c: make sure to raise error 404 (also in case of further errors like content type mismatch) Reviewed-by: Tomas Mraz Reviewed-by: Dmitry Belyavskiy (Merged from https://github.com/openssl/openssl/pull/28895) --- diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 15bd583d48b..c5766aae155 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -36,6 +36,7 @@ #define HTTP_STATUS_CODE_MOVED_PERMANENTLY 301 #define HTTP_STATUS_CODE_FOUND 302 #define HTTP_STATUS_CODES_NONFATAL_ERROR 400 +#define HTTP_STATUS_CODE_NOT_FOUND 404 /* Stateful HTTP request code, supporting blocking and non-blocking I/O */ @@ -488,11 +489,12 @@ static int parse_http_line1(char *line, int *found_keep_alive) case HTTP_STATUS_CODE_FOUND: return retcode; default: - if (retcode < HTTP_STATUS_CODES_NONFATAL_ERROR) { + if (retcode == HTTP_STATUS_CODE_NOT_FOUND + || retcode < HTTP_STATUS_CODES_NONFATAL_ERROR) { ERR_raise_data(ERR_LIB_HTTP, HTTP_R_STATUS_CODE_UNSUPPORTED, "code=%s", code); if (*reason != '\0') ERR_add_error_data(2, ", reason=", reason); - } /* must return content normally if status >= 400 */ + } /* must return content normally if status >= 400, still tentatively raised error on 404 */ return retcode; }