|
|
|
@ -30,7 +30,7 @@ OSSL_HTTP_close
|
|
|
|
|
const STACK_OF(CONF_VALUE) *headers,
|
|
|
|
|
const char *content_type, BIO *req,
|
|
|
|
|
const char *expected_content_type, int expect_asn1,
|
|
|
|
|
size_t max_resp_len, int timeout, int keep_alive);
|
|
|
|
|
int timeout, int keep_alive);
|
|
|
|
|
BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url);
|
|
|
|
|
BIO *OSSL_HTTP_get(const char *url, const char *proxy, const char *no_proxy,
|
|
|
|
|
BIO *bio, BIO *rbio,
|
|
|
|
@ -52,8 +52,8 @@ OSSL_HTTP_close
|
|
|
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
|
|
|
|
|
|
|
|
|
OSSL_HTTP_open() initiates an HTTP session using I<bio> if not NULL, else
|
|
|
|
|
by connecting to a given I<server> optionally via a I<proxy>.
|
|
|
|
|
OSSL_HTTP_open() initiates an HTTP session using the I<bio> argument if not
|
|
|
|
|
NULL, else by connecting to a given I<server> optionally via a I<proxy>.
|
|
|
|
|
|
|
|
|
|
Typically the OpenSSL build supports sockets and the I<bio> parameter is NULL.
|
|
|
|
|
In this case I<rbio> must be NULL as well, and the
|
|
|
|
@ -148,12 +148,12 @@ Since this function is typically called by applications such as
|
|
|
|
|
L<openssl-s_client(1)> it uses the I<bio_err> and I<prog> parameters (unless
|
|
|
|
|
NULL) to print additional diagnostic information in a user-oriented way.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OSSL_HTTP_set_request() sets up in I<rctx> the request header and content data
|
|
|
|
|
and expectations on the response using the following parameters.
|
|
|
|
|
If I<path> is NULL it defaults to "/".
|
|
|
|
|
If I<req_mem> is NULL the HTTP GET method will be used to send the request
|
|
|
|
|
else HTTP POST with the contents of I<req_mem> and optional I<content_type>.
|
|
|
|
|
If I<req> is NULL the HTTP GET method will be used to send the request
|
|
|
|
|
else HTTP POST with the contents of I<req> and optional I<content_type>, where
|
|
|
|
|
I<req> must contain data with determined length; streaming is not supported.
|
|
|
|
|
The optional list I<headers> may contain additional custom HTTP header lines.
|
|
|
|
|
If the parameter I<expected_content_type>
|
|
|
|
|
is not NULL then the client will check that the given content type string
|
|
|
|
@ -172,15 +172,15 @@ If the value is 1 or 2 then a persistent connection is requested.
|
|
|
|
|
If the value is 2 then a persistent connection is required,
|
|
|
|
|
i.e., an error occurs in case the server does not grant it.
|
|
|
|
|
|
|
|
|
|
OSSL_HTTP_transfer() exchanges any form of HTTP request and response
|
|
|
|
|
OSSL_HTTP_exchange() exchanges any form of HTTP request and response
|
|
|
|
|
as specified by I<rctx>, which must include both connection and request data,
|
|
|
|
|
typically set up using OSSL_HTTP_open() and OSSL_HTTP_set_request().
|
|
|
|
|
It implements the core of the functions described below.
|
|
|
|
|
If the HTTP method is GET and I<redirection_url>
|
|
|
|
|
is not NULL the latter pointer is used to provide any new location that
|
|
|
|
|
the server may return with HTTP code 301 (MOVED_PERMANENTLY) or 302 (FOUND).
|
|
|
|
|
In this case the caller is responsible for deallocating this URL with
|
|
|
|
|
L<OPENSSL_free(3)>.
|
|
|
|
|
In this case the function returns NULL and the caller is
|
|
|
|
|
responsible for deallocating the URL with L<OPENSSL_free(3)>.
|
|
|
|
|
If the response header contains one or more "Content-Length" header lines and/or
|
|
|
|
|
an ASN.1-encoded response is expected, which should include a total length,
|
|
|
|
|
the length indications received are checked for consistency
|
|
|
|
@ -203,6 +203,17 @@ and the I<bio_update_fn>, as described for OSSL_HTTP_open(), must be provided.
|
|
|
|
|
Also the remaining parameters are interpreted as described for OSSL_HTTP_open()
|
|
|
|
|
and OSSL_HTTP_set_request(), respectively.
|
|
|
|
|
|
|
|
|
|
OSSL_HTTP_transfer() exchanges an HTTP request and response
|
|
|
|
|
over a connection managed via I<prctx> without supporting redirection.
|
|
|
|
|
It combines OSSL_HTTP_open(), OSSL_HTTP_set_request(), OSSL_HTTP_exchange(),
|
|
|
|
|
and OSSL_HTTP_close().
|
|
|
|
|
If I<prctx> is not NULL it reuses any open connection represented by a non-NULL
|
|
|
|
|
I<*prctx>. It keeps the connection open if a persistent connection is requested
|
|
|
|
|
or required and this was granted by the server, else it closes the connection
|
|
|
|
|
and assigns NULL to I<*prctx>.
|
|
|
|
|
The remaining parameters are interpreted as described for OSSL_HTTP_open()
|
|
|
|
|
and OSSL_HTTP_set_request(), respectively.
|
|
|
|
|
|
|
|
|
|
OSSL_HTTP_close() closes the connection and releases I<rctx>.
|
|
|
|
|
The I<ok> parameter is passed to any BIO update function
|
|
|
|
|
given during setup as described above for OSSL_HTTP_open().
|
|
|
|
@ -222,9 +233,8 @@ OSSL_HTTP_proxy_connect() and OSSL_HTTP_set_request()
|
|
|
|
|
return 1 on success, 0 on error.
|
|
|
|
|
|
|
|
|
|
On success, OSSL_HTTP_exchange(), OSSL_HTTP_get(), and OSSL_HTTP_transfer()
|
|
|
|
|
return a memory BIO containing the data received if an ASN.1-encoded response
|
|
|
|
|
is expected, else a BIO that may support streaming.
|
|
|
|
|
The BIO must be freed by the caller.
|
|
|
|
|
return a memory BIO containing the data received.
|
|
|
|
|
This must be freed by the caller.
|
|
|
|
|
On failure, they return NULL.
|
|
|
|
|
Failure conditions include connection/transfer timeout, parse errors, etc.
|
|
|
|
|
|
|
|
|
|