summaryrefslogtreecommitdiff
path: root/render/favicon.c
diff options
context:
space:
mode:
Diffstat (limited to 'render/favicon.c')
-rw-r--r--render/favicon.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/render/favicon.c b/render/favicon.c
index cc75ca0cb..3160a0ff2 100644
--- a/render/favicon.c
+++ b/render/favicon.c
@@ -103,6 +103,23 @@ char *favicon_get_icon_ref(struct content *c, xmlNode *html)
}
}
if (url2 == NULL) {
+ char *scheme;
+
+ /* There was no icon link defined in the HTML source data.
+ * If the HTML document's base URL uses either the HTTP or
+ * HTTPS schemes, then try using "<scheme>://host/favicon.ico"
+ */
+ if (url_scheme(c->data.html.base_url, &scheme) != URL_FUNC_OK)
+ return NULL;
+
+ if (strcasecmp(scheme, "http") != 0 &&
+ strcasecmp(scheme, "https") != 0) {
+ free(scheme);
+ return NULL;
+ }
+
+ free(scheme);
+
if (url_join("/favicon.ico", c->data.html.base_url, &url2)
!= URL_FUNC_OK)
return NULL;