Commit 4c4531a6 authored by David Woodhouse's avatar David Woodhouse

Rename openconnect_parse_url() to internal_parse_url()

We only need to expose a simpler version of this
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 21d459d7
......@@ -520,8 +520,8 @@ char *local_strcasestr(const char *haystack, const char *needle)
#define strcasestr local_strcasestr
#endif
int openconnect_parse_url(char *url, char **res_proto, char **res_host, int *res_port,
char **res_path, int default_port)
int internal_parse_url(char *url, char **res_proto, char **res_host,
int *res_port, char **res_path, int default_port)
{
char *proto = url;
char *host, *path, *port_str;
......@@ -668,7 +668,7 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
free(vpninfo->urlpath);
vpninfo->urlpath = NULL;
ret = openconnect_parse_url(vpninfo->redirect_url, NULL, &host, &port, &vpninfo->urlpath, 0);
ret = internal_parse_url(vpninfo->redirect_url, NULL, &host, &port, &vpninfo->urlpath, 0);
if (ret) {
vpninfo->progress(vpninfo, PRG_ERR, "Failed to parse redirected URL '%s': %s\n",
vpninfo->redirect_url, strerror(-ret));
......@@ -1088,8 +1088,8 @@ int openconnect_set_http_proxy(struct openconnect_info *vpninfo, char *proxy)
free(vpninfo->proxy);
vpninfo->proxy = NULL;
ret = openconnect_parse_url(url, &vpninfo->proxy_type, &vpninfo->proxy,
&vpninfo->proxy_port, NULL, 80);
ret = internal_parse_url(url, &vpninfo->proxy_type, &vpninfo->proxy,
&vpninfo->proxy_port, NULL, 80);
if (ret)
goto out;
......
......@@ -484,7 +484,7 @@ int main(int argc, char **argv)
char *scheme;
char *group;
if (openconnect_parse_url(url, &scheme, &vpninfo->hostname, &vpninfo->port,
if (internal_parse_url(url, &scheme, &vpninfo->hostname, &vpninfo->port,
&group, 443)) {
fprintf(stderr, "Failed to parse server URL '%s'\n",
url);
......
......@@ -1197,7 +1197,7 @@ static void connect_host(auth_ui_data *ui_data)
for (i = 0; i < host_nr; i++)
host = host->next;
if (openconnect_parse_url(host->hostaddress, NULL,
if (internal_parse_url(host->hostaddress, NULL,
&ui_data->vpninfo->hostname, &ui_data->vpninfo->port,
&ui_data->vpninfo->urlpath, 443)) {
fprintf(stderr, "Failed to parse server URL '%s'\n",
......
......@@ -279,6 +279,8 @@ int parse_xml_response(struct openconnect_info *vpninfo, char *response,
/* http.c */
int process_proxy(struct openconnect_info *vpninfo, int ssl_sock);
int internal_parse_url(char *url, char **res_proto, char **res_host,
int *res_port, char **res_path, int default_port);
/* ssl_ui.c */
int set_openssl_ui(void);
......
......@@ -96,7 +96,5 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo);
void openconnect_close_https(struct openconnect_info *vpninfo);
char *openconnect_create_useragent(char *base);
void openconnect_init_openssl(void);
int openconnect_parse_url(char *url, char **res_proto, char **res_host,
int *res_port, char **res_path, int default_port);
#endif /* __OPENCONNECT_H__ */
......@@ -605,7 +605,7 @@ int match_cert_hostname(struct openconnect_info *vpninfo, X509 *peer_cert)
if (strlen(str) != len)
continue;
if (openconnect_parse_url(str, &url_proto, &url_host, &url_port, &url_path, 0)) {
if (internal_parse_url(str, &url_proto, &url_host, &url_port, &url_path, 0)) {
OPENSSL_free(str);
continue;
}
......@@ -903,7 +903,7 @@ int openconnect_open_https(struct openconnect_info *vpninfo)
(!strncmp(proxies[i], "http://", 7) ||
!strncmp(proxies[i], "socks://", 8) ||
!strncmp(proxies[i], "socks5://", 9)))
openconnect_parse_url(proxies[i], &vpninfo->proxy_type,
internal_parse_url(proxies[i], &vpninfo->proxy_type,
&vpninfo->proxy, &vpninfo->proxy_port,
NULL, 0);
i++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment