From cddbcf02f55e443c394f28768a20d0a7458cdb98 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Mon, 18 Jan 2021 12:17:31 +0100 Subject: [PATCH] rename OSSL_HTTP_REQ_CTX_header to OSSL_HTTP_REQ_CTX_set_request_line Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/13898) --- CHANGES.md | 6 +++--- crypto/http/http_client.c | 12 +++++++----- doc/man3/OSSL_HTTP_REQ_CTX.pod | 16 ++++++++-------- include/openssl/http.h | 6 +++--- include/openssl/ocsp.h.in | 4 ++-- util/libcrypto.num | 2 +- 6 files changed, 24 insertions(+), 22 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index a298a0590c..63d41c3911 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,15 +23,15 @@ OpenSSL 3.0 ### Changes between 1.1.1 and 3.0 [xx XXX xxxx] - * Deprecated the type OCSP_REQ_CTX and the functions OCSP_REQ_CTX_new(), + * Deprecated the type OCSP_REQ_CTX and the functions OCSP_REQ_CTX_new(), OCSP_REQ_CTX_free(), OCSP_REQ_CTX_http(), OCSP_REQ_CTX_add1_header(), OCSP_REQ_CTX_i2d(), OCSP_REQ_CTX_nbio(), OCSP_REQ_CTX_nbio_d2i(), OCSP_REQ_CTX_get0_mem_bio() and OCSP_set_max_response_length(). These were used to collect all necessary data to form a HTTP request, and to perform the HTTP transfer with that request. With OpenSSL 3.0, the 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_header(), OSSL_HTTP_REQ_CTX_add1_header(), + 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_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 731142b161..9cde88d2e6 100644 --- a/crypto/http/http_client.c +++ b/crypto/http/http_client.c @@ -138,11 +138,12 @@ void OSSL_HTTP_REQ_CTX_set_max_response_length(OSSL_HTTP_REQ_CTX *rctx, } /* - * Create HTTP header using given op and path (or "/" in case path is NULL). + * Create request line using |ctx| and |path| (or "/" in case |path| is NULL). * Server name (and port) must be given if and only if plain HTTP proxy is used. */ -int OSSL_HTTP_REQ_CTX_header(OSSL_HTTP_REQ_CTX *rctx, const char *server, - const char *port, const char *path) +int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, + const char *server, const char *port, + const char *path) { if (rctx == NULL) { ERR_raise(ERR_LIB_HTTP, ERR_R_PASSED_NULL_PARAMETER); @@ -309,8 +310,9 @@ OSSL_HTTP_REQ_CTX *HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, int use_http_proxy, == NULL) return NULL; - if (OSSL_HTTP_REQ_CTX_header(rctx, use_http_proxy ? server : NULL, - port, path) + if (OSSL_HTTP_REQ_CTX_set_request_line(rctx, + use_http_proxy ? server : NULL, port, + path) && OSSL_HTTP_REQ_CTX_add1_headers(rctx, headers, server) && (req_mem == NULL || OSSL_HTTP_REQ_CTX_content(rctx, content_type, req_mem))) diff --git a/doc/man3/OSSL_HTTP_REQ_CTX.pod b/doc/man3/OSSL_HTTP_REQ_CTX.pod index b75bac5f8c..dc7020c826 100644 --- a/doc/man3/OSSL_HTTP_REQ_CTX.pod +++ b/doc/man3/OSSL_HTTP_REQ_CTX.pod @@ -5,7 +5,7 @@ OSSL_HTTP_REQ_CTX, OSSL_HTTP_REQ_CTX_new, OSSL_HTTP_REQ_CTX_free, -OSSL_HTTP_REQ_CTX_header, +OSSL_HTTP_REQ_CTX_set_request_line, OSSL_HTTP_REQ_CTX_add1_header, OSSL_HTTP_REQ_CTX_i2d, OSSL_HTTP_REQ_CTX_nbio, @@ -28,9 +28,9 @@ OSSL_HTTP_REQ_CTX_set_max_response_length int expect_asn1); void OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx); - int OSSL_HTTP_REQ_CTX_header(OSSL_HTTP_REQ_CTX *rctx, - const char *server, - const char *port, const char *path); + int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, + const char *server, const char *port, + const char *path); int OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx, const char *name, const char *value); @@ -72,7 +72,7 @@ OSSL_HTTP_REQ_CTX_free() frees up the HTTP request context I. The I and I are not free'd and it is up to the application to do so. -OSSL_HTTP_REQ_CTX_header() adds an HTTP request line to the request context. +OSSL_HTTP_REQ_CTX_set_request_line() adds the HTTP request line to the context. The request command itself becomes C or C depending on the value of I in the OSSL_HTTP_REQ_CTX_new() call. I and I may be set to indicate a proxy server and port that the request should go @@ -129,7 +129,7 @@ Then, the HTTP request must be prepared with request data: =item 1. -Calling OSSL_HTTP_REQ_CTX_header(). This must be done exactly once. +Calling OSSL_HTTP_REQ_CTX_set_request_line(). This must be done exactly once. =item 2. @@ -146,7 +146,7 @@ exactly once in that case. When the request context is fully prepared, the HTTP exchange may be performed with OSSL_HTTP_REQ_CTX_nbio() or OSSL_HTTP_REQ_CTX_sendreq_d2i(). -Furthermore, all calls of OSSL_HTTP_REQ_CTX_header() and +Furthermore, all calls of OSSL_HTTP_REQ_CTX_set_request_line() and OSSL_HTTP_REQ_CTX_add1_header() must be done before any call to int OSSL_HTTP_REQ_CTX_nbio() or OSSL_HTTP_REQ_CTX_sendreq_d2i(). @@ -158,7 +158,7 @@ on error. OSSL_HTTP_REQ_CTX_free() and OSSL_HTTP_REQ_CTX_set_max_response_length() do not return values. -OSSL_HTTP_REQ_CTX_header(), OSSL_HTTP_REQ_CTX_add1_header(), +OSSL_HTTP_REQ_CTX_set_request_line(), OSSL_HTTP_REQ_CTX_add1_header(), OSSL_HTTP_REQ_CTX_i2d() and OSSL_HTTP_REQ_CTX_nbio return 1 for success and 0 for failure. diff --git a/include/openssl/http.h b/include/openssl/http.h index 0bd32e514e..84a106f57a 100644 --- a/include/openssl/http.h +++ b/include/openssl/http.h @@ -42,9 +42,9 @@ OSSL_HTTP_REQ_CTX *OSSL_HTTP_REQ_CTX_new(BIO *wbio, BIO *rbio, const char *expected_content_type, int expect_asn1); void OSSL_HTTP_REQ_CTX_free(OSSL_HTTP_REQ_CTX *rctx); -int OSSL_HTTP_REQ_CTX_header(OSSL_HTTP_REQ_CTX *rctx, - const char *server, - const char *port, const char *path); +int OSSL_HTTP_REQ_CTX_set_request_line(OSSL_HTTP_REQ_CTX *rctx, + const char *server, const char *port, + const char *path); int OSSL_HTTP_REQ_CTX_add1_header(OSSL_HTTP_REQ_CTX *rctx, const char *name, const char *value); int OSSL_HTTP_REQ_CTX_i2d(OSSL_HTTP_REQ_CTX *rctx, const char *content_type, diff --git a/include/openssl/ocsp.h.in b/include/openssl/ocsp.h.in index c3a0b0e267..76f7c1602a 100644 --- a/include/openssl/ocsp.h.in +++ b/include/openssl/ocsp.h.in @@ -184,8 +184,8 @@ int OCSP_REQ_CTX_set1_req(OSSL_HTTP_REQ_CTX *rctx, const OCSP_REQUEST *req); OSSL_HTTP_REQ_CTX_new(wb, rb, m, ml, mrl, t, ect, ea) # define OCSP_REQ_CTX_free(r) \ OSSL_HTTP_REQ_CTX_free(r) -# define OCSP_REQ_CTX_http(r, s, po, pa) \ - OSSL_HTTP_REQ_CTX_header(r, s, po, pa) +# define OCSP_REQ_CTX_http(r, s, p, path) \ + OSSL_HTTP_REQ_CTX_set_request_line(r, s, p, path) # define OCSP_REQ_CTX_add1_header(r, n, v) \ OSSL_HTTP_REQ_CTX_add1_header(r, n, v) # define OCSP_REQ_CTX_i2d(r, c, i, req) \ diff --git a/util/libcrypto.num b/util/libcrypto.num index 1cd4b86f4d..be5bed741a 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -1379,7 +1379,7 @@ BIO_set_ex_data 1411 3_0_0 EXIST::FUNCTION: SHA512 1412 3_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0 X509_STORE_CTX_get_explicit_policy 1413 3_0_0 EXIST::FUNCTION: EVP_DecodeBlock 1414 3_0_0 EXIST::FUNCTION: -OSSL_HTTP_REQ_CTX_header 1415 3_0_0 EXIST::FUNCTION: +OSSL_HTTP_REQ_CTX_set_request_line 1415 3_0_0 EXIST::FUNCTION: EVP_MD_CTX_reset 1416 3_0_0 EXIST::FUNCTION: X509_NAME_new 1417 3_0_0 EXIST::FUNCTION: ASN1_item_pack 1418 3_0_0 EXIST::FUNCTION: -- 2.34.1