Skip to content

Commit

Permalink
OSSL_HTTP_proxy_connect(): Fix glitch in response HTTP header parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
DDvO committed Dec 9, 2021
1 parent f0d5a3b commit 0a71d13
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crypto/http/http_client.c
Expand Up @@ -1317,7 +1317,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,

/* Check for HTTP/1.x */
mbufp = mbuf;
if (!HAS_PREFIX(mbufp, HTTP_PREFIX)) {
if (!CHECK_AND_SKIP_PREFIX(mbufp, HTTP_PREFIX)) {
ERR_raise(ERR_LIB_HTTP, HTTP_R_HEADER_PARSE_ERROR);
BIO_printf(bio_err, "%s: HTTP CONNECT failed, non-HTTP response\n",
prog);
Expand All @@ -1335,6 +1335,8 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,

/* RFC 7231 4.3.6: any 2xx status code is valid */
if (!HAS_PREFIX(mbufp, " 2")) {
if (ossl_isspace(*mbufp))
mbufp++;
/* chop any trailing whitespace */
while (read_len > 0 && ossl_isspace(mbuf[read_len - 1]))
read_len--;
Expand Down

0 comments on commit 0a71d13

Please sign in to comment.