[openssl] openssl-3.0 update
dev at ddvo.net
dev at ddvo.net
Mon Nov 22 12:27:44 UTC 2021
The branch openssl-3.0 has been updated
via f4664e5d40f8736d301763b3e98d2ab0061e3a02 (commit)
from 24ba865cfc7c04fba813ecb86ac7c1b329e3305f (commit)
- Log -----------------------------------------------------------------
commit f4664e5d40f8736d301763b3e98d2ab0061e3a02
Author: Dr. David von Oheimb <David.von.Oheimb at siemens.com>
Date: Thu Nov 18 20:38:55 2021 +0100
HTTP client: workaround for #16028 (BIO_gets not supported by connect and SSL BIOs)
Reviewed-by: Tomas Mraz <tomas at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/17066)
-----------------------------------------------------------------------
Summary of changes:
crypto/http/http_client.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index bb80836cd1..e5c8bcd33d 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -474,7 +474,7 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
long n;
size_t resp_len;
const unsigned char *p;
- char *key, *value, *line_end = NULL;
+ char *buf, *key, *value, *line_end = NULL;
if (rctx == NULL) {
ERR_raise(ERR_LIB_HTTP, ERR_R_PASSED_NULL_PARAMETER);
@@ -487,11 +487,20 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
rctx->redirection_url = NULL;
next_io:
+ buf = (char *)rctx->buf;
if ((rctx->state & OHS_NOREAD) == 0) {
- if (rctx->expect_asn1)
+ if (rctx->expect_asn1) {
n = BIO_read(rctx->rbio, rctx->buf, rctx->buf_size);
- else
- n = BIO_gets(rctx->rbio, (char *)rctx->buf, rctx->buf_size);
+ } else {
+ (void)ERR_set_mark();
+ n = BIO_gets(rctx->rbio, buf, rctx->buf_size);
+ if (n == -2) { /* unsupported method */
+ (void)ERR_pop_to_mark();
+ n = BIO_get_line(rctx->rbio, buf, rctx->buf_size);
+ } else {
+ (void)ERR_clear_last_mark();
+ }
+ }
if (n <= 0) {
if (BIO_should_retry(rctx->rbio))
return -1;
@@ -592,7 +601,7 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
}
goto next_io;
}
- n = BIO_gets(rctx->mem, (char *)rctx->buf, rctx->buf_size);
+ n = BIO_gets(rctx->mem, buf, rctx->buf_size);
if (n <= 0) {
if (BIO_should_retry(rctx->mem))
@@ -610,7 +619,7 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
/* First line */
if (rctx->state == OHS_FIRSTLINE) {
- switch (parse_http_line1((char *)rctx->buf, &found_keep_alive)) {
+ switch (parse_http_line1(buf, &found_keep_alive)) {
case HTTP_STATUS_CODE_OK:
rctx->state = OHS_HEADERS;
goto next_line;
@@ -628,7 +637,7 @@ int OSSL_HTTP_REQ_CTX_nbio(OSSL_HTTP_REQ_CTX *rctx)
return 0;
}
}
- key = (char *)rctx->buf;
+ key = buf;
value = strchr(key, ':');
if (value != NULL) {
*(value++) = '\0';
More information about the openssl-commits
mailing list