summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--content/fetchers/resource.c1
-rw-r--r--desktop/browser.c28
2 files changed, 27 insertions, 2 deletions
diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c
index 87eaa3860..ff1c0af9b 100644
--- a/content/fetchers/resource.c
+++ b/content/fetchers/resource.c
@@ -78,6 +78,7 @@ static const char *fetch_resource_paths[] = {
"quirks.css",
"credits.html",
"licence.html",
+ "favicon.png",
"netsurf.png"
};
static struct fetch_resource_map_entry {
diff --git a/desktop/browser.c b/desktop/browser.c
index b74a27d89..f442809f9 100644
--- a/desktop/browser.c
+++ b/desktop/browser.c
@@ -973,8 +973,32 @@ static void browser_window_update_favicon(hlcache_handle *c,
}
if (link == NULL) {
- /* no favicon via link, try for the default location - bletch */
- error = nsurl_join(content_get_url(c), "/favicon.ico", &nsurl);
+ lwc_string *scheme;
+
+ lwc_string *http_str;
+ lwc_string *https_str;
+ bool http_match = false;
+ bool https_match = false;
+
+ nsurl = content_get_url(c);
+
+ scheme = nsurl_get_component(nsurl, NSURL_SCHEME);
+
+ lwc_intern_string("http", SLEN("http"), &http_str);
+ lwc_intern_string("https", SLEN("https"), &https_str);
+ lwc_string_caseless_isequal(scheme, http_str, &http_match);
+ lwc_string_caseless_isequal(scheme, https_str, &https_match);
+ lwc_string_unref(http_str);
+ lwc_string_unref(https_str);
+
+ lwc_string_unref(scheme);
+
+ if (http_match || https_match) {
+ /* no favicon via link, try for the default location */
+ error = nsurl_join(nsurl, "/favicon.ico", &nsurl);
+ } else {
+ error = nsurl_create("resource:favicon.png", &nsurl);
+ }
if (error != NSERROR_OK) {
LOG(("Unable to create default location url"));
return;