From 9c160fe32d6b5894670299aef89b79206feed322 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 26 Dec 2009 16:47:30 +0000 Subject: Only attempt to fall back to /favicon.ico if the document's base URI points to an http(s) location. svn path=/trunk/netsurf/; revision=9760 --- render/favicon.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'render/favicon.c') 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 "://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; -- cgit v1.2.3