netsurf: branch master updated. release/3.9-288-g4eb06ad
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/4eb06ad2cf2b702597461...
...commit http://git.netsurf-browser.org/netsurf.git/commit/4eb06ad2cf2b7025974618b...
...tree http://git.netsurf-browser.org/netsurf.git/tree/4eb06ad2cf2b7025974618be9...
The branch, master has been updated
via 4eb06ad2cf2b7025974618be943dea9718d09319 (commit)
via 4b0c3f0efef2239dd5d62a9e73eeec4037c056a4 (commit)
via 76eac192272acf77763d0c619cd78118650748cf (commit)
from 1176ce427113face73c48c4b2e4e5a810577b355 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4eb06ad2cf2b7025974...
commit 4eb06ad2cf2b7025974618be943dea9718d09319
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
move the fallback text for about handler into messages handler
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index e98c6ec..02bac81 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -79,25 +79,6 @@ struct about_handlers {
bool hidden; /**< If entry should be hidden in listing */
};
-/**
- * authentication query description if messages fails to retrieve usable text
- */
-static const char *authentication_description_fallback = "The site %s is requesting your username and password. The realm is \"%s\"";
-
-/**
- * privacy query description if messages fails to retrieve usable text
- */
-static const char *privacy_description_fallback = "A privacy error occurred while communicating with %s this may be a site configuration error or an attempt to steal private information (passwords, messages or credit cards)";
-
-/**
- * timeout query description if messages fails to retrieve usable text
- */
-static const char *timeout_description_fallback = "A connection to %s could not be established. The site may be temporarily unavailable or too busy to respond.";
-
-/**
- * fetcherror query description if messages fails to retrieve usable text
- */
-static const char *fetcherror_description_fallback = "An error occoured when connecting to %s";
/**
* issue fetch callbacks with locking
@@ -740,7 +721,6 @@ get_authentication_description(struct nsurl *url,
char *url_s;
size_t url_l;
char *str = NULL;
- int slen;
const char *key;
res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
@@ -755,23 +735,46 @@ get_authentication_description(struct nsurl *url,
}
str = messages_get_buff(key, url_s, realm);
- NSLOG(netsurf, INFO,
- "key:%s url:%s realm:%s str:%s", key, url_s, realm, str);
-
- if ((str != NULL) && (strcmp(key, str) != 0)) {
+ if (str != NULL) {
+ NSLOG(netsurf, INFO,
+ "key:%s url:%s realm:%s str:%s",
+ key, url_s, realm, str);
*out_str = str;
} else {
- /* no message so fallback */
- slen = snprintf(str, 0, authentication_description_fallback,
- url_s, realm) + 1;
- str = malloc(slen);
- if (str == NULL) {
- res = NSERROR_NOMEM;
- } else {
- snprintf(str, slen, authentication_description_fallback,
- url_s, realm);
- *out_str = str;
- }
+ res = NSERROR_NOMEM;
+ }
+
+ free(url_s);
+
+ return res;
+}
+
+
+/**
+ * generate a generic query description
+ */
+static nserror
+get_query_description(struct nsurl *url,
+ const char *key,
+ char **out_str)
+{
+ nserror res;
+ char *url_s;
+ size_t url_l;
+ char *str = NULL;
+
+ /* get the host in question */
+ res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ return res;
+ }
+
+ /* obtain the description with the url substituted */
+ str = messages_get_buff(key, url_s);
+ if (str == NULL) {
+ res = NSERROR_NOMEM;
+ } else {
+ *out_str = str;
}
free(url_s);
@@ -949,56 +952,6 @@ fetch_about_query_auth_handler_aborted:
/**
- * generate a query description
- */
-static nserror
-get_query_description(struct nsurl *url,
- const char *key,
- const char *fallback,
- char **out_str)
-{
- nserror res;
- char *url_s;
- size_t url_l;
- char *str = NULL;
-
- /* get the host in question */
- res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
- if (res != NSERROR_OK) {
- return res;
- }
-
- /* obtain the description with the url substituted */
- str = messages_get_buff(key, url_s);
- if ((str != NULL) && (strcmp(key, str) == 0)) {
- /* the returned string was simply the key */
- free(str);
- str = NULL;
- }
- if (str == NULL) {
- /* failed to get suitable translated message text so
- * fall back to basic english.
- */
- int slen;
- slen = snprintf(str, 0, fallback, url_s) + 1;
- str = malloc(slen);
- if (str != NULL) {
- snprintf(str, slen, fallback, url_s);
- }
- }
-
- if (str == NULL) {
- res = NSERROR_NOMEM;
- } else {
- *out_str = str;
- }
- free(url_s);
-
- return res;
-}
-
-
-/**
* Handler to generate about scheme privacy query page
*
* \param ctx The fetcher context.
@@ -1064,7 +1017,6 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
res = get_query_description(siteurl,
"PrivacyDescription",
- privacy_description_fallback,
&description);
if (res == NSERROR_OK) {
res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
@@ -1187,7 +1139,6 @@ static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx)
res = get_query_description(siteurl,
"TimeoutDescription",
- timeout_description_fallback,
&description);
if (res == NSERROR_OK) {
res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
@@ -1311,7 +1262,6 @@ fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx)
res = get_query_description(siteurl,
"FetchErrorDescription",
- fetcherror_description_fallback,
&description);
if (res == NSERROR_OK) {
res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
diff --git a/resources/FatMessages b/resources/FatMessages
index 06d61c9..5ebf607 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -25,7 +25,7 @@
#
# The split-messages tool requires keys for all languages to be
# grouped together but language order is not important. If a key for a
-# specific language is ommited the default language value will be used
+# specific language is omitted the default language value will be used
# instead (currently en)
#
# If you find something tagged 'all', but it is only relevant to a specific
@@ -1099,8 +1099,8 @@ en.all.TryAgain: Try Again
# Fetch error interface
# =======================
#
-en.all.FetchErrorTitle:Error occured fetching page
-en.all.FetchErrorDescription:An error occoured when connecting to %s
+en.all.FetchErrorTitle:Error occurred fetching page
+en.all.FetchErrorDescription:An error occurred when connecting to %s
# SSL certificate viewer
diff --git a/test/messages.c b/test/messages.c
index ae82d1e..3ec770a 100644
--- a/test/messages.c
+++ b/test/messages.c
@@ -118,8 +118,7 @@ START_TEST(message_get_buff_test)
ck_assert_int_eq(res, NSERROR_OK);
buf = messages_get_buff("DefinitelyNotAKey");
- ck_assert_str_eq(buf, "DefinitelyNotAKey");
- free(buf);
+ ck_assert(buf == NULL);
buf = messages_get_buff("NoMemory");
ck_assert_str_eq(buf, "NetSurf is running out of memory. Please free some memory and try again.");
diff --git a/utils/hashtable.c b/utils/hashtable.c
index 4935d6b..aa162cb 100644
--- a/utils/hashtable.c
+++ b/utils/hashtable.c
@@ -347,10 +347,12 @@ const char *hash_get(struct hash_table *ht, const char *key)
h = hash_string_fnv(key, &key_length);
c = h % ht->nchains;
- for (e = ht->chain[c]; e; e = e->next)
+ for (e = ht->chain[c]; e; e = e->next) {
if ((key_length == e->key_length) &&
- (memcmp(key, e->pairing, key_length) == 0))
+ (memcmp(key, e->pairing, key_length) == 0)) {
return e->pairing + key_length + 1;
+ }
+ }
return NULL;
}
diff --git a/utils/messages.c b/utils/messages.c
index 197d45e..5525e18 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -42,11 +42,69 @@
/** Messages are stored in a fixed-size hash table. */
#define HASH_SIZE 101
-/** The hash table used to store the standard Messages file for the old API */
+/**
+ * The hash table used to store the standard Messages file for the old API
+ */
static struct hash_table *messages_hash = NULL;
/**
+ * Create a message context
+ *
+ * generate a message context populated with english fallbacks for
+ * some formatted messages.
+ */
+static struct hash_table *messages_create_ctx(int hash_size)
+{
+ struct hash_table *nctx;
+ const struct {
+ const char *key;
+ const char *value;
+ } fallback[] = {
+ { "LoginDescription",
+ "The site %s is requesting your username and password. "
+ "The realm is \"%s\""},
+ { "PrivacyDescription",
+ "A privacy error occurred while communicating with %s this "
+ "may be a site configuration error or an attempt to steal "
+ "private information (passwords, messages or credit cards)"},
+ { "TimeoutDescription",
+ "A connection to %s could not be established. The site may "
+ "be temporarily unavailable or too busy to respond."},
+ { "FetchErrorDescription",
+ "An error occurred when connecting to %s"},
+ { NULL, NULL}
+ };
+ nctx = hash_create(hash_size);
+
+ if (nctx != NULL) {
+ int floop;
+ for (floop = 0; fallback[floop].key != NULL; floop++) {
+ hash_add(nctx,
+ fallback[floop].key,
+ fallback[floop].value);
+ }
+ }
+
+ return nctx;
+}
+
+/**
+ * Free memory used by a messages hash.
+ * The context will not be valid after this function returns.
+ *
+ * \param ctx context of messages file to free
+ */
+static void messages_destroy_ctx(struct hash_table *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ hash_destroy(ctx);
+}
+
+
+/**
* Read keys and values from messages file.
*
* \param path pathname of messages file
@@ -66,7 +124,7 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx)
return hash_add_file(*ctx, path);
}
- nctx = hash_create(HASH_SIZE);
+ nctx = messages_create_ctx(HASH_SIZE);
if (nctx == NULL) {
NSLOG(netsurf, INFO,
"Unable to create hash table for messages file %s",
@@ -115,21 +173,6 @@ messages_get_ctx(const char *key, struct hash_table *ctx)
}
-/**
- * Free memory used by a messages hash.
- * The context will not be valid after this function returns.
- *
- * \param ctx context of messages file to free
- */
-static void messages_destroy_ctx(struct hash_table *ctx)
-{
- if (ctx == NULL)
- return;
-
- hash_destroy(ctx);
-}
-
-
/* exported interface documented in messages.h */
nserror messages_add_from_file(const char *path)
{
@@ -148,7 +191,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t size)
{
/* ensure the hash table is initialised */
if (messages_hash == NULL) {
- messages_hash = hash_create(HASH_SIZE);
+ messages_hash = messages_create_ctx(HASH_SIZE);
}
if (messages_hash == NULL) {
NSLOG(netsurf, INFO, "Unable to create hash table");
@@ -157,6 +200,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t size)
return hash_add_inline(messages_hash, data, size);
}
+
/* exported interface documented in messages.h */
char *messages_get_buff(const char *key, ...)
{
@@ -165,7 +209,17 @@ char *messages_get_buff(const char *key, ...)
int buff_len = 0;
va_list ap;
- msg_fmt = messages_get_ctx(key, messages_hash);
+ assert(key != NULL);
+
+ if (messages_hash == NULL) {
+ return NULL;
+ }
+
+ msg_fmt = hash_get(messages_hash, key);
+
+ if (msg_fmt == NULL) {
+ return NULL;
+ }
va_start(ap, key);
buff_len = vsnprintf(buff, buff_len, msg_fmt, ap);
diff --git a/utils/messages.h b/utils/messages.h
index 635d6e8..5da35e4 100644
--- a/utils/messages.h
+++ b/utils/messages.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Localised message support (interface).
*
* The messages module loads a file of keys and associated strings, and
@@ -30,8 +31,8 @@
* file table. Use the _ctx versions of the functions to do this.
*/
-#ifndef _NETSURF_UTILS_MESSAGES_H_
-#define _NETSURF_UTILS_MESSAGES_H_
+#ifndef NETSURF_UTILS_MESSAGES_H_
+#define NETSURF_UTILS_MESSAGES_H_
#include <stdint.h>
@@ -90,13 +91,12 @@ const char *messages_get_sslcode(ssl_cert_err code);
/**
* Formatted message from a key in the global message hash.
*
- * \param key key of message
+ * \param key key of message
* \param ... message parameters
- * \return buffer containing formatted message text or NULL if memory
- * is unavailable. The caller owns the returned buffer and is
- * responsible for freeing it.
+ * \return buffer containing formatted message text or NULL if key is
+ * unavailable or memory allocation failed. The caller owns the
+ * returned buffer and is responsible for freeing it.
*/
-
char *messages_get_buff(const char *key, ...);
/**
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=4b0c3f0efef2239dd5d...
commit 4b0c3f0efef2239dd5d62a9e73eeec4037c056a4
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add internal query handler for fetch errors
Any errors from the fetch which are not already handled are
reported with an internal query page instead of a modal
dialog.
This is much less invasive for the user and much more in
keeping with how this is handled by other browsers.
The handler is similar to the timeout handler but the
functionality is kept separate as it is intended timeout
handling be extended in future.
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index d8a5fa7..e98c6ec 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -95,6 +95,11 @@ static const char *privacy_description_fallback = "A privacy error occurred whil
static const char *timeout_description_fallback = "A connection to %s could not be established. The site may be temporarily unavailable or too busy to respond.";
/**
+ * fetcherror query description if messages fails to retrieve usable text
+ */
+static const char *fetcherror_description_fallback = "An error occoured when connecting to %s";
+
+/**
* issue fetch callbacks with locking
*/
static inline bool
@@ -1239,6 +1244,130 @@ fetch_about_query_timeout_handler_aborted:
}
+/**
+ * Handler to generate about scheme fetch error query page
+ *
+ * \param ctx The fetcher context.
+ * \return true if handled false if aborted.
+ */
+static bool
+fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx)
+{
+ nserror res;
+ char *url_s;
+ size_t url_l;
+ const char *reason = "";
+ const char *title;
+ struct nsurl *siteurl = NULL;
+ char *description = NULL;
+ const struct fetch_multipart_data *curmd; /* mutipart data iterator */
+
+ /* extract parameters from multipart post data */
+ curmd = ctx->multipart;
+ while (curmd != NULL) {
+ if (strcmp(curmd->name, "siteurl") == 0) {
+ res = nsurl_create(curmd->value, &siteurl);
+ if (res != NSERROR_OK) {
+ return fetch_about_srverror(ctx);
+ }
+ } else if (strcmp(curmd->name, "reason") == 0) {
+ reason = curmd->value;
+ }
+ curmd = curmd->next;
+ }
+
+ if (siteurl == NULL) {
+ return fetch_about_srverror(ctx);
+ }
+
+ /* content is going to return ok */
+ fetch_set_http_code(ctx->fetchh, 200);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ title = messages_get("FetchErrorTitle");
+ res = ssenddataf(ctx,
+ "<html>\n<head>\n"
+ "<title>%s</title>\n"
+ "<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"resource:internal.css\">\n"
+ "</head>\n"
+ "<body id =\"fetcherror\">\n"
+ "<h1>%s</h1>\n",
+ title, title);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<form method=\"post\""
+ " enctype=\"multipart/form-data\">");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = get_query_description(siteurl,
+ "FetchErrorDescription",
+ fetcherror_description_fallback,
+ &description);
+ if (res == NSERROR_OK) {
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
+ free(description);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+ }
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", reason);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<div id=\"buttons\">"
+ "<input type=\"submit\" id=\"back\" name=\"back\" "
+ "value=\"%s\" class=\"default-action\">"
+ "<input type=\"submit\" id=\"retry\" name=\"retry\" "
+ "value=\"%s\">"
+ "</div>",
+ messages_get("Backtoprevious"),
+ messages_get("TryAgain"));
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = nsurl_get(siteurl, NSURL_COMPLETE, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ url_s = strdup("");
+ }
+ res = ssenddataf(ctx,
+ "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
+ url_s);
+ free(url_s);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx, "</form></body>\n</html>\n");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ nsurl_unref(siteurl);
+
+ return true;
+
+fetch_about_query_fetcherror_handler_aborted:
+ nsurl_unref(siteurl);
+
+ return false;
+}
+
+
/* Forward declaration because this handler requires the handler table. */
static bool fetch_about_about_handler(struct fetch_about_context *ctx);
@@ -1352,6 +1481,13 @@ struct about_handlers about_handler_list[] = {
NULL,
fetch_about_query_timeout_handler,
true
+ },
+ {
+ "query/fetcherror",
+ SLEN("query/fetcherror"),
+ NULL,
+ fetch_about_query_fetcherror_handler,
+ true
}
};
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index 5f7c2cc..807393e 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1217,6 +1217,50 @@ browser_window__handle_timeout(struct browser_window *bw, nsurl *url)
/**
+ * Handle non specific errors during a fetch
+ */
+static nserror
+browser_window__handle_fetcherror(struct browser_window *bw,
+ const char *reason,
+ nsurl *url)
+{
+ struct browser_fetch_parameters params;
+ nserror err;
+
+ memset(¶ms, 0, sizeof(params));
+
+ params.url = nsurl_ref(corestring_nsurl_about_query_fetcherror);
+ params.referrer = nsurl_ref(url);
+ params.flags = BW_NAVIGATE_HISTORY | BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE | BW_NAVIGATE_INTERNAL;
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "siteurl",
+ nsurl_access(url));
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "reason",
+ reason);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ /* Now we issue the fetch */
+ bw->internal_nav = true;
+ err = browser_window__navigate_internal(bw, ¶ms);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ out:
+ browser_window__free_fetch_parameters(¶ms);
+ return err;
+}
+
+
+/**
* Handle errors during content fetch
*/
static nserror
@@ -1226,39 +1270,14 @@ browser_window__handle_error(struct browser_window *bw,
{
const char *message = event->data.errordata.errormsg;
nserror code = event->data.errordata.errorcode;
- bool do_warning = true;
nserror res;
nsurl *url = hlcache_handle_get_url(c);
/* Unexpected OK? */
assert(code != NSERROR_OK);
- switch (code) {
- case NSERROR_BAD_AUTH:
- do_warning = false;
- break;
- case NSERROR_BAD_CERTS:
- do_warning = false;
- break;
- case NSERROR_BAD_REDIRECT:
- /* The message is already filled out */
- break;
- case NSERROR_TIMEOUT:
- do_warning = false;
- break;
- default:
- if (message == NULL) {
- message = messages_get_errorcode(code);
- }
- break;
- }
-
- if (do_warning) {
- browser_window_set_status(bw, message);
- /* Only warn the user about errors in top-level windows */
- if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) {
- guit->misc->warning(message, NULL);
- }
+ if (message == NULL) {
+ message = messages_get_errorcode(code);
}
if (c == bw->loading_content) {
@@ -1274,13 +1293,17 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_AUTH:
res = browser_window__handle_login(bw, message, url);
break;
+
case NSERROR_BAD_CERTS:
res = browser_window__handle_bad_certs(bw, url);
break;
+
case NSERROR_TIMEOUT:
res = browser_window__handle_timeout(bw, url);
break;
+
default:
+ res = browser_window__handle_fetcherror(bw, message, url);
break;
}
@@ -2411,6 +2434,8 @@ is_internal_navigate_url(nsurl *url)
is_internal = true;
} else if (path == corestring_lwc_query_timeout) {
is_internal = true;
+ } else if (path == corestring_lwc_query_fetcherror) {
+ is_internal = true;
}
}
lwc_string_unref(path);
@@ -3614,6 +3639,42 @@ navigate_internal_query_timeout(struct browser_window *bw,
/**
+ * Internal navigation handler for the fetch error query page.
+ *
+ * If the parameters indicate we're processing a *response* from the handler
+ * then we deal with that, otherwise we pass it on to the about: handler
+ */
+static nserror
+navigate_internal_query_fetcherror(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
+{
+ bool is_retry = false, is_back = false;
+
+ NSLOG(netsurf, INFO, "bw:%p params:%p", bw, params);
+
+ assert(params->post_multipart != NULL);
+
+ is_retry = fetch_multipart_data_find(params->post_multipart, "retry") != NULL;
+ is_back = fetch_multipart_data_find(params->post_multipart, "back") != NULL;
+
+ if (is_back) {
+ /* do a rough-and-ready nav to the old 'current'
+ * parameters, with any post data stripped away
+ */
+ return browser_window__reload_current_parameters(bw);
+ }
+
+ if (is_retry) {
+ /* Finally navigate to the original loading parameters */
+ bw->internal_nav = false;
+ return navigate_internal_real(bw, &bw->loading_parameters);
+ }
+
+ return navigate_internal_real(bw, params);
+}
+
+
+/**
* dispatch to internal query handlers or normal navigation
*
* Here we determine if we're navigating to an internal query URI and
@@ -3651,6 +3712,10 @@ browser_window__navigate_internal(struct browser_window *bw,
lwc_string_unref(path);
return navigate_internal_query_timeout(bw, params);
}
+ if (path == corestring_lwc_query_fetcherror) {
+ lwc_string_unref(path);
+ return navigate_internal_query_fetcherror(bw, params);
+ }
lwc_string_unref(path);
/* Fall through to a normal about: fetch */
diff --git a/resources/FatMessages b/resources/FatMessages
index aa2d7a2..06d61c9 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -1096,6 +1096,13 @@ en.all.Backtoprevious: Back
en.all.TryAgain: Try Again
+# Fetch error interface
+# =======================
+#
+en.all.FetchErrorTitle:Error occured fetching page
+en.all.FetchErrorDescription:An error occoured when connecting to %s
+
+
# SSL certificate viewer
# ======================
#
diff --git a/resources/internal.css b/resources/internal.css
index 14b47cf..ded56ee 100644
--- a/resources/internal.css
+++ b/resources/internal.css
@@ -381,3 +381,41 @@ body#timeout div#buttons {
body#timeout div#buttons input#back {
margin-right: 1em;
}
+
+/*
+ * fetch error query styling
+ */
+
+body#fetcherror {
+ max-width: 45em;
+}
+
+body#fetcherror h1 {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ border-bottom: 0.1em solid #444;
+ margin: 0 0 1.3em 0;
+ background: #c55;
+ color: white;
+}
+
+body#fetcherror form {
+ /* Just to center the form on the page */
+ margin: 0 auto;
+ /* To see the outline of the form */
+ padding: 1em;
+ border: 1px solid #CCC;
+ border-radius: 1em;
+}
+
+body#fetcherror form div + div {
+ margin-top: 1em;
+}
+
+body#fetcherror div#buttons {
+ text-align: right;
+ margin-right: 1em;
+}
+
+body#fetcherror div#buttons input#back {
+ margin-right: 1em;
+}
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index e7516b1..b109545 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -149,6 +149,7 @@ CORESTRING_LWC_VALUE(no_store, "no-store");
CORESTRING_LWC_VALUE(query_auth, "query/auth");
CORESTRING_LWC_VALUE(query_ssl, "query/ssl");
CORESTRING_LWC_VALUE(query_timeout, "query/timeout");
+CORESTRING_LWC_VALUE(query_fetcherror, "query/fetcherror");
/* mime types */
CORESTRING_LWC_VALUE(multipart_form_data, "multipart/form-data");
@@ -362,6 +363,7 @@ CORESTRING_NSURL(about_blank, "about:blank");
CORESTRING_NSURL(about_query_ssl, "about:query/ssl");
CORESTRING_NSURL(about_query_auth, "about:query/auth");
CORESTRING_NSURL(about_query_timeout, "about:query/timeout");
+CORESTRING_NSURL(about_query_fetcherror, "about:query/fetcherror");
#undef CORESTRING_LWC_STRING
#undef CORESTRING_DOM_STRING
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=76eac192272acf77763...
commit 76eac192272acf77763d0c619cd78118650748cf
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
add internal query page for request timeouts
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index df51410..d8a5fa7 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -90,6 +90,11 @@ static const char *authentication_description_fallback = "The site %s is request
static const char *privacy_description_fallback = "A privacy error occurred while communicating with %s this may be a site configuration error or an attempt to steal private information (passwords, messages or credit cards)";
/**
+ * timeout query description if messages fails to retrieve usable text
+ */
+static const char *timeout_description_fallback = "A connection to %s could not be established. The site may be temporarily unavailable or too busy to respond.";
+
+/**
* issue fetch callbacks with locking
*/
static inline bool
@@ -939,15 +944,18 @@ fetch_about_query_auth_handler_aborted:
/**
- * generate the description of the privacy query
+ * generate a query description
*/
-static nserror get_privacy_description(struct nsurl *url, char **out_str)
+static nserror
+get_query_description(struct nsurl *url,
+ const char *key,
+ const char *fallback,
+ char **out_str)
{
nserror res;
char *url_s;
size_t url_l;
char *str = NULL;
- const char *key = "PrivacyDescription";
/* get the host in question */
res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
@@ -967,10 +975,10 @@ static nserror get_privacy_description(struct nsurl *url, char **out_str)
* fall back to basic english.
*/
int slen;
- slen = snprintf(str, 0, privacy_description_fallback, url_s) + 1;
+ slen = snprintf(str, 0, fallback, url_s) + 1;
str = malloc(slen);
if (str != NULL) {
- snprintf(str, slen, privacy_description_fallback, url_s);
+ snprintf(str, slen, fallback, url_s);
}
}
@@ -1049,7 +1057,10 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
goto fetch_about_query_ssl_handler_aborted;
}
- res = get_privacy_description(siteurl, &description);
+ res = get_query_description(siteurl,
+ "PrivacyDescription",
+ privacy_description_fallback,
+ &description);
if (res == NSERROR_OK) {
res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
free(description);
@@ -1105,6 +1116,129 @@ fetch_about_query_ssl_handler_aborted:
}
+/**
+ * Handler to generate about scheme timeout query page
+ *
+ * \param ctx The fetcher context.
+ * \return true if handled false if aborted.
+ */
+static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx)
+{
+ nserror res;
+ char *url_s;
+ size_t url_l;
+ const char *reason = "";
+ const char *title;
+ struct nsurl *siteurl = NULL;
+ char *description = NULL;
+ const struct fetch_multipart_data *curmd; /* mutipart data iterator */
+
+ /* extract parameters from multipart post data */
+ curmd = ctx->multipart;
+ while (curmd != NULL) {
+ if (strcmp(curmd->name, "siteurl") == 0) {
+ res = nsurl_create(curmd->value, &siteurl);
+ if (res != NSERROR_OK) {
+ return fetch_about_srverror(ctx);
+ }
+ } else if (strcmp(curmd->name, "reason") == 0) {
+ reason = curmd->value;
+ }
+ curmd = curmd->next;
+ }
+
+ if (siteurl == NULL) {
+ return fetch_about_srverror(ctx);
+ }
+
+ /* content is going to return ok */
+ fetch_set_http_code(ctx->fetchh, 200);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ title = messages_get("TimeoutTitle");
+ res = ssenddataf(ctx,
+ "<html>\n<head>\n"
+ "<title>%s</title>\n"
+ "<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"resource:internal.css\">\n"
+ "</head>\n"
+ "<body id =\"timeout\">\n"
+ "<h1>%s</h1>\n",
+ title, title);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<form method=\"post\""
+ " enctype=\"multipart/form-data\">");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ res = get_query_description(siteurl,
+ "TimeoutDescription",
+ timeout_description_fallback,
+ &description);
+ if (res == NSERROR_OK) {
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
+ free(description);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+ }
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", reason);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<div id=\"buttons\">"
+ "<input type=\"submit\" id=\"back\" name=\"back\" "
+ "value=\"%s\" class=\"default-action\">"
+ "<input type=\"submit\" id=\"retry\" name=\"retry\" "
+ "value=\"%s\">"
+ "</div>",
+ messages_get("Backtoprevious"),
+ messages_get("TryAgain"));
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ res = nsurl_get(siteurl, NSURL_COMPLETE, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ url_s = strdup("");
+ }
+ res = ssenddataf(ctx,
+ "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
+ url_s);
+ free(url_s);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ res = ssenddataf(ctx, "</form></body>\n</html>\n");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_timeout_handler_aborted;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ nsurl_unref(siteurl);
+
+ return true;
+
+fetch_about_query_timeout_handler_aborted:
+ nsurl_unref(siteurl);
+
+ return false;
+}
+
+
/* Forward declaration because this handler requires the handler table. */
static bool fetch_about_about_handler(struct fetch_about_context *ctx);
@@ -1211,6 +1345,13 @@ struct about_handlers about_handler_list[] = {
NULL,
fetch_about_query_privacy_handler,
true
+ },
+ {
+ "query/timeout",
+ SLEN("query/timeout"),
+ NULL,
+ fetch_about_query_timeout_handler,
+ true
}
};
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index a6b77b0..5f7c2cc 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1182,6 +1182,41 @@ browser_window__handle_bad_certs(struct browser_window *bw,
/**
+ * Handle a timeout during a fetch
+ */
+static nserror
+browser_window__handle_timeout(struct browser_window *bw, nsurl *url)
+{
+ struct browser_fetch_parameters params;
+ nserror err;
+
+ memset(¶ms, 0, sizeof(params));
+
+ params.url = nsurl_ref(corestring_nsurl_about_query_timeout);
+ params.referrer = nsurl_ref(url);
+ params.flags = BW_NAVIGATE_HISTORY | BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE | BW_NAVIGATE_INTERNAL;
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "siteurl",
+ nsurl_access(url));
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ /* Now we issue the fetch */
+ bw->internal_nav = true;
+ err = browser_window__navigate_internal(bw, ¶ms);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ out:
+ browser_window__free_fetch_parameters(¶ms);
+ return err;
+}
+
+
+/**
* Handle errors during content fetch
*/
static nserror
@@ -1208,6 +1243,9 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_REDIRECT:
/* The message is already filled out */
break;
+ case NSERROR_TIMEOUT:
+ do_warning = false;
+ break;
default:
if (message == NULL) {
message = messages_get_errorcode(code);
@@ -1239,6 +1277,9 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_CERTS:
res = browser_window__handle_bad_certs(bw, url);
break;
+ case NSERROR_TIMEOUT:
+ res = browser_window__handle_timeout(bw, url);
+ break;
default:
break;
}
@@ -2368,6 +2409,8 @@ is_internal_navigate_url(nsurl *url)
is_internal = true;
} else if (path == corestring_lwc_query_ssl) {
is_internal = true;
+ } else if (path == corestring_lwc_query_timeout) {
+ is_internal = true;
}
}
lwc_string_unref(path);
@@ -3338,12 +3381,16 @@ browser_window_navigate(struct browser_window *bw,
return error;
}
+
+/**
+ * Internal navigation handler for normal fetches
+ */
static nserror
-browser_window__navigate_internal_real(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_real(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
uint32_t fetch_flags = 0;
- bool fetch_is_post = (params->post_urlenc != NULL || params->post_multipart != NULL);
+ bool fetch_is_post;
llcache_post_data post;
hlcache_child_context child;
nserror res;
@@ -3351,6 +3398,8 @@ browser_window__navigate_internal_real(struct browser_window *bw,
NSLOG(netsurf, INFO, "Loading '%s'", nsurl_access(params->url));
+ fetch_is_post = (params->post_urlenc != NULL || params->post_multipart != NULL);
+
/* Clear SSL info for load */
bw->loading_ssl_info.num = 0;
@@ -3424,6 +3473,7 @@ browser_window__navigate_internal_real(struct browser_window *bw,
return res;
}
+
/**
* Internal navigation handler for the authentication query handler
*
@@ -3431,8 +3481,8 @@ browser_window__navigate_internal_real(struct browser_window *bw,
* then we deal with that, otherwise we pass it on to the about: handler
*/
static nserror
-browser_window__navigate_internal_query_auth(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_query_auth(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
char *userpass = NULL;
const char *username, *password, *realm, *siteurl;
@@ -3447,7 +3497,7 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
if (!(is_login || is_cancel)) {
/* This is a request, so pass it on */
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
if (is_cancel) {
@@ -3497,7 +3547,7 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
/* Finally navigate to the original loading parameters */
bw->internal_nav = false;
- return browser_window__navigate_internal_real(bw, &bw->loading_parameters);
+ return navigate_internal_real(bw, &bw->loading_parameters);
}
@@ -3508,8 +3558,8 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
* then we deal with that, otherwise we pass it on to the about: handler
*/
static nserror
-browser_window__navigate_internal_query_ssl(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_query_ssl(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
bool is_proceed = false, is_back = false;
@@ -3520,23 +3570,64 @@ browser_window__navigate_internal_query_ssl(struct browser_window *bw,
if (!(is_proceed || is_back)) {
/* This is a request, so pass it on */
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
return browser_window__handle_ssl_query_response(is_proceed, bw);
}
+/**
+ * Internal navigation handler for the timeout query page.
+ *
+ * If the parameters indicate we're processing a *response* from the handler
+ * then we deal with that, otherwise we pass it on to the about: handler
+ */
+static nserror
+navigate_internal_query_timeout(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
+{
+ bool is_retry = false, is_back = false;
+
+ NSLOG(netsurf, INFO, "bw:%p params:%p", bw, params);
+
+ assert(params->post_multipart != NULL);
+
+ is_retry = fetch_multipart_data_find(params->post_multipart, "retry") != NULL;
+ is_back = fetch_multipart_data_find(params->post_multipart, "back") != NULL;
+
+ if (is_back) {
+ /* do a rough-and-ready nav to the old 'current'
+ * parameters, with any post data stripped away
+ */
+ return browser_window__reload_current_parameters(bw);
+ }
+
+ if (is_retry) {
+ /* Finally navigate to the original loading parameters */
+ bw->internal_nav = false;
+ return navigate_internal_real(bw, &bw->loading_parameters);
+ }
+
+ return navigate_internal_real(bw, params);
+}
+
+
+/**
+ * dispatch to internal query handlers or normal navigation
+ *
+ * Here we determine if we're navigating to an internal query URI and
+ * if so, what we need to do about it.
+ *
+ * \note these check must match those in is_internal_navigate_url()
+ *
+ * If we're not, then we just move on to the real navigate.
+ */
nserror
browser_window__navigate_internal(struct browser_window *bw,
struct browser_fetch_parameters *params)
{
lwc_string *scheme, *path;
- /* Here we determine if we're navigating to an internal query URI
- * and if so, what we need to do about it.
- *
- * If we're not, then we just move on to the real navigate.
- */
/* All our special URIs are in the about: scheme */
scheme = nsurl_get_component(params->url, NSURL_SCHEME);
@@ -3550,18 +3641,22 @@ browser_window__navigate_internal(struct browser_window *bw,
path = nsurl_get_component(params->url, NSURL_PATH);
if (path == corestring_lwc_query_auth) {
lwc_string_unref(path);
- return browser_window__navigate_internal_query_auth(bw, params);
+ return navigate_internal_query_auth(bw, params);
}
if (path == corestring_lwc_query_ssl) {
lwc_string_unref(path);
- return browser_window__navigate_internal_query_ssl(bw, params);
+ return navigate_internal_query_ssl(bw, params);
+ }
+ if (path == corestring_lwc_query_timeout) {
+ lwc_string_unref(path);
+ return navigate_internal_query_timeout(bw, params);
}
lwc_string_unref(path);
/* Fall through to a normal about: fetch */
normal_fetch:
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
diff --git a/resources/FatMessages b/resources/FatMessages
index d1ecd9d..aa2d7a2 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -1087,6 +1087,15 @@ en.all.SSLCertErrRevoked:The certificate has been revoked by the issuer.
en.all.SSLCertErrHostnameMismatch:The certificate is for a different host than the server
+# Timeout error interface
+# =======================
+#
+en.all.TimeoutTitle:Connection timed out
+en.all.TimeoutDescription: A connection to %s could not be established. The site may be temporarily unavailable or too busy to respond.
+en.all.Backtoprevious: Back
+en.all.TryAgain: Try Again
+
+
# SSL certificate viewer
# ======================
#
diff --git a/resources/internal.css b/resources/internal.css
index e43d183..14b47cf 100644
--- a/resources/internal.css
+++ b/resources/internal.css
@@ -343,3 +343,41 @@ body#privacy div#buttons {
body#privacy div#buttons input#back {
margin-right: 1em;
}
+
+/*
+ * timeout query styling
+ */
+
+body#timeout {
+ max-width: 45em;
+}
+
+body#timeout h1 {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ border-bottom: 0.1em solid #444;
+ margin: 0 0 1.3em 0;
+ background: #c55;
+ color: white;
+}
+
+body#timeout form {
+ /* Just to center the form on the page */
+ margin: 0 auto;
+ /* To see the outline of the form */
+ padding: 1em;
+ border: 1px solid #CCC;
+ border-radius: 1em;
+}
+
+body#timeout form div + div {
+ margin-top: 1em;
+}
+
+body#timeout div#buttons {
+ text-align: right;
+ margin-right: 1em;
+}
+
+body#timeout div#buttons input#back {
+ margin-right: 1em;
+}
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index f0d39c6..e7516b1 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -148,6 +148,7 @@ CORESTRING_LWC_VALUE(no_cache, "no-cache");
CORESTRING_LWC_VALUE(no_store, "no-store");
CORESTRING_LWC_VALUE(query_auth, "query/auth");
CORESTRING_LWC_VALUE(query_ssl, "query/ssl");
+CORESTRING_LWC_VALUE(query_timeout, "query/timeout");
/* mime types */
CORESTRING_LWC_VALUE(multipart_form_data, "multipart/form-data");
@@ -360,6 +361,7 @@ CORESTRING_DOM_VALUE(html_namespace, "http://www.w3.org/1999/xhtml");
CORESTRING_NSURL(about_blank, "about:blank");
CORESTRING_NSURL(about_query_ssl, "about:query/ssl");
CORESTRING_NSURL(about_query_auth, "about:query/auth");
+CORESTRING_NSURL(about_query_timeout, "about:query/timeout");
#undef CORESTRING_LWC_STRING
#undef CORESTRING_DOM_STRING
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 365 +++++++++++++++++++++++++++++++++++++---------
desktop/browser_window.c | 244 +++++++++++++++++++++++++------
resources/FatMessages | 18 ++-
resources/internal.css | 76 ++++++++++
test/messages.c | 3 +-
utils/corestringlist.h | 4 +
utils/hashtable.c | 6 +-
utils/messages.c | 92 +++++++++---
utils/messages.h | 16 +-
9 files changed, 681 insertions(+), 143 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index df51410..02bac81 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -79,15 +79,6 @@ struct about_handlers {
bool hidden; /**< If entry should be hidden in listing */
};
-/**
- * authentication query description if messages fails to retrieve usable text
- */
-static const char *authentication_description_fallback = "The site %s is requesting your username and password. The realm is \"%s\"";
-
-/**
- * privacy query description if messages fails to retrieve usable text
- */
-static const char *privacy_description_fallback = "A privacy error occurred while communicating with %s this may be a site configuration error or an attempt to steal private information (passwords, messages or credit cards)";
/**
* issue fetch callbacks with locking
@@ -730,7 +721,6 @@ get_authentication_description(struct nsurl *url,
char *url_s;
size_t url_l;
char *str = NULL;
- int slen;
const char *key;
res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
@@ -745,23 +735,46 @@ get_authentication_description(struct nsurl *url,
}
str = messages_get_buff(key, url_s, realm);
- NSLOG(netsurf, INFO,
- "key:%s url:%s realm:%s str:%s", key, url_s, realm, str);
-
- if ((str != NULL) && (strcmp(key, str) != 0)) {
+ if (str != NULL) {
+ NSLOG(netsurf, INFO,
+ "key:%s url:%s realm:%s str:%s",
+ key, url_s, realm, str);
*out_str = str;
} else {
- /* no message so fallback */
- slen = snprintf(str, 0, authentication_description_fallback,
- url_s, realm) + 1;
- str = malloc(slen);
- if (str == NULL) {
- res = NSERROR_NOMEM;
- } else {
- snprintf(str, slen, authentication_description_fallback,
- url_s, realm);
- *out_str = str;
- }
+ res = NSERROR_NOMEM;
+ }
+
+ free(url_s);
+
+ return res;
+}
+
+
+/**
+ * generate a generic query description
+ */
+static nserror
+get_query_description(struct nsurl *url,
+ const char *key,
+ char **out_str)
+{
+ nserror res;
+ char *url_s;
+ size_t url_l;
+ char *str = NULL;
+
+ /* get the host in question */
+ res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ return res;
+ }
+
+ /* obtain the description with the url substituted */
+ str = messages_get_buff(key, url_s);
+ if (str == NULL) {
+ res = NSERROR_NOMEM;
+ } else {
+ *out_str = str;
}
free(url_s);
@@ -939,59 +952,134 @@ fetch_about_query_auth_handler_aborted:
/**
- * generate the description of the privacy query
+ * Handler to generate about scheme privacy query page
+ *
+ * \param ctx The fetcher context.
+ * \return true if handled false if aborted.
*/
-static nserror get_privacy_description(struct nsurl *url, char **out_str)
+static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
{
nserror res;
char *url_s;
size_t url_l;
- char *str = NULL;
- const char *key = "PrivacyDescription";
+ const char *reason = "";
+ const char *title;
+ struct nsurl *siteurl = NULL;
+ char *description = NULL;
+ const struct fetch_multipart_data *curmd; /* mutipart data iterator */
- /* get the host in question */
- res = nsurl_get(url, NSURL_HOST, &url_s, &url_l);
+ /* extract parameters from multipart post data */
+ curmd = ctx->multipart;
+ while (curmd != NULL) {
+ if (strcmp(curmd->name, "siteurl") == 0) {
+ res = nsurl_create(curmd->value, &siteurl);
+ if (res != NSERROR_OK) {
+ return fetch_about_srverror(ctx);
+ }
+ } else if (strcmp(curmd->name, "reason") == 0) {
+ reason = curmd->value;
+ }
+ curmd = curmd->next;
+ }
+
+ if (siteurl == NULL) {
+ return fetch_about_srverror(ctx);
+ }
+
+ /* content is going to return ok */
+ fetch_set_http_code(ctx->fetchh, 200);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) {
+ goto fetch_about_query_ssl_handler_aborted;
+ }
+
+ title = messages_get("PrivacyTitle");
+ res = ssenddataf(ctx,
+ "<html>\n<head>\n"
+ "<title>%s</title>\n"
+ "<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"resource:internal.css\">\n"
+ "</head>\n"
+ "<body id =\"privacy\">\n"
+ "<h1>%s</h1>\n",
+ title, title);
if (res != NSERROR_OK) {
- return res;
+ goto fetch_about_query_ssl_handler_aborted;
}
- /* obtain the description with the url substituted */
- str = messages_get_buff(key, url_s);
- if ((str != NULL) && (strcmp(key, str) == 0)) {
- /* the returned string was simply the key */
- free(str);
- str = NULL;
+ res = ssenddataf(ctx,
+ "<form method=\"post\""
+ " enctype=\"multipart/form-data\">");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
}
- if (str == NULL) {
- /* failed to get suitable translated message text so
- * fall back to basic english.
- */
- int slen;
- slen = snprintf(str, 0, privacy_description_fallback, url_s) + 1;
- str = malloc(slen);
- if (str != NULL) {
- snprintf(str, slen, privacy_description_fallback, url_s);
+
+ res = get_query_description(siteurl,
+ "PrivacyDescription",
+ &description);
+ if (res == NSERROR_OK) {
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
+ free(description);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
}
}
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", reason);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
+ }
- if (str == NULL) {
- res = NSERROR_NOMEM;
- } else {
- *out_str = str;
+ res = ssenddataf(ctx,
+ "<div id=\"buttons\">"
+ "<input type=\"submit\" id=\"back\" name=\"back\" "
+ "value=\"%s\" class=\"default-action\">"
+ "<input type=\"submit\" id=\"proceed\" name=\"proceed\" "
+ "value=\"%s\">"
+ "</div>",
+ messages_get("Backtosafety"),
+ messages_get("Proceed"));
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
}
+
+ res = nsurl_get(siteurl, NSURL_COMPLETE, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ url_s = strdup("");
+ }
+ res = ssenddataf(ctx,
+ "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
+ url_s);
free(url_s);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
+ }
- return res;
+ res = ssenddataf(ctx, "</form></body>\n</html>\n");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_ssl_handler_aborted;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ nsurl_unref(siteurl);
+
+ return true;
+
+fetch_about_query_ssl_handler_aborted:
+ nsurl_unref(siteurl);
+
+ return false;
}
/**
- * Handler to generate about scheme privacy query page
+ * Handler to generate about scheme timeout query page
*
* \param ctx The fetcher context.
* \return true if handled false if aborted.
*/
-static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
+static bool fetch_about_query_timeout_handler(struct fetch_about_context *ctx)
{
nserror res;
char *url_s;
@@ -1025,54 +1113,56 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
/* content type */
if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
- title = messages_get("PrivacyTitle");
+ title = messages_get("TimeoutTitle");
res = ssenddataf(ctx,
"<html>\n<head>\n"
"<title>%s</title>\n"
"<link rel=\"stylesheet\" type=\"text/css\" "
"href=\"resource:internal.css\">\n"
"</head>\n"
- "<body id =\"privacy\">\n"
+ "<body id =\"timeout\">\n"
"<h1>%s</h1>\n",
title, title);
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
res = ssenddataf(ctx,
"<form method=\"post\""
" enctype=\"multipart/form-data\">");
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
- res = get_privacy_description(siteurl, &description);
+ res = get_query_description(siteurl,
+ "TimeoutDescription",
+ &description);
if (res == NSERROR_OK) {
res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
free(description);
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
}
res = ssenddataf(ctx, "<div><p>%s</p></div>", reason);
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
res = ssenddataf(ctx,
"<div id=\"buttons\">"
"<input type=\"submit\" id=\"back\" name=\"back\" "
"value=\"%s\" class=\"default-action\">"
- "<input type=\"submit\" id=\"proceed\" name=\"proceed\" "
+ "<input type=\"submit\" id=\"retry\" name=\"retry\" "
"value=\"%s\">"
"</div>",
- messages_get("Backtosafety"),
- messages_get("Proceed"));
+ messages_get("Backtoprevious"),
+ messages_get("TryAgain"));
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
res = nsurl_get(siteurl, NSURL_COMPLETE, &url_s, &url_l);
@@ -1084,12 +1174,12 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
url_s);
free(url_s);
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
res = ssenddataf(ctx, "</form></body>\n</html>\n");
if (res != NSERROR_OK) {
- goto fetch_about_query_ssl_handler_aborted;
+ goto fetch_about_query_timeout_handler_aborted;
}
fetch_about_send_finished(ctx);
@@ -1098,7 +1188,130 @@ static bool fetch_about_query_privacy_handler(struct fetch_about_context *ctx)
return true;
-fetch_about_query_ssl_handler_aborted:
+fetch_about_query_timeout_handler_aborted:
+ nsurl_unref(siteurl);
+
+ return false;
+}
+
+
+/**
+ * Handler to generate about scheme fetch error query page
+ *
+ * \param ctx The fetcher context.
+ * \return true if handled false if aborted.
+ */
+static bool
+fetch_about_query_fetcherror_handler(struct fetch_about_context *ctx)
+{
+ nserror res;
+ char *url_s;
+ size_t url_l;
+ const char *reason = "";
+ const char *title;
+ struct nsurl *siteurl = NULL;
+ char *description = NULL;
+ const struct fetch_multipart_data *curmd; /* mutipart data iterator */
+
+ /* extract parameters from multipart post data */
+ curmd = ctx->multipart;
+ while (curmd != NULL) {
+ if (strcmp(curmd->name, "siteurl") == 0) {
+ res = nsurl_create(curmd->value, &siteurl);
+ if (res != NSERROR_OK) {
+ return fetch_about_srverror(ctx);
+ }
+ } else if (strcmp(curmd->name, "reason") == 0) {
+ reason = curmd->value;
+ }
+ curmd = curmd->next;
+ }
+
+ if (siteurl == NULL) {
+ return fetch_about_srverror(ctx);
+ }
+
+ /* content is going to return ok */
+ fetch_set_http_code(ctx->fetchh, 200);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ title = messages_get("FetchErrorTitle");
+ res = ssenddataf(ctx,
+ "<html>\n<head>\n"
+ "<title>%s</title>\n"
+ "<link rel=\"stylesheet\" type=\"text/css\" "
+ "href=\"resource:internal.css\">\n"
+ "</head>\n"
+ "<body id =\"fetcherror\">\n"
+ "<h1>%s</h1>\n",
+ title, title);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<form method=\"post\""
+ " enctype=\"multipart/form-data\">");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = get_query_description(siteurl,
+ "FetchErrorDescription",
+ &description);
+ if (res == NSERROR_OK) {
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", description);
+ free(description);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+ }
+ res = ssenddataf(ctx, "<div><p>%s</p></div>", reason);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx,
+ "<div id=\"buttons\">"
+ "<input type=\"submit\" id=\"back\" name=\"back\" "
+ "value=\"%s\" class=\"default-action\">"
+ "<input type=\"submit\" id=\"retry\" name=\"retry\" "
+ "value=\"%s\">"
+ "</div>",
+ messages_get("Backtoprevious"),
+ messages_get("TryAgain"));
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = nsurl_get(siteurl, NSURL_COMPLETE, &url_s, &url_l);
+ if (res != NSERROR_OK) {
+ url_s = strdup("");
+ }
+ res = ssenddataf(ctx,
+ "<input type=\"hidden\" name=\"siteurl\" value=\"%s\">",
+ url_s);
+ free(url_s);
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ res = ssenddataf(ctx, "</form></body>\n</html>\n");
+ if (res != NSERROR_OK) {
+ goto fetch_about_query_fetcherror_handler_aborted;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ nsurl_unref(siteurl);
+
+ return true;
+
+fetch_about_query_fetcherror_handler_aborted:
nsurl_unref(siteurl);
return false;
@@ -1211,6 +1424,20 @@ struct about_handlers about_handler_list[] = {
NULL,
fetch_about_query_privacy_handler,
true
+ },
+ {
+ "query/timeout",
+ SLEN("query/timeout"),
+ NULL,
+ fetch_about_query_timeout_handler,
+ true
+ },
+ {
+ "query/fetcherror",
+ SLEN("query/fetcherror"),
+ NULL,
+ fetch_about_query_fetcherror_handler,
+ true
}
};
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index a6b77b0..807393e 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1182,6 +1182,85 @@ browser_window__handle_bad_certs(struct browser_window *bw,
/**
+ * Handle a timeout during a fetch
+ */
+static nserror
+browser_window__handle_timeout(struct browser_window *bw, nsurl *url)
+{
+ struct browser_fetch_parameters params;
+ nserror err;
+
+ memset(¶ms, 0, sizeof(params));
+
+ params.url = nsurl_ref(corestring_nsurl_about_query_timeout);
+ params.referrer = nsurl_ref(url);
+ params.flags = BW_NAVIGATE_HISTORY | BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE | BW_NAVIGATE_INTERNAL;
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "siteurl",
+ nsurl_access(url));
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ /* Now we issue the fetch */
+ bw->internal_nav = true;
+ err = browser_window__navigate_internal(bw, ¶ms);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ out:
+ browser_window__free_fetch_parameters(¶ms);
+ return err;
+}
+
+
+/**
+ * Handle non specific errors during a fetch
+ */
+static nserror
+browser_window__handle_fetcherror(struct browser_window *bw,
+ const char *reason,
+ nsurl *url)
+{
+ struct browser_fetch_parameters params;
+ nserror err;
+
+ memset(¶ms, 0, sizeof(params));
+
+ params.url = nsurl_ref(corestring_nsurl_about_query_fetcherror);
+ params.referrer = nsurl_ref(url);
+ params.flags = BW_NAVIGATE_HISTORY | BW_NAVIGATE_NO_TERMINAL_HISTORY_UPDATE | BW_NAVIGATE_INTERNAL;
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "siteurl",
+ nsurl_access(url));
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ err = fetch_multipart_data_new_kv(¶ms.post_multipart,
+ "reason",
+ reason);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ /* Now we issue the fetch */
+ bw->internal_nav = true;
+ err = browser_window__navigate_internal(bw, ¶ms);
+ if (err != NSERROR_OK) {
+ goto out;
+ }
+
+ out:
+ browser_window__free_fetch_parameters(¶ms);
+ return err;
+}
+
+
+/**
* Handle errors during content fetch
*/
static nserror
@@ -1191,36 +1270,14 @@ browser_window__handle_error(struct browser_window *bw,
{
const char *message = event->data.errordata.errormsg;
nserror code = event->data.errordata.errorcode;
- bool do_warning = true;
nserror res;
nsurl *url = hlcache_handle_get_url(c);
/* Unexpected OK? */
assert(code != NSERROR_OK);
- switch (code) {
- case NSERROR_BAD_AUTH:
- do_warning = false;
- break;
- case NSERROR_BAD_CERTS:
- do_warning = false;
- break;
- case NSERROR_BAD_REDIRECT:
- /* The message is already filled out */
- break;
- default:
- if (message == NULL) {
- message = messages_get_errorcode(code);
- }
- break;
- }
-
- if (do_warning) {
- browser_window_set_status(bw, message);
- /* Only warn the user about errors in top-level windows */
- if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) {
- guit->misc->warning(message, NULL);
- }
+ if (message == NULL) {
+ message = messages_get_errorcode(code);
}
if (c == bw->loading_content) {
@@ -1236,10 +1293,17 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_AUTH:
res = browser_window__handle_login(bw, message, url);
break;
+
case NSERROR_BAD_CERTS:
res = browser_window__handle_bad_certs(bw, url);
break;
+
+ case NSERROR_TIMEOUT:
+ res = browser_window__handle_timeout(bw, url);
+ break;
+
default:
+ res = browser_window__handle_fetcherror(bw, message, url);
break;
}
@@ -2368,6 +2432,10 @@ is_internal_navigate_url(nsurl *url)
is_internal = true;
} else if (path == corestring_lwc_query_ssl) {
is_internal = true;
+ } else if (path == corestring_lwc_query_timeout) {
+ is_internal = true;
+ } else if (path == corestring_lwc_query_fetcherror) {
+ is_internal = true;
}
}
lwc_string_unref(path);
@@ -3338,12 +3406,16 @@ browser_window_navigate(struct browser_window *bw,
return error;
}
+
+/**
+ * Internal navigation handler for normal fetches
+ */
static nserror
-browser_window__navigate_internal_real(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_real(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
uint32_t fetch_flags = 0;
- bool fetch_is_post = (params->post_urlenc != NULL || params->post_multipart != NULL);
+ bool fetch_is_post;
llcache_post_data post;
hlcache_child_context child;
nserror res;
@@ -3351,6 +3423,8 @@ browser_window__navigate_internal_real(struct browser_window *bw,
NSLOG(netsurf, INFO, "Loading '%s'", nsurl_access(params->url));
+ fetch_is_post = (params->post_urlenc != NULL || params->post_multipart != NULL);
+
/* Clear SSL info for load */
bw->loading_ssl_info.num = 0;
@@ -3424,6 +3498,7 @@ browser_window__navigate_internal_real(struct browser_window *bw,
return res;
}
+
/**
* Internal navigation handler for the authentication query handler
*
@@ -3431,8 +3506,8 @@ browser_window__navigate_internal_real(struct browser_window *bw,
* then we deal with that, otherwise we pass it on to the about: handler
*/
static nserror
-browser_window__navigate_internal_query_auth(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_query_auth(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
char *userpass = NULL;
const char *username, *password, *realm, *siteurl;
@@ -3447,7 +3522,7 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
if (!(is_login || is_cancel)) {
/* This is a request, so pass it on */
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
if (is_cancel) {
@@ -3497,7 +3572,7 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
/* Finally navigate to the original loading parameters */
bw->internal_nav = false;
- return browser_window__navigate_internal_real(bw, &bw->loading_parameters);
+ return navigate_internal_real(bw, &bw->loading_parameters);
}
@@ -3508,8 +3583,8 @@ browser_window__navigate_internal_query_auth(struct browser_window *bw,
* then we deal with that, otherwise we pass it on to the about: handler
*/
static nserror
-browser_window__navigate_internal_query_ssl(struct browser_window *bw,
- struct browser_fetch_parameters *params)
+navigate_internal_query_ssl(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
{
bool is_proceed = false, is_back = false;
@@ -3520,23 +3595,100 @@ browser_window__navigate_internal_query_ssl(struct browser_window *bw,
if (!(is_proceed || is_back)) {
/* This is a request, so pass it on */
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
return browser_window__handle_ssl_query_response(is_proceed, bw);
}
+/**
+ * Internal navigation handler for the timeout query page.
+ *
+ * If the parameters indicate we're processing a *response* from the handler
+ * then we deal with that, otherwise we pass it on to the about: handler
+ */
+static nserror
+navigate_internal_query_timeout(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
+{
+ bool is_retry = false, is_back = false;
+
+ NSLOG(netsurf, INFO, "bw:%p params:%p", bw, params);
+
+ assert(params->post_multipart != NULL);
+
+ is_retry = fetch_multipart_data_find(params->post_multipart, "retry") != NULL;
+ is_back = fetch_multipart_data_find(params->post_multipart, "back") != NULL;
+
+ if (is_back) {
+ /* do a rough-and-ready nav to the old 'current'
+ * parameters, with any post data stripped away
+ */
+ return browser_window__reload_current_parameters(bw);
+ }
+
+ if (is_retry) {
+ /* Finally navigate to the original loading parameters */
+ bw->internal_nav = false;
+ return navigate_internal_real(bw, &bw->loading_parameters);
+ }
+
+ return navigate_internal_real(bw, params);
+}
+
+
+/**
+ * Internal navigation handler for the fetch error query page.
+ *
+ * If the parameters indicate we're processing a *response* from the handler
+ * then we deal with that, otherwise we pass it on to the about: handler
+ */
+static nserror
+navigate_internal_query_fetcherror(struct browser_window *bw,
+ struct browser_fetch_parameters *params)
+{
+ bool is_retry = false, is_back = false;
+
+ NSLOG(netsurf, INFO, "bw:%p params:%p", bw, params);
+
+ assert(params->post_multipart != NULL);
+
+ is_retry = fetch_multipart_data_find(params->post_multipart, "retry") != NULL;
+ is_back = fetch_multipart_data_find(params->post_multipart, "back") != NULL;
+
+ if (is_back) {
+ /* do a rough-and-ready nav to the old 'current'
+ * parameters, with any post data stripped away
+ */
+ return browser_window__reload_current_parameters(bw);
+ }
+
+ if (is_retry) {
+ /* Finally navigate to the original loading parameters */
+ bw->internal_nav = false;
+ return navigate_internal_real(bw, &bw->loading_parameters);
+ }
+
+ return navigate_internal_real(bw, params);
+}
+
+
+/**
+ * dispatch to internal query handlers or normal navigation
+ *
+ * Here we determine if we're navigating to an internal query URI and
+ * if so, what we need to do about it.
+ *
+ * \note these check must match those in is_internal_navigate_url()
+ *
+ * If we're not, then we just move on to the real navigate.
+ */
nserror
browser_window__navigate_internal(struct browser_window *bw,
struct browser_fetch_parameters *params)
{
lwc_string *scheme, *path;
- /* Here we determine if we're navigating to an internal query URI
- * and if so, what we need to do about it.
- *
- * If we're not, then we just move on to the real navigate.
- */
/* All our special URIs are in the about: scheme */
scheme = nsurl_get_component(params->url, NSURL_SCHEME);
@@ -3550,18 +3702,26 @@ browser_window__navigate_internal(struct browser_window *bw,
path = nsurl_get_component(params->url, NSURL_PATH);
if (path == corestring_lwc_query_auth) {
lwc_string_unref(path);
- return browser_window__navigate_internal_query_auth(bw, params);
+ return navigate_internal_query_auth(bw, params);
}
if (path == corestring_lwc_query_ssl) {
lwc_string_unref(path);
- return browser_window__navigate_internal_query_ssl(bw, params);
+ return navigate_internal_query_ssl(bw, params);
+ }
+ if (path == corestring_lwc_query_timeout) {
+ lwc_string_unref(path);
+ return navigate_internal_query_timeout(bw, params);
+ }
+ if (path == corestring_lwc_query_fetcherror) {
+ lwc_string_unref(path);
+ return navigate_internal_query_fetcherror(bw, params);
}
lwc_string_unref(path);
/* Fall through to a normal about: fetch */
normal_fetch:
- return browser_window__navigate_internal_real(bw, params);
+ return navigate_internal_real(bw, params);
}
diff --git a/resources/FatMessages b/resources/FatMessages
index d1ecd9d..5ebf607 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -25,7 +25,7 @@
#
# The split-messages tool requires keys for all languages to be
# grouped together but language order is not important. If a key for a
-# specific language is ommited the default language value will be used
+# specific language is omitted the default language value will be used
# instead (currently en)
#
# If you find something tagged 'all', but it is only relevant to a specific
@@ -1087,6 +1087,22 @@ en.all.SSLCertErrRevoked:The certificate has been revoked by the issuer.
en.all.SSLCertErrHostnameMismatch:The certificate is for a different host than the server
+# Timeout error interface
+# =======================
+#
+en.all.TimeoutTitle:Connection timed out
+en.all.TimeoutDescription: A connection to %s could not be established. The site may be temporarily unavailable or too busy to respond.
+en.all.Backtoprevious: Back
+en.all.TryAgain: Try Again
+
+
+# Fetch error interface
+# =======================
+#
+en.all.FetchErrorTitle:Error occurred fetching page
+en.all.FetchErrorDescription:An error occurred when connecting to %s
+
+
# SSL certificate viewer
# ======================
#
diff --git a/resources/internal.css b/resources/internal.css
index e43d183..ded56ee 100644
--- a/resources/internal.css
+++ b/resources/internal.css
@@ -343,3 +343,79 @@ body#privacy div#buttons {
body#privacy div#buttons input#back {
margin-right: 1em;
}
+
+/*
+ * timeout query styling
+ */
+
+body#timeout {
+ max-width: 45em;
+}
+
+body#timeout h1 {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ border-bottom: 0.1em solid #444;
+ margin: 0 0 1.3em 0;
+ background: #c55;
+ color: white;
+}
+
+body#timeout form {
+ /* Just to center the form on the page */
+ margin: 0 auto;
+ /* To see the outline of the form */
+ padding: 1em;
+ border: 1px solid #CCC;
+ border-radius: 1em;
+}
+
+body#timeout form div + div {
+ margin-top: 1em;
+}
+
+body#timeout div#buttons {
+ text-align: right;
+ margin-right: 1em;
+}
+
+body#timeout div#buttons input#back {
+ margin-right: 1em;
+}
+
+/*
+ * fetch error query styling
+ */
+
+body#fetcherror {
+ max-width: 45em;
+}
+
+body#fetcherror h1 {
+ padding: 0.8em 0.4em 0.5em 0.4em;
+ border-bottom: 0.1em solid #444;
+ margin: 0 0 1.3em 0;
+ background: #c55;
+ color: white;
+}
+
+body#fetcherror form {
+ /* Just to center the form on the page */
+ margin: 0 auto;
+ /* To see the outline of the form */
+ padding: 1em;
+ border: 1px solid #CCC;
+ border-radius: 1em;
+}
+
+body#fetcherror form div + div {
+ margin-top: 1em;
+}
+
+body#fetcherror div#buttons {
+ text-align: right;
+ margin-right: 1em;
+}
+
+body#fetcherror div#buttons input#back {
+ margin-right: 1em;
+}
diff --git a/test/messages.c b/test/messages.c
index ae82d1e..3ec770a 100644
--- a/test/messages.c
+++ b/test/messages.c
@@ -118,8 +118,7 @@ START_TEST(message_get_buff_test)
ck_assert_int_eq(res, NSERROR_OK);
buf = messages_get_buff("DefinitelyNotAKey");
- ck_assert_str_eq(buf, "DefinitelyNotAKey");
- free(buf);
+ ck_assert(buf == NULL);
buf = messages_get_buff("NoMemory");
ck_assert_str_eq(buf, "NetSurf is running out of memory. Please free some memory and try again.");
diff --git a/utils/corestringlist.h b/utils/corestringlist.h
index f0d39c6..b109545 100644
--- a/utils/corestringlist.h
+++ b/utils/corestringlist.h
@@ -148,6 +148,8 @@ CORESTRING_LWC_VALUE(no_cache, "no-cache");
CORESTRING_LWC_VALUE(no_store, "no-store");
CORESTRING_LWC_VALUE(query_auth, "query/auth");
CORESTRING_LWC_VALUE(query_ssl, "query/ssl");
+CORESTRING_LWC_VALUE(query_timeout, "query/timeout");
+CORESTRING_LWC_VALUE(query_fetcherror, "query/fetcherror");
/* mime types */
CORESTRING_LWC_VALUE(multipart_form_data, "multipart/form-data");
@@ -360,6 +362,8 @@ CORESTRING_DOM_VALUE(html_namespace, "http://www.w3.org/1999/xhtml");
CORESTRING_NSURL(about_blank, "about:blank");
CORESTRING_NSURL(about_query_ssl, "about:query/ssl");
CORESTRING_NSURL(about_query_auth, "about:query/auth");
+CORESTRING_NSURL(about_query_timeout, "about:query/timeout");
+CORESTRING_NSURL(about_query_fetcherror, "about:query/fetcherror");
#undef CORESTRING_LWC_STRING
#undef CORESTRING_DOM_STRING
diff --git a/utils/hashtable.c b/utils/hashtable.c
index 4935d6b..aa162cb 100644
--- a/utils/hashtable.c
+++ b/utils/hashtable.c
@@ -347,10 +347,12 @@ const char *hash_get(struct hash_table *ht, const char *key)
h = hash_string_fnv(key, &key_length);
c = h % ht->nchains;
- for (e = ht->chain[c]; e; e = e->next)
+ for (e = ht->chain[c]; e; e = e->next) {
if ((key_length == e->key_length) &&
- (memcmp(key, e->pairing, key_length) == 0))
+ (memcmp(key, e->pairing, key_length) == 0)) {
return e->pairing + key_length + 1;
+ }
+ }
return NULL;
}
diff --git a/utils/messages.c b/utils/messages.c
index 197d45e..5525e18 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -42,11 +42,69 @@
/** Messages are stored in a fixed-size hash table. */
#define HASH_SIZE 101
-/** The hash table used to store the standard Messages file for the old API */
+/**
+ * The hash table used to store the standard Messages file for the old API
+ */
static struct hash_table *messages_hash = NULL;
/**
+ * Create a message context
+ *
+ * generate a message context populated with english fallbacks for
+ * some formatted messages.
+ */
+static struct hash_table *messages_create_ctx(int hash_size)
+{
+ struct hash_table *nctx;
+ const struct {
+ const char *key;
+ const char *value;
+ } fallback[] = {
+ { "LoginDescription",
+ "The site %s is requesting your username and password. "
+ "The realm is \"%s\""},
+ { "PrivacyDescription",
+ "A privacy error occurred while communicating with %s this "
+ "may be a site configuration error or an attempt to steal "
+ "private information (passwords, messages or credit cards)"},
+ { "TimeoutDescription",
+ "A connection to %s could not be established. The site may "
+ "be temporarily unavailable or too busy to respond."},
+ { "FetchErrorDescription",
+ "An error occurred when connecting to %s"},
+ { NULL, NULL}
+ };
+ nctx = hash_create(hash_size);
+
+ if (nctx != NULL) {
+ int floop;
+ for (floop = 0; fallback[floop].key != NULL; floop++) {
+ hash_add(nctx,
+ fallback[floop].key,
+ fallback[floop].value);
+ }
+ }
+
+ return nctx;
+}
+
+/**
+ * Free memory used by a messages hash.
+ * The context will not be valid after this function returns.
+ *
+ * \param ctx context of messages file to free
+ */
+static void messages_destroy_ctx(struct hash_table *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ hash_destroy(ctx);
+}
+
+
+/**
* Read keys and values from messages file.
*
* \param path pathname of messages file
@@ -66,7 +124,7 @@ static nserror messages_load_ctx(const char *path, struct hash_table **ctx)
return hash_add_file(*ctx, path);
}
- nctx = hash_create(HASH_SIZE);
+ nctx = messages_create_ctx(HASH_SIZE);
if (nctx == NULL) {
NSLOG(netsurf, INFO,
"Unable to create hash table for messages file %s",
@@ -115,21 +173,6 @@ messages_get_ctx(const char *key, struct hash_table *ctx)
}
-/**
- * Free memory used by a messages hash.
- * The context will not be valid after this function returns.
- *
- * \param ctx context of messages file to free
- */
-static void messages_destroy_ctx(struct hash_table *ctx)
-{
- if (ctx == NULL)
- return;
-
- hash_destroy(ctx);
-}
-
-
/* exported interface documented in messages.h */
nserror messages_add_from_file(const char *path)
{
@@ -148,7 +191,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t size)
{
/* ensure the hash table is initialised */
if (messages_hash == NULL) {
- messages_hash = hash_create(HASH_SIZE);
+ messages_hash = messages_create_ctx(HASH_SIZE);
}
if (messages_hash == NULL) {
NSLOG(netsurf, INFO, "Unable to create hash table");
@@ -157,6 +200,7 @@ nserror messages_add_from_inline(const uint8_t *data, size_t size)
return hash_add_inline(messages_hash, data, size);
}
+
/* exported interface documented in messages.h */
char *messages_get_buff(const char *key, ...)
{
@@ -165,7 +209,17 @@ char *messages_get_buff(const char *key, ...)
int buff_len = 0;
va_list ap;
- msg_fmt = messages_get_ctx(key, messages_hash);
+ assert(key != NULL);
+
+ if (messages_hash == NULL) {
+ return NULL;
+ }
+
+ msg_fmt = hash_get(messages_hash, key);
+
+ if (msg_fmt == NULL) {
+ return NULL;
+ }
va_start(ap, key);
buff_len = vsnprintf(buff, buff_len, msg_fmt, ap);
diff --git a/utils/messages.h b/utils/messages.h
index 635d6e8..5da35e4 100644
--- a/utils/messages.h
+++ b/utils/messages.h
@@ -16,7 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-/** \file
+/**
+ * \file
* Localised message support (interface).
*
* The messages module loads a file of keys and associated strings, and
@@ -30,8 +31,8 @@
* file table. Use the _ctx versions of the functions to do this.
*/
-#ifndef _NETSURF_UTILS_MESSAGES_H_
-#define _NETSURF_UTILS_MESSAGES_H_
+#ifndef NETSURF_UTILS_MESSAGES_H_
+#define NETSURF_UTILS_MESSAGES_H_
#include <stdint.h>
@@ -90,13 +91,12 @@ const char *messages_get_sslcode(ssl_cert_err code);
/**
* Formatted message from a key in the global message hash.
*
- * \param key key of message
+ * \param key key of message
* \param ... message parameters
- * \return buffer containing formatted message text or NULL if memory
- * is unavailable. The caller owns the returned buffer and is
- * responsible for freeing it.
+ * \return buffer containing formatted message text or NULL if key is
+ * unavailable or memory allocation failed. The caller owns the
+ * returned buffer and is responsible for freeing it.
*/
-
char *messages_get_buff(const char *key, ...);
/**
--
NetSurf Browser
3 years, 10 months
netsurf: branch master updated. release/3.9-285-g1176ce4
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/1176ce427113face73c48...
...commit http://git.netsurf-browser.org/netsurf.git/commit/1176ce427113face73c48c4...
...tree http://git.netsurf-browser.org/netsurf.git/tree/1176ce427113face73c48c4b2...
The branch, master has been updated
via 1176ce427113face73c48c4b2e4e5a810577b355 (commit)
from 5aeca580f43c5866794a630e35fa18dbfeefaa01 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=1176ce427113face73c...
commit 1176ce427113face73c48c4b2e4e5a810577b355
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
Improve timeout error messaging
diff --git a/content/llcache.c b/content/llcache.c
index f209fab..cd40662 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2354,6 +2354,7 @@ static nserror llcache_fetch_cert_error(llcache_object *object)
return error;
}
+
/**
* Handle a TLS connection setup failure
*
@@ -2376,7 +2377,7 @@ static nserror llcache_fetch_ssl_error(llcache_object *object)
/* Make no attempt to downgrade if HSTS is in use
* (i.e. assume server does TLS properly) */
if (object->fetch.hsts_in_use ||
- object->fetch.tried_with_tls_downgrade) {
+ object->fetch.tried_with_tls_downgrade) {
/* Have already tried to downgrade, so give up */
llcache_event event;
@@ -2400,6 +2401,46 @@ static nserror llcache_fetch_ssl_error(llcache_object *object)
return error;
}
+
+/**
+ * handle time out while trying to fetch.
+ *
+ * \param object Object being fetched
+ * \return NSERROR_OK on success otherwise error code
+ */
+static nserror llcache_fetch_timeout(llcache_object *object)
+{
+ llcache_event event;
+
+ /* The fetch has already been cleaned up by the fetcher but
+ * we would like to retry if we can.
+ */
+ if (object->fetch.retries_remaining > 1) {
+ object->fetch.retries_remaining--;
+ return llcache_object_refetch(object);
+ }
+
+ /* The fetch has has already been cleaned up by the fetcher */
+ object->fetch.state = LLCACHE_FETCH_COMPLETE;
+ object->fetch.fetch = NULL;
+
+ /* Release candidate, if any */
+ if (object->candidate != NULL) {
+ object->candidate->candidate_count--;
+ object->candidate = NULL;
+ }
+
+ /* Invalidate cache control data */
+ llcache_invalidate_cache_control_data(object);
+
+ event.type = LLCACHE_EVENT_ERROR;
+ event.data.error.code = NSERROR_TIMEOUT;
+ event.data.error.msg = NULL;
+
+ return llcache_send_event_to_users(object, &event);
+}
+
+
/**
* Construct a sorted list of objects available for writeout operation.
*
@@ -2732,6 +2773,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_redirect(object,
msg->data.redirect, &object);
break;
+
case FETCH_NOTMODIFIED:
/* Conditional request determined that cached object is fresh */
error = llcache_fetch_notmodified(object, &object);
@@ -2744,6 +2786,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
msg->data.header_or_data.buf,
msg->data.header_or_data.len);
break;
+
case FETCH_FINISHED:
/* Finished fetching */
{
@@ -2775,14 +2818,9 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
/* Out-of-band information */
case FETCH_TIMEDOUT:
/* Timed out while trying to fetch. */
- /* The fetch has already been cleaned up by the fetcher but
- * we would like to retry if we can. */
- if (object->fetch.retries_remaining > 1) {
- object->fetch.retries_remaining--;
- error = llcache_object_refetch(object);
- break;
- }
- /* Fall through */
+ error = llcache_fetch_timeout(object);
+ break;
+
case FETCH_ERROR:
/* An error occurred while fetching */
/* The fetch has has already been cleaned up by the fetcher */
@@ -2807,6 +2845,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
case FETCH_PROGRESS:
/* Progress update */
event.type = LLCACHE_EVENT_PROGRESS;
@@ -2815,6 +2854,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
case FETCH_CERTS:
/* Certificate information from the fetch */
/** \todo CERTS - Should we persist this on the object and
@@ -2826,6 +2866,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
/* Events requiring action */
case FETCH_AUTH:
/* Need Authentication */
@@ -2838,6 +2879,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_auth(object, msg->data.auth.realm);
break;
+
case FETCH_CERT_ERR:
/* Something went wrong when validating TLS certificates */
@@ -2849,6 +2891,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_cert_error(object);
break;
+
case FETCH_SSL_ERR:
/* TLS connection setup failed */
diff --git a/resources/FatMessages b/resources/FatMessages
index 12d81bd..d1ecd9d 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -459,6 +459,7 @@ de.all.DirectoryError:Verzeichnis '%s' existiert bereits.
fr.all.DirectoryError:répertoire '%s' existe déjà
it.all.DirectoryError:La directory '%s' è già esistente
nl.all.DirectoryError:map '%s' bestaat reeds
+en.all.Timeout:This site took too long to respond
# error messages for RISC OS
#
diff --git a/utils/errors.h b/utils/errors.h
index a543515..ac4d38e 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -62,6 +62,7 @@ typedef enum {
NSERROR_BAD_REDIRECT, /**< Fetch encountered a bad redirect */
NSERROR_BAD_AUTH, /**< Fetch needs authentication data */
NSERROR_BAD_CERTS, /**< Fetch needs certificate chain check */
+ NSERROR_TIMEOUT, /**< Operation timed out */
} nserror;
#endif
diff --git a/utils/messages.c b/utils/messages.c
index 0d2085c..197d45e 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -333,6 +333,10 @@ const char *messages_get_errorcode(nserror code)
case NSERROR_BAD_CERTS:
/* Certificate chain verification failure */
return messages_get_ctx("CertificateVerificationNeeded", messages_hash);
+
+ case NSERROR_TIMEOUT:
+ /* Operation timed out */
+ return messages_get_ctx("Timeout", messages_hash);
}
/* The switch has no default, so the compiler should tell us when we
-----------------------------------------------------------------------
Summary of changes:
content/llcache.c | 61 +++++++++++++++++++++++++++++++++++++++++--------
resources/FatMessages | 1 +
utils/errors.h | 1 +
utils/messages.c | 4 ++++
4 files changed, 58 insertions(+), 9 deletions(-)
diff --git a/content/llcache.c b/content/llcache.c
index f209fab..cd40662 100644
--- a/content/llcache.c
+++ b/content/llcache.c
@@ -2354,6 +2354,7 @@ static nserror llcache_fetch_cert_error(llcache_object *object)
return error;
}
+
/**
* Handle a TLS connection setup failure
*
@@ -2376,7 +2377,7 @@ static nserror llcache_fetch_ssl_error(llcache_object *object)
/* Make no attempt to downgrade if HSTS is in use
* (i.e. assume server does TLS properly) */
if (object->fetch.hsts_in_use ||
- object->fetch.tried_with_tls_downgrade) {
+ object->fetch.tried_with_tls_downgrade) {
/* Have already tried to downgrade, so give up */
llcache_event event;
@@ -2400,6 +2401,46 @@ static nserror llcache_fetch_ssl_error(llcache_object *object)
return error;
}
+
+/**
+ * handle time out while trying to fetch.
+ *
+ * \param object Object being fetched
+ * \return NSERROR_OK on success otherwise error code
+ */
+static nserror llcache_fetch_timeout(llcache_object *object)
+{
+ llcache_event event;
+
+ /* The fetch has already been cleaned up by the fetcher but
+ * we would like to retry if we can.
+ */
+ if (object->fetch.retries_remaining > 1) {
+ object->fetch.retries_remaining--;
+ return llcache_object_refetch(object);
+ }
+
+ /* The fetch has has already been cleaned up by the fetcher */
+ object->fetch.state = LLCACHE_FETCH_COMPLETE;
+ object->fetch.fetch = NULL;
+
+ /* Release candidate, if any */
+ if (object->candidate != NULL) {
+ object->candidate->candidate_count--;
+ object->candidate = NULL;
+ }
+
+ /* Invalidate cache control data */
+ llcache_invalidate_cache_control_data(object);
+
+ event.type = LLCACHE_EVENT_ERROR;
+ event.data.error.code = NSERROR_TIMEOUT;
+ event.data.error.msg = NULL;
+
+ return llcache_send_event_to_users(object, &event);
+}
+
+
/**
* Construct a sorted list of objects available for writeout operation.
*
@@ -2732,6 +2773,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_redirect(object,
msg->data.redirect, &object);
break;
+
case FETCH_NOTMODIFIED:
/* Conditional request determined that cached object is fresh */
error = llcache_fetch_notmodified(object, &object);
@@ -2744,6 +2786,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
msg->data.header_or_data.buf,
msg->data.header_or_data.len);
break;
+
case FETCH_FINISHED:
/* Finished fetching */
{
@@ -2775,14 +2818,9 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
/* Out-of-band information */
case FETCH_TIMEDOUT:
/* Timed out while trying to fetch. */
- /* The fetch has already been cleaned up by the fetcher but
- * we would like to retry if we can. */
- if (object->fetch.retries_remaining > 1) {
- object->fetch.retries_remaining--;
- error = llcache_object_refetch(object);
- break;
- }
- /* Fall through */
+ error = llcache_fetch_timeout(object);
+ break;
+
case FETCH_ERROR:
/* An error occurred while fetching */
/* The fetch has has already been cleaned up by the fetcher */
@@ -2807,6 +2845,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
case FETCH_PROGRESS:
/* Progress update */
event.type = LLCACHE_EVENT_PROGRESS;
@@ -2815,6 +2854,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
case FETCH_CERTS:
/* Certificate information from the fetch */
/** \todo CERTS - Should we persist this on the object and
@@ -2826,6 +2866,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_send_event_to_users(object, &event);
break;
+
/* Events requiring action */
case FETCH_AUTH:
/* Need Authentication */
@@ -2838,6 +2879,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_auth(object, msg->data.auth.realm);
break;
+
case FETCH_CERT_ERR:
/* Something went wrong when validating TLS certificates */
@@ -2849,6 +2891,7 @@ static void llcache_fetch_callback(const fetch_msg *msg, void *p)
error = llcache_fetch_cert_error(object);
break;
+
case FETCH_SSL_ERR:
/* TLS connection setup failed */
diff --git a/resources/FatMessages b/resources/FatMessages
index 12d81bd..d1ecd9d 100644
--- a/resources/FatMessages
+++ b/resources/FatMessages
@@ -459,6 +459,7 @@ de.all.DirectoryError:Verzeichnis '%s' existiert bereits.
fr.all.DirectoryError:répertoire '%s' existe déjà
it.all.DirectoryError:La directory '%s' è già esistente
nl.all.DirectoryError:map '%s' bestaat reeds
+en.all.Timeout:This site took too long to respond
# error messages for RISC OS
#
diff --git a/utils/errors.h b/utils/errors.h
index a543515..ac4d38e 100644
--- a/utils/errors.h
+++ b/utils/errors.h
@@ -62,6 +62,7 @@ typedef enum {
NSERROR_BAD_REDIRECT, /**< Fetch encountered a bad redirect */
NSERROR_BAD_AUTH, /**< Fetch needs authentication data */
NSERROR_BAD_CERTS, /**< Fetch needs certificate chain check */
+ NSERROR_TIMEOUT, /**< Operation timed out */
} nserror;
#endif
diff --git a/utils/messages.c b/utils/messages.c
index 0d2085c..197d45e 100644
--- a/utils/messages.c
+++ b/utils/messages.c
@@ -333,6 +333,10 @@ const char *messages_get_errorcode(nserror code)
case NSERROR_BAD_CERTS:
/* Certificate chain verification failure */
return messages_get_ctx("CertificateVerificationNeeded", messages_hash);
+
+ case NSERROR_TIMEOUT:
+ /* Operation timed out */
+ return messages_get_ctx("Timeout", messages_hash);
}
/* The switch has no default, so the compiler should tell us when we
--
NetSurf Browser
3 years, 10 months
netsurf: branch master updated. release/3.9-284-g5aeca58
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/5aeca580f43c5866794a6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/5aeca580f43c5866794a630...
...tree http://git.netsurf-browser.org/netsurf.git/tree/5aeca580f43c5866794a630e3...
The branch, master has been updated
via 5aeca580f43c5866794a630e35fa18dbfeefaa01 (commit)
via 044ddd5d432aa94ff30851407b8c81875c655a83 (commit)
from 6e7f98787a78f2d6666b68af747a000dcd2dba9a (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=5aeca580f43c5866794...
commit 5aeca580f43c5866794a630e35fa18dbfeefaa01
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
save complete: Change de-duplication to compare URLs, rather than contents.
We seem to have more than one content for the same resource.
For example:
* save `<img src="about:logo"><img src="about:logo">` as img-test.html
* run `rm -rf test-save && make && ./nsgtk img-test.html`
* ctrl+s
* save as "test-save" in the current netsurf dir.
* run `md5sum test-save/*`
before and after this commit. The de-duplication works with URLs,
where it wasn't working with hlcache_handles or contents.
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index d7a02ae..b54e7f3 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -370,8 +370,10 @@ save_complete_save_stylesheet(save_complete_ctx *ctx, hlcache_handle *css)
char filename[32];
bool result;
- if (save_complete_ctx_has_content(ctx, css))
+ if (save_complete_ctx_find_content(ctx,
+ hlcache_handle_get_url(css)) != NULL) {
return true;
+ }
if (save_complete_ctx_add_content(ctx, css) == false) {
guit->misc->warning("NoMemory", 0);
@@ -473,8 +475,10 @@ save_complete_save_html_object(save_complete_ctx *ctx, hlcache_handle *obj)
if (obj_data == NULL)
return true;
- if (save_complete_ctx_has_content(ctx, obj))
+ if (save_complete_ctx_find_content(ctx,
+ hlcache_handle_get_url(obj)) != NULL) {
return true;
+ }
if (save_complete_ctx_add_content(ctx, obj) == false) {
guit->misc->warning("NoMemory", 0);
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=044ddd5d432aa94ff30...
commit 044ddd5d432aa94ff30851407b8c81875c655a83
Author: Michael Drake <tlsa(a)netsurf-browser.org>
Commit: Michael Drake <tlsa(a)netsurf-browser.org>
save complete: ctx_find_content: compare contents, not hlcache_handles
There can be multiple hlcache_handles per sharable content.
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 1ecb313..d7a02ae 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -147,7 +147,8 @@ save_complete_ctx_has_content(save_complete_ctx *ctx,
save_complete_entry *entry;
for (entry = ctx->list; entry != NULL; entry = entry->next) {
- if (entry->content == content)
+ if (hlcache_handle_get_content(entry->content) ==
+ hlcache_handle_get_content(content))
return true;
}
-----------------------------------------------------------------------
Summary of changes:
desktop/save_complete.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 1ecb313..b54e7f3 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -147,7 +147,8 @@ save_complete_ctx_has_content(save_complete_ctx *ctx,
save_complete_entry *entry;
for (entry = ctx->list; entry != NULL; entry = entry->next) {
- if (entry->content == content)
+ if (hlcache_handle_get_content(entry->content) ==
+ hlcache_handle_get_content(content))
return true;
}
@@ -369,8 +370,10 @@ save_complete_save_stylesheet(save_complete_ctx *ctx, hlcache_handle *css)
char filename[32];
bool result;
- if (save_complete_ctx_has_content(ctx, css))
+ if (save_complete_ctx_find_content(ctx,
+ hlcache_handle_get_url(css)) != NULL) {
return true;
+ }
if (save_complete_ctx_add_content(ctx, css) == false) {
guit->misc->warning("NoMemory", 0);
@@ -472,8 +475,10 @@ save_complete_save_html_object(save_complete_ctx *ctx, hlcache_handle *obj)
if (obj_data == NULL)
return true;
- if (save_complete_ctx_has_content(ctx, obj))
+ if (save_complete_ctx_find_content(ctx,
+ hlcache_handle_get_url(obj)) != NULL) {
return true;
+ }
if (save_complete_ctx_add_content(ctx, obj) == false) {
guit->misc->warning("NoMemory", 0);
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-282-g6e7f987
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/6e7f98787a78f2d6666b6...
...commit http://git.netsurf-browser.org/netsurf.git/commit/6e7f98787a78f2d6666b68a...
...tree http://git.netsurf-browser.org/netsurf.git/tree/6e7f98787a78f2d6666b68af7...
The branch, master has been updated
via 6e7f98787a78f2d6666b68af747a000dcd2dba9a (commit)
from da7c750efdb215ed5c8c16dd071dee7544d034c9 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=6e7f98787a78f2d6666...
commit 6e7f98787a78f2d6666b68af747a000dcd2dba9a
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
ensure all error messages have text if not provided by caller
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index f43e93e..a6b77b0 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1208,10 +1208,10 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_REDIRECT:
/* The message is already filled out */
break;
- case NSERROR_UNKNOWN:
- message = messages_get_errorcode(code);
- break;
default:
+ if (message == NULL) {
+ message = messages_get_errorcode(code);
+ }
break;
}
-----------------------------------------------------------------------
Summary of changes:
desktop/browser_window.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/desktop/browser_window.c b/desktop/browser_window.c
index f43e93e..a6b77b0 100644
--- a/desktop/browser_window.c
+++ b/desktop/browser_window.c
@@ -1208,10 +1208,10 @@ browser_window__handle_error(struct browser_window *bw,
case NSERROR_BAD_REDIRECT:
/* The message is already filled out */
break;
- case NSERROR_UNKNOWN:
- message = messages_get_errorcode(code);
- break;
default:
+ if (message == NULL) {
+ message = messages_get_errorcode(code);
+ }
break;
}
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-281-gda7c750
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/da7c750efdb215ed5c8c1...
...commit http://git.netsurf-browser.org/netsurf.git/commit/da7c750efdb215ed5c8c16d...
...tree http://git.netsurf-browser.org/netsurf.git/tree/da7c750efdb215ed5c8c16dd0...
The branch, master has been updated
via da7c750efdb215ed5c8c16dd071dee7544d034c9 (commit)
via 699cc7deeebb2b148bbf32a2dd60098fdc6fd726 (commit)
via bb60859535e92f16adbd63b8bba9b0ba6b5fb4b1 (commit)
from d0359bc957235384074363eb04f673be7195cd9e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=da7c750efdb215ed5c8...
commit da7c750efdb215ed5c8c16dd071dee7544d034c9
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix some formatting in save complete
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 7dc86c4..1ecb313 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -140,14 +140,16 @@ save_complete_ctx_find_content(save_complete_ctx *ctx, const nsurl *url)
}
-static bool save_complete_ctx_has_content(save_complete_ctx *ctx,
- struct hlcache_handle *content)
+static bool
+save_complete_ctx_has_content(save_complete_ctx *ctx,
+ struct hlcache_handle *content)
{
save_complete_entry *entry;
- for (entry = ctx->list; entry != NULL; entry = entry->next)
+ for (entry = ctx->list; entry != NULL; entry = entry->next) {
if (entry->content == content)
return true;
+ }
return false;
}
@@ -409,8 +411,10 @@ save_complete_save_stylesheet(save_complete_ctx *ctx, hlcache_handle *css)
return result;
}
-static bool save_complete_save_imported_sheets(save_complete_ctx *ctx,
- struct nscss_import *imports, uint32_t import_count)
+static bool
+save_complete_save_imported_sheets(save_complete_ctx *ctx,
+ struct nscss_import *imports,
+ uint32_t import_count)
{
uint32_t i;
@@ -425,8 +429,9 @@ static bool save_complete_save_imported_sheets(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_save_html_stylesheet(save_complete_ctx *ctx,
- struct html_stylesheet *sheet)
+static bool
+save_complete_save_html_stylesheet(save_complete_ctx *ctx,
+ struct html_stylesheet *sheet)
{
if (sheet->sheet == NULL)
return true;
@@ -756,8 +761,10 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
}
}
-static bool save_complete_handle_attr(save_complete_ctx *ctx,
- dom_string *node_name, dom_attr *attr)
+static bool
+save_complete_handle_attr(save_complete_ctx *ctx,
+ dom_string *node_name,
+ dom_attr *attr)
{
dom_string *name;
const char *name_data;
@@ -800,8 +807,10 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_handle_attrs(save_complete_ctx *ctx,
- dom_string *node_name, dom_namednodemap *attrs)
+static bool
+save_complete_handle_attrs(save_complete_ctx *ctx,
+ dom_string *node_name,
+ dom_namednodemap *attrs)
{
uint32_t length, i;
dom_exception error;
@@ -831,8 +840,10 @@ static bool save_complete_handle_attrs(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_handle_element(save_complete_ctx *ctx,
- dom_node *node, save_complete_event_type event_type)
+static bool
+save_complete_handle_element(save_complete_ctx *ctx,
+ dom_node *node,
+ save_complete_event_type event_type)
{
dom_string *name;
dom_namednodemap *attrs;
@@ -853,12 +864,12 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
name_data = dom_string_data(name);
name_len = dom_string_byte_length(name);
- if (name_len == SLEN("base") &&
- strncasecmp(name_data, "base", name_len) == 0) {
+ if ((name_len == SLEN("base")) &&
+ (strncasecmp(name_data, "base", name_len) == 0)) {
/* Elide BASE elements from the output */
process = false;
- } else if (name_len == SLEN("meta") &&
- strncasecmp(name_data, "meta", name_len) == 0) {
+ } else if ((name_len == SLEN("meta")) &&
+ (strncasecmp(name_data, "meta", name_len) == 0)) {
/* Don't emit close tags for META elements */
if (event_type == EVENT_LEAVE) {
process = false;
@@ -866,7 +877,8 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
/* Elide meta charsets */
dom_string *value;
error = dom_element_get_attribute(node,
- corestring_dom_http_equiv, &value);
+ corestring_dom_http_equiv,
+ &value);
if (error != DOM_NO_ERR) {
dom_string_unref(name);
return false;
@@ -908,8 +920,9 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
}
fputc('<', ctx->fp);
- if (event_type == EVENT_LEAVE)
+ if (event_type == EVENT_LEAVE) {
fputc('/', ctx->fp);
+ }
fwrite(name_data, sizeof(*name_data), name_len, ctx->fp);
if (event_type == EVENT_ENTER) {
@@ -979,8 +992,10 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_node_handler(dom_node *node,
- save_complete_event_type event_type, void *ctxin)
+static bool
+save_complete_node_handler(dom_node *node,
+ save_complete_event_type event_type,
+ void *ctxin)
{
save_complete_ctx *ctx = ctxin;
dom_node_type type;
@@ -1098,8 +1113,10 @@ static bool save_complete_node_handler(dom_node *node,
return true;
}
-static bool save_complete_save_html_document(save_complete_ctx *ctx,
- hlcache_handle *c, bool index)
+static bool
+save_complete_save_html_document(save_complete_ctx *ctx,
+ hlcache_handle *c,
+ bool index)
{
nserror ret;
FILE *fp;
@@ -1134,8 +1151,9 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx,
doc = html_get_document(c);
- if (save_complete_libdom_treewalk((dom_node *) doc,
- save_complete_node_handler, ctx) == false) {
+ if (save_complete_libdom_treewalk((dom_node *)doc,
+ save_complete_node_handler,
+ ctx) == false) {
free(fname);
guit->misc->warning("NoMemory", 0);
fclose(fp);
@@ -1164,8 +1182,10 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx,
* \param index true to save as "index"
* \return true on success, false on error and error reported
*/
-static bool save_complete_save_html(save_complete_ctx *ctx, hlcache_handle *c,
- bool index)
+static bool
+save_complete_save_html(save_complete_ctx *ctx,
+ hlcache_handle *c,
+ bool index)
{
if (content_get_type(c) != CONTENT_HTML)
return false;
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=699cc7deeebb2b148bb...
commit 699cc7deeebb2b148bbf32a2dd60098fdc6fd726
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
ensure save_complete resources are correctly finalised before quit
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 4d98d2e..7dc86c4 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -1272,6 +1272,13 @@ void save_complete_init(void)
}
/* Documented in save_complete.h */
+nserror save_complete_finalise(void)
+{
+ regfree(&save_complete_import_re);
+ return NSERROR_OK;
+}
+
+/* Documented in save_complete.h */
bool
save_complete(hlcache_handle *c,
const char *path,
diff --git a/desktop/save_complete.h b/desktop/save_complete.h
index 3c389a5..f7f2507 100644
--- a/desktop/save_complete.h
+++ b/desktop/save_complete.h
@@ -44,6 +44,12 @@ typedef void (*save_complete_set_type_cb)(const char *path,
*/
void save_complete_init(void);
+
+/**
+ * Finalise save complete module.
+ */
+nserror save_complete_finalise(void);
+
/**
* Save an HTML page with all dependencies.
*
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index f14c7bd..ea8d77a 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -543,6 +543,12 @@ static void gui_quit(void)
messages_get_errorcode(res));
}
+ res = save_complete_finalise();
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Error finalising save complete: %s",
+ messages_get_errorcode(res));
+ }
+
free(nsgtk_config_home);
gtk_fetch_filetype_fin();
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=bb60859535e92f16adb...
commit bb60859535e92f16adbd63b8bba9b0ba6b5fb4b1
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
resolve leak of attribute value lwc string in complete save
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 6cbefd6..4d98d2e 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -792,6 +792,7 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
dom_string_unref(name);
return false;
}
+ dom_string_unref(value);
}
dom_string_unref(name);
-----------------------------------------------------------------------
Summary of changes:
desktop/save_complete.c | 82 +++++++++++++++++++++++++++++++----------------
desktop/save_complete.h | 6 ++++
frontends/gtk/gui.c | 6 ++++
3 files changed, 67 insertions(+), 27 deletions(-)
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 6cbefd6..1ecb313 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -140,14 +140,16 @@ save_complete_ctx_find_content(save_complete_ctx *ctx, const nsurl *url)
}
-static bool save_complete_ctx_has_content(save_complete_ctx *ctx,
- struct hlcache_handle *content)
+static bool
+save_complete_ctx_has_content(save_complete_ctx *ctx,
+ struct hlcache_handle *content)
{
save_complete_entry *entry;
- for (entry = ctx->list; entry != NULL; entry = entry->next)
+ for (entry = ctx->list; entry != NULL; entry = entry->next) {
if (entry->content == content)
return true;
+ }
return false;
}
@@ -409,8 +411,10 @@ save_complete_save_stylesheet(save_complete_ctx *ctx, hlcache_handle *css)
return result;
}
-static bool save_complete_save_imported_sheets(save_complete_ctx *ctx,
- struct nscss_import *imports, uint32_t import_count)
+static bool
+save_complete_save_imported_sheets(save_complete_ctx *ctx,
+ struct nscss_import *imports,
+ uint32_t import_count)
{
uint32_t i;
@@ -425,8 +429,9 @@ static bool save_complete_save_imported_sheets(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_save_html_stylesheet(save_complete_ctx *ctx,
- struct html_stylesheet *sheet)
+static bool
+save_complete_save_html_stylesheet(save_complete_ctx *ctx,
+ struct html_stylesheet *sheet)
{
if (sheet->sheet == NULL)
return true;
@@ -756,8 +761,10 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
}
}
-static bool save_complete_handle_attr(save_complete_ctx *ctx,
- dom_string *node_name, dom_attr *attr)
+static bool
+save_complete_handle_attr(save_complete_ctx *ctx,
+ dom_string *node_name,
+ dom_attr *attr)
{
dom_string *name;
const char *name_data;
@@ -792,6 +799,7 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
dom_string_unref(name);
return false;
}
+ dom_string_unref(value);
}
dom_string_unref(name);
@@ -799,8 +807,10 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_handle_attrs(save_complete_ctx *ctx,
- dom_string *node_name, dom_namednodemap *attrs)
+static bool
+save_complete_handle_attrs(save_complete_ctx *ctx,
+ dom_string *node_name,
+ dom_namednodemap *attrs)
{
uint32_t length, i;
dom_exception error;
@@ -830,8 +840,10 @@ static bool save_complete_handle_attrs(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_handle_element(save_complete_ctx *ctx,
- dom_node *node, save_complete_event_type event_type)
+static bool
+save_complete_handle_element(save_complete_ctx *ctx,
+ dom_node *node,
+ save_complete_event_type event_type)
{
dom_string *name;
dom_namednodemap *attrs;
@@ -852,12 +864,12 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
name_data = dom_string_data(name);
name_len = dom_string_byte_length(name);
- if (name_len == SLEN("base") &&
- strncasecmp(name_data, "base", name_len) == 0) {
+ if ((name_len == SLEN("base")) &&
+ (strncasecmp(name_data, "base", name_len) == 0)) {
/* Elide BASE elements from the output */
process = false;
- } else if (name_len == SLEN("meta") &&
- strncasecmp(name_data, "meta", name_len) == 0) {
+ } else if ((name_len == SLEN("meta")) &&
+ (strncasecmp(name_data, "meta", name_len) == 0)) {
/* Don't emit close tags for META elements */
if (event_type == EVENT_LEAVE) {
process = false;
@@ -865,7 +877,8 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
/* Elide meta charsets */
dom_string *value;
error = dom_element_get_attribute(node,
- corestring_dom_http_equiv, &value);
+ corestring_dom_http_equiv,
+ &value);
if (error != DOM_NO_ERR) {
dom_string_unref(name);
return false;
@@ -907,8 +920,9 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
}
fputc('<', ctx->fp);
- if (event_type == EVENT_LEAVE)
+ if (event_type == EVENT_LEAVE) {
fputc('/', ctx->fp);
+ }
fwrite(name_data, sizeof(*name_data), name_len, ctx->fp);
if (event_type == EVENT_ENTER) {
@@ -978,8 +992,10 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
return true;
}
-static bool save_complete_node_handler(dom_node *node,
- save_complete_event_type event_type, void *ctxin)
+static bool
+save_complete_node_handler(dom_node *node,
+ save_complete_event_type event_type,
+ void *ctxin)
{
save_complete_ctx *ctx = ctxin;
dom_node_type type;
@@ -1097,8 +1113,10 @@ static bool save_complete_node_handler(dom_node *node,
return true;
}
-static bool save_complete_save_html_document(save_complete_ctx *ctx,
- hlcache_handle *c, bool index)
+static bool
+save_complete_save_html_document(save_complete_ctx *ctx,
+ hlcache_handle *c,
+ bool index)
{
nserror ret;
FILE *fp;
@@ -1133,8 +1151,9 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx,
doc = html_get_document(c);
- if (save_complete_libdom_treewalk((dom_node *) doc,
- save_complete_node_handler, ctx) == false) {
+ if (save_complete_libdom_treewalk((dom_node *)doc,
+ save_complete_node_handler,
+ ctx) == false) {
free(fname);
guit->misc->warning("NoMemory", 0);
fclose(fp);
@@ -1163,8 +1182,10 @@ static bool save_complete_save_html_document(save_complete_ctx *ctx,
* \param index true to save as "index"
* \return true on success, false on error and error reported
*/
-static bool save_complete_save_html(save_complete_ctx *ctx, hlcache_handle *c,
- bool index)
+static bool
+save_complete_save_html(save_complete_ctx *ctx,
+ hlcache_handle *c,
+ bool index)
{
if (content_get_type(c) != CONTENT_HTML)
return false;
@@ -1271,6 +1292,13 @@ void save_complete_init(void)
}
/* Documented in save_complete.h */
+nserror save_complete_finalise(void)
+{
+ regfree(&save_complete_import_re);
+ return NSERROR_OK;
+}
+
+/* Documented in save_complete.h */
bool
save_complete(hlcache_handle *c,
const char *path,
diff --git a/desktop/save_complete.h b/desktop/save_complete.h
index 3c389a5..f7f2507 100644
--- a/desktop/save_complete.h
+++ b/desktop/save_complete.h
@@ -44,6 +44,12 @@ typedef void (*save_complete_set_type_cb)(const char *path,
*/
void save_complete_init(void);
+
+/**
+ * Finalise save complete module.
+ */
+nserror save_complete_finalise(void);
+
/**
* Save an HTML page with all dependencies.
*
diff --git a/frontends/gtk/gui.c b/frontends/gtk/gui.c
index f14c7bd..ea8d77a 100644
--- a/frontends/gtk/gui.c
+++ b/frontends/gtk/gui.c
@@ -543,6 +543,12 @@ static void gui_quit(void)
messages_get_errorcode(res));
}
+ res = save_complete_finalise();
+ if (res != NSERROR_OK) {
+ NSLOG(netsurf, INFO, "Error finalising save complete: %s",
+ messages_get_errorcode(res));
+ }
+
free(nsgtk_config_home);
gtk_fetch_filetype_fin();
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-278-gd0359bc
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/d0359bc95723538407436...
...commit http://git.netsurf-browser.org/netsurf.git/commit/d0359bc957235384074363e...
...tree http://git.netsurf-browser.org/netsurf.git/tree/d0359bc957235384074363eb0...
The branch, master has been updated
via d0359bc957235384074363eb04f673be7195cd9e (commit)
from a5766db2b9516dbf02cf2d023d777aef4e0470c1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=d0359bc957235384074...
commit d0359bc957235384074363eb04f673be7195cd9e
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
fix save_complete usage of posix regex so it does not run off the end of strings
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 6081e62..6cbefd6 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -189,6 +189,35 @@ save_complete_save_buffer(save_complete_ctx *ctx,
return true;
}
+
+/**
+ * perform a posix regexec on a string without a null terminator
+ */
+static int
+snregexec(const regex_t *preg,
+ const char *string,
+ size_t stringlen,
+ size_t nmatch,
+ regmatch_t pmatch[],
+ int eflags)
+{
+ char *strbuf;
+ int matches;
+
+ strbuf = calloc(1, stringlen + 1);
+ if (strbuf == NULL) {
+ return -1;
+ }
+ memcpy(strbuf, string, stringlen);
+
+ matches = regexec(preg, strbuf, nmatch, pmatch, eflags);
+
+ free(strbuf);
+
+ return matches;
+}
+
+
/**
* Rewrite stylesheet \@import rules for save complete.
*
@@ -239,11 +268,14 @@ save_complete_rewrite_stylesheet_urls(save_complete_ctx *ctx,
int import_url_len = 0;
nsurl *url = NULL;
regmatch_t match[11];
- int m = regexec(&save_complete_import_re,
- (const char *)source + offset,
- 11,
- match,
- 0);
+ int m;
+
+ m = snregexec(&save_complete_import_re,
+ (const char *)source + offset,
+ size - offset,
+ 11,
+ match,
+ 0);
if (m)
break;
@@ -453,7 +485,7 @@ save_complete_save_html_object(save_complete_ctx *ctx, hlcache_handle *obj)
if (type == NULL)
return false;
- result = save_complete_save_buffer(ctx, filename,
+ result = save_complete_save_buffer(ctx, filename,
obj_data, obj_size, type);
lwc_string_unref(type);
@@ -658,7 +690,7 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
* 4) background any (except those above)
*/
/* 1 */
- if (name_len == SLEN("data") &&
+ if (name_len == SLEN("data") &&
strncasecmp(name_data, "data", name_len) == 0) {
if (node_len == SLEN("object") &&
strncasecmp(node_data,
@@ -673,13 +705,13 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
/* 2 */
else if (name_len == SLEN("href") &&
strncasecmp(name_data, "href", name_len) == 0) {
- if ((node_len == SLEN("a") &&
+ if ((node_len == SLEN("a") &&
strncasecmp(node_data, "a", node_len) == 0) ||
(node_len == SLEN("area") &&
- strncasecmp(node_data, "area",
+ strncasecmp(node_data, "area",
node_len) == 0) ||
- (node_len == SLEN("link") &&
- strncasecmp(node_data, "link",
+ (node_len == SLEN("link") &&
+ strncasecmp(node_data, "link",
node_len) == 0)) {
return save_complete_rewrite_url_value(ctx,
value_data, value_len);
@@ -687,7 +719,7 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
return save_complete_write_value(ctx,
value_data, value_len);
}
- }
+ }
/* 3 */
else if (name_len == SLEN("src") &&
strncasecmp(name_data, "src", name_len) == 0) {
@@ -754,7 +786,7 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
if (value != NULL) {
fputc('=', ctx->fp);
- if (save_complete_handle_attr_value(ctx, node_name,
+ if (save_complete_handle_attr_value(ctx, node_name,
name, value) == false) {
dom_string_unref(value);
dom_string_unref(name);
@@ -824,7 +856,7 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
strncasecmp(name_data, "base", name_len) == 0) {
/* Elide BASE elements from the output */
process = false;
- } else if (name_len == SLEN("meta") &&
+ } else if (name_len == SLEN("meta") &&
strncasecmp(name_data, "meta", name_len) == 0) {
/* Don't emit close tags for META elements */
if (event_type == EVENT_LEAVE) {
@@ -862,8 +894,8 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
process = false;
}
}
- } else if (event_type == EVENT_LEAVE &&
- ((name_len == SLEN("link") &&
+ } else if (event_type == EVENT_LEAVE &&
+ ((name_len == SLEN("link") &&
strncasecmp(name_data, "link", name_len) == 0))) {
/* Don't emit close tags for void elements */
process = false;
@@ -989,7 +1021,7 @@ static bool save_complete_node_handler(dom_node *node,
if (ret != NSERROR_OK)
return false;
- fwrite(escaped, sizeof(*escaped),
+ fwrite(escaped, sizeof(*escaped),
strlen(escaped), ctx->fp);
free(escaped);
@@ -1175,7 +1207,7 @@ static bool save_complete_inventory(save_complete_ctx *ctx)
}
for (entry = ctx->list; entry != NULL; entry = entry->next) {
- fprintf(fp, "%p %s\n", entry->content,
+ fprintf(fp, "%p %s\n", entry->content,
nsurl_access(hlcache_handle_get_url(
entry->content)));
}
@@ -1239,14 +1271,16 @@ void save_complete_init(void)
}
/* Documented in save_complete.h */
-bool save_complete(hlcache_handle *c, const char *path,
- save_complete_set_type_cb set_type)
+bool
+save_complete(hlcache_handle *c,
+ const char *path,
+ save_complete_set_type_cb set_type)
{
bool result;
save_complete_ctx ctx;
save_complete_ctx_initialise(&ctx, path, set_type);
-
+
result = save_complete_save_html(&ctx, c, true);
if (result) {
@@ -1257,4 +1291,3 @@ bool save_complete(hlcache_handle *c, const char *path,
return result;
}
-
-----------------------------------------------------------------------
Summary of changes:
desktop/save_complete.c | 77 +++++++++++++++++++++++++++++++++--------------
1 file changed, 55 insertions(+), 22 deletions(-)
diff --git a/desktop/save_complete.c b/desktop/save_complete.c
index 6081e62..6cbefd6 100644
--- a/desktop/save_complete.c
+++ b/desktop/save_complete.c
@@ -189,6 +189,35 @@ save_complete_save_buffer(save_complete_ctx *ctx,
return true;
}
+
+/**
+ * perform a posix regexec on a string without a null terminator
+ */
+static int
+snregexec(const regex_t *preg,
+ const char *string,
+ size_t stringlen,
+ size_t nmatch,
+ regmatch_t pmatch[],
+ int eflags)
+{
+ char *strbuf;
+ int matches;
+
+ strbuf = calloc(1, stringlen + 1);
+ if (strbuf == NULL) {
+ return -1;
+ }
+ memcpy(strbuf, string, stringlen);
+
+ matches = regexec(preg, strbuf, nmatch, pmatch, eflags);
+
+ free(strbuf);
+
+ return matches;
+}
+
+
/**
* Rewrite stylesheet \@import rules for save complete.
*
@@ -239,11 +268,14 @@ save_complete_rewrite_stylesheet_urls(save_complete_ctx *ctx,
int import_url_len = 0;
nsurl *url = NULL;
regmatch_t match[11];
- int m = regexec(&save_complete_import_re,
- (const char *)source + offset,
- 11,
- match,
- 0);
+ int m;
+
+ m = snregexec(&save_complete_import_re,
+ (const char *)source + offset,
+ size - offset,
+ 11,
+ match,
+ 0);
if (m)
break;
@@ -453,7 +485,7 @@ save_complete_save_html_object(save_complete_ctx *ctx, hlcache_handle *obj)
if (type == NULL)
return false;
- result = save_complete_save_buffer(ctx, filename,
+ result = save_complete_save_buffer(ctx, filename,
obj_data, obj_size, type);
lwc_string_unref(type);
@@ -658,7 +690,7 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
* 4) background any (except those above)
*/
/* 1 */
- if (name_len == SLEN("data") &&
+ if (name_len == SLEN("data") &&
strncasecmp(name_data, "data", name_len) == 0) {
if (node_len == SLEN("object") &&
strncasecmp(node_data,
@@ -673,13 +705,13 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
/* 2 */
else if (name_len == SLEN("href") &&
strncasecmp(name_data, "href", name_len) == 0) {
- if ((node_len == SLEN("a") &&
+ if ((node_len == SLEN("a") &&
strncasecmp(node_data, "a", node_len) == 0) ||
(node_len == SLEN("area") &&
- strncasecmp(node_data, "area",
+ strncasecmp(node_data, "area",
node_len) == 0) ||
- (node_len == SLEN("link") &&
- strncasecmp(node_data, "link",
+ (node_len == SLEN("link") &&
+ strncasecmp(node_data, "link",
node_len) == 0)) {
return save_complete_rewrite_url_value(ctx,
value_data, value_len);
@@ -687,7 +719,7 @@ static bool save_complete_handle_attr_value(save_complete_ctx *ctx,
return save_complete_write_value(ctx,
value_data, value_len);
}
- }
+ }
/* 3 */
else if (name_len == SLEN("src") &&
strncasecmp(name_data, "src", name_len) == 0) {
@@ -754,7 +786,7 @@ static bool save_complete_handle_attr(save_complete_ctx *ctx,
if (value != NULL) {
fputc('=', ctx->fp);
- if (save_complete_handle_attr_value(ctx, node_name,
+ if (save_complete_handle_attr_value(ctx, node_name,
name, value) == false) {
dom_string_unref(value);
dom_string_unref(name);
@@ -824,7 +856,7 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
strncasecmp(name_data, "base", name_len) == 0) {
/* Elide BASE elements from the output */
process = false;
- } else if (name_len == SLEN("meta") &&
+ } else if (name_len == SLEN("meta") &&
strncasecmp(name_data, "meta", name_len) == 0) {
/* Don't emit close tags for META elements */
if (event_type == EVENT_LEAVE) {
@@ -862,8 +894,8 @@ static bool save_complete_handle_element(save_complete_ctx *ctx,
process = false;
}
}
- } else if (event_type == EVENT_LEAVE &&
- ((name_len == SLEN("link") &&
+ } else if (event_type == EVENT_LEAVE &&
+ ((name_len == SLEN("link") &&
strncasecmp(name_data, "link", name_len) == 0))) {
/* Don't emit close tags for void elements */
process = false;
@@ -989,7 +1021,7 @@ static bool save_complete_node_handler(dom_node *node,
if (ret != NSERROR_OK)
return false;
- fwrite(escaped, sizeof(*escaped),
+ fwrite(escaped, sizeof(*escaped),
strlen(escaped), ctx->fp);
free(escaped);
@@ -1175,7 +1207,7 @@ static bool save_complete_inventory(save_complete_ctx *ctx)
}
for (entry = ctx->list; entry != NULL; entry = entry->next) {
- fprintf(fp, "%p %s\n", entry->content,
+ fprintf(fp, "%p %s\n", entry->content,
nsurl_access(hlcache_handle_get_url(
entry->content)));
}
@@ -1239,14 +1271,16 @@ void save_complete_init(void)
}
/* Documented in save_complete.h */
-bool save_complete(hlcache_handle *c, const char *path,
- save_complete_set_type_cb set_type)
+bool
+save_complete(hlcache_handle *c,
+ const char *path,
+ save_complete_set_type_cb set_type)
{
bool result;
save_complete_ctx ctx;
save_complete_ctx_initialise(&ctx, path, set_type);
-
+
result = save_complete_save_html(&ctx, c, true);
if (result) {
@@ -1257,4 +1291,3 @@ bool save_complete(hlcache_handle *c, const char *path,
return result;
}
-
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-277-ga5766db
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/a5766db2b9516dbf02cf2...
...commit http://git.netsurf-browser.org/netsurf.git/commit/a5766db2b9516dbf02cf2d0...
...tree http://git.netsurf-browser.org/netsurf.git/tree/a5766db2b9516dbf02cf2d023...
The branch, master has been updated
via a5766db2b9516dbf02cf2d023d777aef4e0470c1 (commit)
from 813d0c70fe06090256b09356869f07e238c986a1 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=a5766db2b9516dbf02c...
commit a5766db2b9516dbf02cf2d023d777aef4e0470c1
Author: Daniel Silverstone <dsilvers(a)digital-scurf.org>
Commit: Daniel Silverstone <dsilvers(a)digital-scurf.org>
fetchers/curl: Restrict AUTH to BASIC
cURL will prevent channel reuse if NTLM auth is enabled because
NTLM authenticates a channel not a request. As such we were
unable to reuse curl handles since we handed off connection
reuse to curl instead of our own handle cache. This mitigates
the effect, though curl authors are looking at fixing it upstream
too.
Fixes: #2707
Signed-off-by: Daniel Silverstone <dsilvers(a)digital-scurf.org>
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index f24e3de..2644c68 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -840,7 +840,7 @@ static CURLcode fetch_curl_set_options(struct curl_fetch_info *f)
}
if ((auth = urldb_get_auth_details(f->url, NULL)) != NULL) {
- SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
SETOPT(CURLOPT_USERPWD, auth);
} else {
SETOPT(CURLOPT_USERPWD, NULL);
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/curl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/content/fetchers/curl.c b/content/fetchers/curl.c
index f24e3de..2644c68 100644
--- a/content/fetchers/curl.c
+++ b/content/fetchers/curl.c
@@ -840,7 +840,7 @@ static CURLcode fetch_curl_set_options(struct curl_fetch_info *f)
}
if ((auth = urldb_get_auth_details(f->url, NULL)) != NULL) {
- SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_ANY);
+ SETOPT(CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
SETOPT(CURLOPT_USERPWD, auth);
} else {
SETOPT(CURLOPT_USERPWD, NULL);
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-276-g813d0c7
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/813d0c70fe06090256b09...
...commit http://git.netsurf-browser.org/netsurf.git/commit/813d0c70fe06090256b0935...
...tree http://git.netsurf-browser.org/netsurf.git/tree/813d0c70fe06090256b093568...
The branch, master has been updated
via 813d0c70fe06090256b09356869f07e238c986a1 (commit)
from 640ee36cff442f4dcb8c193ba6bc009c76f4e5bb (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=813d0c70fe06090256b...
commit 813d0c70fe06090256b09356869f07e238c986a1
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
another attempt to provide strtoull on amiga os 3
diff --git a/utils/utils.c b/utils/utils.c
index bce406d..c647185 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -290,7 +290,7 @@ char *human_friendly_bytesize(unsigned long long int bsize) {
* string to unsigned long long
*
*/
-unsigned long long int _strtoull(const char *nptr, char **endptr, int base)
+unsigned long long int strtoull(const char *nptr, char **endptr, int base)
{
return (unsigned long long int)strtoul(nptr, endptr, base);
}
-----------------------------------------------------------------------
Summary of changes:
utils/utils.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/utils.c b/utils/utils.c
index bce406d..c647185 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -290,7 +290,7 @@ char *human_friendly_bytesize(unsigned long long int bsize) {
* string to unsigned long long
*
*/
-unsigned long long int _strtoull(const char *nptr, char **endptr, int base)
+unsigned long long int strtoull(const char *nptr, char **endptr, int base)
{
return (unsigned long long int)strtoul(nptr, endptr, base);
}
--
NetSurf Browser
3 years, 11 months
netsurf: branch master updated. release/3.9-274-g67c1c65
by NetSurf Browser Project
Gitweb links:
...log http://git.netsurf-browser.org/netsurf.git/shortlog/67c1c65bf2ef7752c0365...
...commit http://git.netsurf-browser.org/netsurf.git/commit/67c1c65bf2ef7752c036563...
...tree http://git.netsurf-browser.org/netsurf.git/tree/67c1c65bf2ef7752c036563e4...
The branch, master has been updated
via 67c1c65bf2ef7752c036563e4dda4bea064569b2 (commit)
from 51c2d48096f8f53583422113508912b3243c48f0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff http://git.netsurf-browser.org/netsurf.git/commit/?id=67c1c65bf2ef7752c03...
commit 67c1c65bf2ef7752c036563e4dda4bea064569b2
Author: Vincent Sanders <vince(a)kyllikki.org>
Commit: Vincent Sanders <vince(a)kyllikki.org>
attempt a different fix for amiga os 3 strtoull
diff --git a/utils/config.h b/utils/config.h
index 5678bea..a87f19b 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -67,6 +67,14 @@ char *strcasestr(const char *haystack, const char *needle);
char *strchrnul(const char *s, int c);
#endif
+/*
+ * amigaos3 declares this but does not have it in its actual library
+ */
+#define HAVE_STRTOULL
+#if !defined(__amigaos4__) && defined(__AMIGA__)
+#undef HAVE_STRTOULL
+#endif
+
#define HAVE_SYS_SELECT
#define HAVE_POSIX_INET_HEADERS
#if (defined(_WIN32))
diff --git a/utils/utils.c b/utils/utils.c
index c5c1529..b260f37 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -283,6 +283,19 @@ char *human_friendly_bytesize(unsigned long long int bsize) {
}
+#ifndef HAVE_STRTOULL
+/**
+ * string to unsigned long long
+ *
+ */
+unsigned long long int _strtoull(const char *nptr, char **endptr, int base)
+{
+ return (unsigned long long int)strtoul(nptr, endptr, base);
+}
+
+#endif
+
+
#ifndef HAVE_STRCASESTR
/**
diff --git a/utils/utils.h b/utils/utils.h
index 31a86c6..3995071 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -75,10 +75,6 @@
#define ceilf(x) (float)ceil((double)x)
#endif
-#if !defined(__amigaos4__) && defined(__AMIGA__)
-#define strtoull(n,e,b) (unsigned long long int)strtoul(n,e,b)
-#endif
-
/**
* Calculate length of constant C string.
*
-----------------------------------------------------------------------
Summary of changes:
utils/config.h | 8 ++++++++
utils/utils.c | 13 +++++++++++++
utils/utils.h | 4 ----
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/utils/config.h b/utils/config.h
index 5678bea..a87f19b 100644
--- a/utils/config.h
+++ b/utils/config.h
@@ -67,6 +67,14 @@ char *strcasestr(const char *haystack, const char *needle);
char *strchrnul(const char *s, int c);
#endif
+/*
+ * amigaos3 declares this but does not have it in its actual library
+ */
+#define HAVE_STRTOULL
+#if !defined(__amigaos4__) && defined(__AMIGA__)
+#undef HAVE_STRTOULL
+#endif
+
#define HAVE_SYS_SELECT
#define HAVE_POSIX_INET_HEADERS
#if (defined(_WIN32))
diff --git a/utils/utils.c b/utils/utils.c
index c5c1529..b260f37 100644
--- a/utils/utils.c
+++ b/utils/utils.c
@@ -283,6 +283,19 @@ char *human_friendly_bytesize(unsigned long long int bsize) {
}
+#ifndef HAVE_STRTOULL
+/**
+ * string to unsigned long long
+ *
+ */
+unsigned long long int _strtoull(const char *nptr, char **endptr, int base)
+{
+ return (unsigned long long int)strtoul(nptr, endptr, base);
+}
+
+#endif
+
+
#ifndef HAVE_STRCASESTR
/**
diff --git a/utils/utils.h b/utils/utils.h
index 31a86c6..3995071 100644
--- a/utils/utils.h
+++ b/utils/utils.h
@@ -75,10 +75,6 @@
#define ceilf(x) (float)ceil((double)x)
#endif
-#if !defined(__amigaos4__) && defined(__AMIGA__)
-#define strtoull(n,e,b) (unsigned long long int)strtoul(n,e,b)
-#endif
-
/**
* Calculate length of constant C string.
*
--
NetSurf Browser
3 years, 11 months