OSSL_HTTP_parse_url

Parse an http or https URL into allocated component strings.

Synopsis

Declared in <openssl/http.h>

int
OSSL_HTTP_parse_url(
    char const* url,
    int* pssl,
    char** puser,
    char** phost,
    char** pport,
    int* pport_num,
    char** ppath,
    char** pquery,
    char** pfrag);

Return Value

1 on success, or 0 on error.

Parameters

NameDescription
urlURL of the form [http[s]://][userinfo@]host[:port][/path][?query][#fragment].
psslOptional; set to 1 if the scheme is https, else 0.
puserOptional out for userinfo (empty string if absent); free with OPENSSL_free.
phostOptional out for host (IPv6 enclosed in brackets); free with OPENSSL_free.
pportOptional out for port string (defaults "80"/"443"); free with OPENSSL_free.
pport_numOptional out for the numeric port.
ppathOptional out for path (always begins with '/'); free with OPENSSL_free.
pqueryOptional out for query (empty if absent); free with OPENSSL_free.
pfragOptional out for fragment (empty if absent); free with OPENSSL_free.