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

Name

Description

url

URL of the form [http[s]://][userinfo@]host[:port][/path][?query][#fragment].

pssl

Optional; set to 1 if the scheme is https, else 0.

puser

Optional out for userinfo (empty string if absent); free with OPENSSL_free.

phost

Optional out for host (IPv6 enclosed in brackets); free with OPENSSL_free.

pport

Optional out for port string (defaults "80"/"443"); free with OPENSSL_free.

pport_num

Optional out for the numeric port.

ppath

Optional out for path (always begins with '/'); free with OPENSSL_free.

pquery

Optional out for query (empty if absent); free with OPENSSL_free.

pfrag

Optional out for fragment (empty if absent); free with OPENSSL_free.

Created with MrDocs