OSSL_HTTP_PARSE_URL(3ossl)
π OSSL_HTTP_PARSE_URL π
okay so bestie, welcome to the OpenSSL 3ossl manual, page OSSL_HTTP_PARSE_URL(3ossl) β it's giving URL parsing, proxy vibes, and a lil deprecated friend we don't talk to anymore π«Ά
β¨ NAME β¨
OSSL_HTTP_adapt_proxy, OSSL_parse_url, OSSL_HTTP_parse_url, OCSP_parse_url β the http utility functions, aka the girlies who take a URL apart and figure out if you're going through a proxy π
πΈ SYNOPSIS πΈ
#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);
π¨ The following functions have been deprecated since OpenSSL 3.0, and can be hidden entirely by definingOPENSSL_API_COMPATwith a suitable version value, seeopenssl_user_macros(7):
int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,
int *pssl);
π¦ DESCRIPTION π¦
π« OSSL_HTTP_adapt_proxy()
OSSL_HTTP_adapt_proxy() figures out whether a proxy should even be used when connecting to the given server. She 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 this:
- 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. - Return the determined proxy host if
serveris the empty string orserveris not in the exclusion list. - The exclusion list is a list of server hosts separated by
","and/or whitespace. They may be given via theno_proxyparameter. If it isNULL, the exclusion list is taken from the"no_proxy"environment variable if set, otherwise from"NO_PROXY". - Otherwise return
NULL. π - 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 notNULL, the 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 usingOPENSSL_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, andfragmentcomponents 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". No cap. π
- If
psslis notNULL,*psslis assigned1in case parsing was successful and the scheme is"https", else0. - The
portcomponent is optional and defaults to443if 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. Not me making that mistake π
π« OCSP_parse_url() (the deprecated one, she's retired)
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. Slay or fail, no in-between bestie π
π₯ SEE ALSO π₯
β HISTORY β
OSSL_HTTP_adapt_proxy(),OSSL_parse_url()andOSSL_HTTP_parse_url()were added in OpenSSL 3.0.OCSP_parse_url()was deprecated in OpenSSL 3.0. πͺ¦
π COPYRIGHT π
Copyright 2019-2026 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>.
and that's the whole page, bestie!! πβ¨π¦ this was OpenSSL 3.5.9, dated 2026-09-29, page OSSL_HTTP_PARSE_URL(3ossl) β go parse some URLs, you absolute icon ππ
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms