OSSL_HTTP_PARSE_URL(3ossl)
π¦ OSSL_HTTP_PARSE_URL(3ossl) β http utility functions π¦
okay bestie, this is the OpenSSL manual page for the http utility functions, and we're gonna get you comfy with every parameter, env var, and bracket situation. no cap. π
π NAME π
OSSL_HTTP_adapt_proxy, OSSL_parse_url, OSSL_HTTP_parse_url, OCSP_parse_url β http utility functions
β¨ SYNOPSIS β¨
First, the include and the non-deprecated besties:
#include <openssl/http.h>
const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,
const char *server, int use_ssl);
int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,
char **pport, int *pport_num,
char **ppath, char **pquery, char **pfrag);
int OSSL_HTTP_parse_url(const char *url,
int *pssl, char **puser, char **phost,
char **pport, int *pport_num,
char **ppath, char **pquery, char **pfrag);
And yeah, the following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by defining OPENSSL_API_COMPAT with a suitable version value, see openssl_user_macros(7):
int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,
int *pssl);
π¨ real talk: OCSP_parse_url() is deprecated since OpenSSL 3.0 β it's still documented below, but don't act brand new about it.
πΈ DESCRIPTION πΈ
π«Ά OSSL_HTTP_adapt_proxy() π«Ά
OSSL_HTTP_adapt_proxy() takes an optional proxy hostname proxy and returns it transformed according to the optional no_proxy parameter, server, use_ssl, and the applicable environment variable, like so:
- If
proxyisNULL, take any default value from the"http_proxy"environment variable, or from"https_proxy"ifuse_sslis nonzero. - If this still does not yield a proxy hostname, take any further default value from the
"HTTP_PROXY"environment variable, or from"HTTPS_PROXY"ifuse_sslis nonzero. - If
no_proxyisNULL, take any default exclusion value from the"no_proxy"environment variable, or else from"NO_PROXY". - Return the determined proxy host unless the exclusion value, which is a list of proxy hosts separated by
","and/or whitespace, containsserver. Otherwise returnNULL. - When
serveris a string delimited by"["and"]", which are used for IPv6 addresses, the enclosing"["and"]"are stripped prior to comparison.
π¦ OSSL_parse_url() π¦
OSSL_parse_url() parses its input string url as a URL of the form "[scheme://][userinfo@]host[:port][/path][?query][#fragment]" and splits it up into scheme, userinfo, host, port, path, query, and fragment components.
- The
host(orserver) component may be a DNS name or an IP address where IPv6 addresses must be enclosed in square brackets"["and"]". - The
portcomponent is optional and defaults to0. If given, it must be in decimal form. If thepport_numargument is notNULLthe integer value of the port number is assigned to*pport_numon success. - The
pathcomponent is also optional and defaults to"/". - Each non-
NULLresult pointer argumentpscheme,puser,phost,pport,ppath,pquery, andpfrag, is assigned the respectiveurlcomponent. - Any IPv6 address in
*phostis enclosed in"["and"]". - On success, they are guaranteed to contain non-
NULLstring pointers, elseNULL. - It is the responsibility of the caller to free them using
OPENSSL_free(3). - If
pqueryisNULL, any given query component is handled as part of the path. - A string returned via
*ppathis guaranteed to begin with a"/"character. - For absent scheme, userinfo, port, query, and fragment components an empty string is provided.
π OSSL_HTTP_parse_url() π
OSSL_HTTP_parse_url() is a special form of OSSL_parse_url() where the scheme, if given, must be "http" or "https".
- If
psslis notNULL,*psslis assigned1in case parsing was successful and the scheme is"https", else0. - The port component is optional and defaults to
443if the scheme is"https", else80. - Note that relative paths must be given with a leading
"/", otherwise the first path element is interpreted as the host.
π the deprecated one π
Calling the deprecated function OCSP_parse_url(url, host, port, path, ssl) is equivalent to OSSL_HTTP_parse_url(url, ssl, NULL, host, port, NULL, path, NULL, NULL).
π«Ά RETURN VALUES π«Ά
OSSL_HTTP_adapt_proxy() returns NULL if no proxy is to be used, otherwise a constant proxy hostname string, which is either the proxy name handed in or an environment variable value.
OSSL_parse_url(), OSSL_HTTP_parse_url(), and OCSP_parse_url() return 1 on success, 0 on error.
π SEE ALSO π
π°οΈ HISTORY π°οΈ
OSSL_HTTP_adapt_proxy(), OSSL_parse_url() and OSSL_HTTP_parse_url() were added in OpenSSL 3.0. OCSP_parse_url() was deprecated in OpenSSL 3.0.
π COPYRIGHT π
Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
π
okay that's the whole page, bestie. OpenSSL version 3.5.0, dated 2026-09-25, manual OSSL_HTTP_PARSE_URL(3ossl) β periodt. π
π¦ where this page comes from
- opensuse-leap 16.0: openssl-3-doc 3.5.0-160000.11.1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms