Open (or reuse), send one HTTP request, receive the response, and optionally keep the connection.

Synopsis

Declared in <openssl/http.h>

BIO*
OSSL_HTTP_transfer(
    OSSL_HTTP_REQ_CTX** prctx,
    char const* server,
    char const* port,
    char const* path,
    int use_ssl,
    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* content_type,
    BIO* req,
    char const* expected_content_type,
    int expect_asn1,
    size_t max_resp_len,
    int timeout,
    int keep_alive);

Return Value

Response‐body BIO owned by the caller (free with BIO_free*), or NULL on failure.

Parameters

Name

Description

prctx

Optional address of an OSSL_HTTP_REQ_CTX*; reuses *`prctx` when non‐NULL, else opens; may be set to NULL when closed.

server

Hostname or address to contact when opening a new connection.

port

Service port, or NULL for the default (80/443).

path

Request path (or absolute URI for a proxy).

use_ssl

Nonzero to use HTTPS (requires bio_update_fn when opening via sockets).

proxy

Optional HTTP(S) proxy, or NULL to consult environment defaults.

no_proxy

Optional comma/whitespace host exclusion list, or NULL for environment defaults.

bio

Optional write BIO; NULL builds an internal connect BIO from server/port.

rbio

Optional read BIO used with bio when both are non‐NULL (no auto‐connect).

bio_update_fn

Optional connect/disconnect BIO callback (required for TLS when bio is NULL).

arg

Callback argument for bio_update_fn (not consumed).

buf_size

Max header line length / read chunk; <= 0 uses the default.

headers

Optional additional request headers, or NULL.

content_type

Content‐Type for req, or NULL.

req

Optional request‐body BIO, or NULL for a GET‐style exchange.

expected_content_type

Expected response Content‐Type, or NULL.

expect_asn1

Nonzero if the response body should be treated as ASN.1 DER.

max_resp_len

Maximum accepted response length in bytes.

timeout

Soft overall timeout in seconds for this exchange.

keep_alive

Keep‐alive preference (0/1/2 as for OSSL_HTTP_set1_request()).

Created with MrDocs