The branch master has been updated via 9e6f30e683fd0f243cf15d2bac2cdef2bcbbac12 (commit) via 1e6174b1b58d3545b2ef34fd7262dadd2149ec15 (commit) via 231837911980ff55a661e2509642442435082c90 (commit) via f7c4d8622840b92a9f6cdb00d937d063a4efae9c (commit) via e1428c62a1588def5af25678583f1a0166adf924 (commit) from 534725fd4389782d693cff061f4d31b786058ab1 (commit)
- Log ----------------------------------------------------------------- commit 9e6f30e683fd0f243cf15d2bac2cdef2bcbbac12 Author: Dr. David von Oheimb <david.von.ohe...@siemens.com> Date: Mon Mar 29 19:39:57 2021 +0200 CHANGES.md: reflect OSSL_HTTP_REQ_CTX_i2d renamed to OSSL_HTTP_REQ_CTX_set1_req Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630) commit 1e6174b1b58d3545b2ef34fd7262dadd2149ec15 Author: Dr. David von Oheimb <david.von.ohe...@siemens.com> Date: Mon Mar 8 13:47:33 2021 +0100 OSSL_HTTP_REQ_CTX_transfer(): improve distinction of send error vs. receive error Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630) commit 231837911980ff55a661e2509642442435082c90 Author: Dr. David von Oheimb <david.von.ohe...@siemens.com> Date: Mon Mar 8 09:59:35 2021 +0100 OSSL_parse_url(): Improve handling of IPv6 addresses Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630) commit f7c4d8622840b92a9f6cdb00d937d063a4efae9c Author: Dr. David von Oheimb <david.von.ohe...@siemens.com> Date: Mon Mar 8 09:26:28 2021 +0100 80-test_cmp_http.t: Add diagnostic info on starting/stopping mock server Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630) commit e1428c62a1588def5af25678583f1a0166adf924 Author: Dr. David von Oheimb <david.von.ohe...@siemens.com> Date: Mon Mar 8 09:25:54 2021 +0100 http_client.c: Prevent spurious error queue entry on NULL mem argument Reviewed-by: Tomas Mraz <to...@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14630) ----------------------------------------------------------------------- Summary of changes: CHANGES.md | 2 +- crypto/http/http_client.c | 7 ++----- crypto/http/http_lib.c | 5 ++--- test/http_test.c | 2 +- test/recipes/80-test_cmp_http.t | 7 ++++++- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index c57b9ad4a5..10c471ab1b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -249,7 +249,7 @@ OpenSSL 3.0 type is OSSL_HTTP_REQ_CTX, and the deprecated functions are replaced with OSSL_HTTP_REQ_CTX_new(), OSSL_HTTP_REQ_CTX_free(), OSSL_HTTP_REQ_CTX_set_request_line(), OSSL_HTTP_REQ_CTX_add1_header(), - OSSL_HTTP_REQ_CTX_i2d(), OSSL_HTTP_REQ_CTX_nbio(), + OSSL_HTTP_REQ_CTX_set1_req(), OSSL_HTTP_REQ_CTX_nbio(), OSSL_HTTP_REQ_CTX_sendreq_d2i(), OSSL_HTTP_REQ_CTX_get0_mem_bio() and OSSL_HTTP_REQ_CTX_set_max_response_length(). diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c index 8e4f8e8c83..9c2b593a2d 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -734,20 +734,18 @@ static BIO *HTTP_new_bio(const char *server /* optionally includes ":port" */, static ASN1_VALUE *BIO_mem_d2i(BIO *mem, const ASN1_ITEM *it) { const unsigned char *p; - long len = BIO_get_mem_data(mem, &p); ASN1_VALUE *resp; if (mem == NULL) return NULL; - if ((resp = ASN1_item_d2i(NULL, &p, len, it)) == NULL) + if ((resp = ASN1_item_d2i(NULL, &p, BIO_get_mem_data(mem, &p), it)) == NULL) ERR_raise(ERR_LIB_HTTP, HTTP_R_RESPONSE_PARSE_ERROR); return resp; } static BIO *ossl_http_req_ctx_transfer(OSSL_HTTP_REQ_CTX *rctx) { - int sending = 1; int rv; if (rctx == NULL) { @@ -760,7 +758,6 @@ static BIO *ossl_http_req_ctx_transfer(OSSL_HTTP_REQ_CTX *rctx) if (rv != -1) break; /* BIO_should_retry was true */ - sending = 0; /* will not actually wait if rctx->max_time == 0 */ if (BIO_wait(rctx->rbio, rctx->max_time, 100 /* milliseconds */) <= 0) return NULL; @@ -768,7 +765,7 @@ static BIO *ossl_http_req_ctx_transfer(OSSL_HTTP_REQ_CTX *rctx) if (rv == 0) { if (rctx->redirection_url == NULL) { /* an error occurred */ - if (sending && (rctx->state & OHS_NOREAD) != 0) + if (rctx->len_to_send > 0) ERR_raise(ERR_LIB_HTTP, HTTP_R_ERROR_SENDING); else ERR_raise(ERR_LIB_HTTP, HTTP_R_ERROR_RECEIVING); diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c index 3bf642a4f4..f0fc770f22 100644 --- a/crypto/http/http_lib.c +++ b/crypto/http/http_lib.c @@ -87,11 +87,10 @@ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost, /* parse host name/address as far as needed here */ if (host[0] == '[') { /* ipv6 literal, which may include ':' */ - host++; - host_end = strchr(host, ']'); + host_end = strchr(host + 1, ']'); if (host_end == NULL) goto parse_err; - p = host_end + 1; + p = ++host_end; } else { /* look for start of optional port, path, query, or fragment */ host_end = strchr(host, ':'); diff --git a/test/http_test.c b/test/http_test.c index e59ef63833..0a3389c15f 100644 --- a/test/http_test.c +++ b/test/http_test.c @@ -204,7 +204,7 @@ static int test_http_url_ipv4(void) static int test_http_url_ipv6(void) { - return test_http_url_ok("http://[FF01::101]:6", 0, "FF01::101", "6", "/"); + return test_http_url_ok("http://[FF01::101]:6", 0, "[FF01::101]", "6", "/"); } static int test_http_url_invalid(const char *url) diff --git a/test/recipes/80-test_cmp_http.t b/test/recipes/80-test_cmp_http.t index 4315b1c439..80cb6a4122 100644 --- a/test/recipes/80-test_cmp_http.t +++ b/test/recipes/80-test_cmp_http.t @@ -273,12 +273,17 @@ sub start_mock_server { my $cmd = "LD_LIBRARY_PATH=$dir DYLD_LIBRARY_PATH=$dir " . bldtop_dir($app) . " -config server.cnf $args"; my $pid = mock_server_pid(); - return $pid if $pid; # already running + if ($pid) { + print "Mock server already running with pid=$pid\n"; + return $pid; + } + print "Launching mock server: $cmd\n"; return system("$cmd &") == 0 # start in background, check for success ? (sleep 1, mock_server_pid()) : 0; } sub stop_mock_server { my $pid = $_[0]; + print "Killing mock server with pid=$pid\n"; system("kill $pid") if $pid; }