[#OSSL_HTTP_transfer]
= OSSL&lowbar;HTTP&lowbar;transfer
:mrdocs:

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

== Synopsis

Declared in `&lt;openssl&sol;http&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:BIO.adoc[BIO]*
OSSL&lowbar;HTTP&lowbar;transfer(
    xref:OSSL_HTTP_REQ_CTX.adoc[OSSL&lowbar;HTTP&lowbar;REQ&lowbar;CTX]** prctx,
    char const* server,
    char const* port,
    char const* path,
    int use&lowbar;ssl,
    char const* proxy,
    char const* no&lowbar;proxy,
    xref:BIO.adoc[BIO]* bio,
    xref:BIO.adoc[BIO]* rbio,
    xref:OSSL_HTTP_bio_cb_t.adoc[OSSL&lowbar;HTTP&lowbar;bio&lowbar;cb&lowbar;t] bio&lowbar;update&lowbar;fn,
    void* arg,
    int buf&lowbar;size,
    stack&lowbar;st&lowbar;CONF&lowbar;VALUE const* headers,
    char const* content&lowbar;type,
    xref:BIO.adoc[BIO]* req,
    char const* expected&lowbar;content&lowbar;type,
    int expect&lowbar;asn1,
    size&lowbar;t max&lowbar;resp&lowbar;len,
    int timeout,
    int keep&lowbar;alive);
----

== Return Value

Response&hyphen;body BIO owned by the caller (free with BIO&lowbar;free&ast;), or NULL on failure&period;

== Parameters

[cols="1,4"]
|===
| Name| Description
| *prctx*
| Optional address of an OSSL&lowbar;HTTP&lowbar;REQ&lowbar;CTX&ast;&semi; reuses &ast;`prctx` when non&hyphen;NULL, else opens&semi; may be set to NULL when closed&period;
| *server*
| Hostname or address to contact when opening a new connection&period;
| *port*
| Service port, or NULL for the default (80&sol;443)&period;
| *path*
| Request path (or absolute URI for a proxy)&period;
| *use&lowbar;ssl*
| Nonzero to use HTTPS (requires `bio&lowbar;update&lowbar;fn` when opening via sockets)&period;
| *proxy*
| Optional HTTP(S) proxy, or NULL to consult environment defaults&period;
| *no&lowbar;proxy*
| Optional comma&sol;whitespace host exclusion list, or NULL for environment defaults&period;
| *bio*
| Optional write BIO&semi; NULL builds an internal connect BIO from `server&sol;port&period;`
| *rbio*
| Optional read BIO used with `bio` when both are non&hyphen;NULL (no auto&hyphen;connect)&period;
| *bio&lowbar;update&lowbar;fn*
| Optional connect&sol;disconnect BIO callback (required for TLS when `bio` is NULL)&period;
| *arg*
| Callback argument for `bio&lowbar;update&lowbar;fn` (not consumed)&period;
| *buf&lowbar;size*
| Max header line length &sol; read chunk&semi; &lt;&equals; 0 uses the default&period;
| *headers*
| Optional additional request headers, or NULL&period;
| *content&lowbar;type*
| Content&hyphen;Type for `req,` or NULL&period;
| *req*
| Optional request&hyphen;body BIO, or NULL for a GET&hyphen;style exchange&period;
| *expected&lowbar;content&lowbar;type*
| Expected response Content&hyphen;Type, or NULL&period;
| *expect&lowbar;asn1*
| Nonzero if the response body should be treated as ASN&period;1 DER&period;
| *max&lowbar;resp&lowbar;len*
| Maximum accepted response length in bytes&period;
| *timeout*
| Soft overall timeout in seconds for this exchange&period;
| *keep&lowbar;alive*
| Keep&hyphen;alive preference (0&sol;1&sol;2 as for OSSL&lowbar;HTTP&lowbar;set1&lowbar;request())&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
