OSSL_HTTP_get

Perform an HTTP GET and return a memory BIO holding the response body.

Synopsis

Declared in <openssl/http.h>

BIO*
OSSL_HTTP_get(
    char const* url,
    char const* proxy,
    char const* no_proxy,
    BIO* bio,
    BIO* rbio,
    OSSL_HTTP_bio_cb_t bio_update_fn,
    void* arg,
    int buf_size,
    stack_st_CONF_VALUE const* headers,
    char const* expected_content_type,
    int expect_asn1,
    size_t max_resp_len,
    int timeout);

Return Value

Memory BIO with the response body on success (caller frees), or NULL on failure.

Parameters

NameDescription
urlAbsolute http:// or https:// URL to fetch.
proxyOptional HTTP(S) proxy URL/host, or NULL to use environment defaults.
no_proxyOptional host exclusion list, or NULL for environment defaults.
bioOptional write BIO; NULL builds an internal connect BIO from url.
rbioOptional read BIO paired with bio when both are non-NULL.
bio_update_fnOptional connect/TLS BIO callback (needed for https when bio is NULL).
argOpaque argument forwarded to bio_update_fn.
buf_sizeMax header line length / read chunk; <= 0 uses the default.
headersOptional additional request headers, or NULL.
expected_content_typeRequired Content-Type (exact or prefix), or NULL for any.
expect_asn1Nonzero if the body must be ASN.1 DER.
max_resp_lenMaximum accepted response body length in bytes; 0 means unlimited.
timeoutSoft transfer timeout in seconds (<= 0 waits indefinitely where supported).