mirror of
https://github.com/openssl/openssl.git
synced 2025-02-23 14:42:15 +08:00
http_client.c: fix error reporting (a char was missing; improve style)
Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/15796)
This commit is contained in:
parent
8df299d63d
commit
552aeaef0d
@ -434,10 +434,10 @@ static int parse_http_line1(char *line, int *found_keep_alive)
|
|||||||
else
|
else
|
||||||
retcode = HTTP_R_RECEIVED_ERROR;
|
retcode = HTTP_R_RECEIVED_ERROR;
|
||||||
if (*reason == '\0')
|
if (*reason == '\0')
|
||||||
ERR_raise_data(ERR_LIB_HTTP, retcode, "Code=%s", code);
|
ERR_raise_data(ERR_LIB_HTTP, retcode, "code=%s", code);
|
||||||
else
|
else
|
||||||
ERR_raise_data(ERR_LIB_HTTP, retcode,
|
ERR_raise_data(ERR_LIB_HTTP, retcode,
|
||||||
"Code=%s, Reason=%s", code, reason);
|
"code=%s, reason=%s", code, reason);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1289,7 +1289,7 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
|
|||||||
/*-
|
/*-
|
||||||
* The first line is the HTTP response.
|
* The first line is the HTTP response.
|
||||||
* According to RFC 7230, it is formatted exactly like this:
|
* According to RFC 7230, it is formatted exactly like this:
|
||||||
* HTTP/d.d ddd Reason text\r\n
|
* HTTP/d.d ddd reason text\r\n
|
||||||
*/
|
*/
|
||||||
read_len = BIO_gets(fbio, mbuf, BUF_SIZE);
|
read_len = BIO_gets(fbio, mbuf, BUF_SIZE);
|
||||||
/* the BIO may not block, so we must wait for the 1st line to come in */
|
/* the BIO may not block, so we must wait for the 1st line to come in */
|
||||||
@ -1316,14 +1316,13 @@ int OSSL_HTTP_proxy_connect(BIO *bio, const char *server, const char *port,
|
|||||||
|
|
||||||
/* RFC 7231 4.3.6: any 2xx status code is valid */
|
/* RFC 7231 4.3.6: any 2xx status code is valid */
|
||||||
if (strncmp(mbufp, " 2", strlen(" 2")) != 0) {
|
if (strncmp(mbufp, " 2", strlen(" 2")) != 0) {
|
||||||
mbufp += 1;
|
|
||||||
/* chop any trailing whitespace */
|
/* chop any trailing whitespace */
|
||||||
while (read_len > 0 && ossl_isspace(mbuf[read_len - 1]))
|
while (read_len > 0 && ossl_isspace(mbuf[read_len - 1]))
|
||||||
read_len--;
|
read_len--;
|
||||||
mbuf[read_len] = '\0';
|
mbuf[read_len] = '\0';
|
||||||
ERR_raise_data(ERR_LIB_HTTP, HTTP_R_CONNECT_FAILURE,
|
ERR_raise_data(ERR_LIB_HTTP, HTTP_R_CONNECT_FAILURE,
|
||||||
"Reason=%s", mbufp);
|
"reason=%s", mbufp);
|
||||||
BIO_printf(bio_err, "%s: HTTP CONNECT failed, Reason=%s\n",
|
BIO_printf(bio_err, "%s: HTTP CONNECT failed, reason=%s\n",
|
||||||
prog, mbufp);
|
prog, mbufp);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user