aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2015-05-08 17:11:46 +0000
committercorvid <devnull@localhost>2015-05-08 17:11:46 +0000
commitda51158784d8ed5bba4f609a288883731903412d (patch)
treeece4abca4160efa895022478bf71e3514240436f /src
parentac33835895fc83ace7d75d1fcd31eb1ace59ed86 (diff)
https: url updates
Diffstat (limited to 'src')
-rw-r--r--src/url.c10
-rw-r--r--src/url.h4
2 files changed, 12 insertions, 2 deletions
diff --git a/src/url.c b/src/url.c
index c1a8396d..aa211fb7 100644
--- a/src/url.c
+++ b/src/url.c
@@ -118,6 +118,12 @@ const char *a_Url_hostname(const DilloUrl *u)
}
}
+ if (!url->port) {
+ if (!dStrAsciiCasecmp(url->scheme, "http"))
+ url->port = URL_HTTP_PORT;
+ else if (!dStrAsciiCasecmp(url->scheme, "https"))
+ url->port = URL_HTTPS_PORT;
+ }
return url->hostname;
}
@@ -638,7 +644,7 @@ char *a_Url_string_strip_delimiters(const char *str)
/*
* Is the provided hostname an IP address?
*/
-static bool_t Url_host_is_ip(const char *host)
+bool_t a_Url_host_is_ip(const char *host)
{
uint_t len;
@@ -724,7 +730,7 @@ static const char *Url_host_find_public_suffix(const char *host)
const char *s;
uint_t dots;
- if (!host || !*host || Url_host_is_ip(host))
+ if (!host || !*host || a_Url_host_is_ip(host))
return host;
s = host;
diff --git a/src/url.h b/src/url.h
index ef532f76..6920f769 100644
--- a/src/url.h
+++ b/src/url.h
@@ -13,6 +13,9 @@
#include "../dlib/dlib.h"
+#define URL_HTTP_PORT 80
+#define URL_HTTPS_PORT 443
+
/*
* Values for DilloUrl->flags.
* Specifies which which action to perform with an URL.
@@ -111,6 +114,7 @@ void a_Url_set_ismap_coords(DilloUrl *u, char *coord_str);
char *a_Url_decode_hex_str(const char *str);
char *a_Url_encode_hex_str(const char *str);
char *a_Url_string_strip_delimiters(const char *str);
+bool_t a_Url_host_is_ip(const char *host);
bool_t a_Url_same_organization(const DilloUrl *u1, const DilloUrl *u2);
#ifdef __cplusplus
}