1OSSL_HTTP_PARSE_URL(3ossl)          OpenSSL         OSSL_HTTP_PARSE_URL(3ossl)
2
3
4

NAME

6       OSSL_HTTP_adapt_proxy, OSSL_parse_url, OSSL_HTTP_parse_url,
7       OCSP_parse_url - http utility functions
8

SYNOPSIS

10        #include <openssl/http.h>
11
12        const char *OSSL_HTTP_adapt_proxy(const char *proxy, const char *no_proxy,
13                                          const char *server, int use_ssl);
14
15        int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,
16                           char **pport, int *pport_num,
17                           char **ppath, char **pquery, char **pfrag);
18        int OSSL_HTTP_parse_url(const char *url,
19                                int *pssl, char **puser, char **phost,
20                                char **pport, int *pport_num,
21                                char **ppath, char **pquery, char **pfrag);
22
23       The following functions have been deprecated since OpenSSL 3.0, and can
24       be hidden entirely by defining OPENSSL_API_COMPAT with a suitable
25       version value, see openssl_user_macros(7):
26
27        int OCSP_parse_url(const char *url, char **phost, char **pport, char **ppath,
28                           int *pssl);
29

DESCRIPTION

31       OSSL_HTTP_adapt_proxy() takes an optional proxy hostname proxy and
32       returns it transformed according to the optional no_proxy parameter,
33       server, use_ssl, and the applicable environment variable, as follows.
34       If proxy is NULL, take any default value from the "http_proxy"
35       environment variable, or from "https_proxy" if use_ssl is nonzero.  If
36       this still does not yield a proxy hostname, take any further default
37       value from the "HTTP_PROXY" environment variable, or from "HTTPS_PROXY"
38       if use_ssl is nonzero.  If no_proxy is NULL, take any default exclusion
39       value from the "no_proxy" environment variable, or else from
40       "NO_PROXY".  Return the determined proxy hostname unless the exclusion
41       contains server.  Otherwise return NULL.
42
43       OSSL_parse_url() parses its input string url as a URL of the form
44       "[scheme://][userinfo@]host[:port][/path][?query][#fragment]" and
45       splits it up into scheme, userinfo, host, port, path, query, and
46       fragment components.  The host (or server) component may be a DNS name
47       or an IP address where IPv6 addresses should be enclosed in square
48       brackets "[" and "]".  The port component is optional and defaults to
49       0.  If given, it must be in decimal form.  If the pport_num argument is
50       not NULL the integer value of the port number is assigned to *pport_num
51       on success.  The path component is also optional and defaults to "/".
52       Each non-NULL result pointer argument pscheme, puser, phost, pport,
53       ppath, pquery, and pfrag, is assigned the respective url component.  On
54       success, they are guaranteed to contain non-NULL string pointers, else
55       NULL.  It is the responsibility of the caller to free them using
56       OPENSSL_free(3).  If pquery is NULL, any given query component is
57       handled as part of the path.  A string returned via *ppath is
58       guaranteed to begin with a "/" character.  For absent scheme, userinfo,
59       port, query, and fragment components an empty string is provided.
60
61       OSSL_HTTP_parse_url() is a special form of OSSL_parse_url() where the
62       scheme, if given, must be "http" or "https".  If pssl is not NULL,
63       *pssl is assigned 1 in case parsing was successful and the scheme is
64       "https", else 0.  The port component is optional and defaults to 443 if
65       the scheme is "https", else 80.  Note that relative paths must be given
66       with a leading "/", otherwise the first path element is interpreted as
67       the hostname.
68
69       Calling the deprecated function OCSP_parse_url(url, host, port, path,
70       ssl) is equivalent to OSSL_HTTP_parse_url(url, ssl, NULL, host, port,
71       NULL, path, NULL, NULL).
72

RETURN VALUES

74       OSSL_HTTP_adapt_proxy() returns NULL if no proxy is to be used,
75       otherwise a constant proxy hostname string, which is either the proxy
76       name handed in or an environment variable value.
77
78       OSSL_parse_url(), OSSL_HTTP_parse_url(), and OCSP_parse_url() return 1
79       on success, 0 on error.
80

SEE ALSO

82       OSSL_HTTP_transfer(3)
83

HISTORY

85       OSSL_HTTP_adapt_proxy(), OSSL_parse_url() and OSSL_HTTP_parse_url()
86       were added in OpenSSL 3.0.  OCSP_parse_url() was deprecated in OpenSSL
87       3.0.
88
90       Copyright 2019-2022 The OpenSSL Project Authors. All Rights Reserved.
91
92       Licensed under the Apache License 2.0 (the "License").  You may not use
93       this file except in compliance with the License.  You can obtain a copy
94       in the file LICENSE in the source distribution or at
95       <https://www.openssl.org/source/license.html>.
96
97
98
993.1.1                             2023-08-31        OSSL_HTTP_PARSE_URL(3ossl)
Impressum