Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/4cbdcc4aae940065d027157c1bce2dbfc7d59c3b
...commit
http://git.netsurf-browser.org/netsurf.git/commit/4cbdcc4aae940065d027157c1bce2dbfc7d59c3b
...tree
http://git.netsurf-browser.org/netsurf.git/tree/4cbdcc4aae940065d027157c1bce2dbfc7d59c3b
The branch, master has been updated
via 4cbdcc4aae940065d027157c1bce2dbfc7d59c3b (commit)
from 9014dc738114d23d9b1c819e9a832b4a3e5571d5 (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=4cbdcc4aae940065d027157c1bce2dbfc7d59c3b
commit 4cbdcc4aae940065d027157c1bce2dbfc7d59c3b
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
about: Add handling for unknown about: page
Signed-off-by: Daniel Silverstone <[email protected]>
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index aa68fd2..e553cb4 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -1792,6 +1792,28 @@ fetch_about_config_handler_aborted:
return false;
}
+static bool
+fetch_about_404_handler(struct fetch_about_context *ctx)
+{
+ nserror res;
+
+ /* content is going to return 404 */
+ fetch_set_http_code(ctx->fetchh, 404);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/plain;
charset=utf-8")) {
+ return false;
+ }
+
+ res = ssenddataf(ctx, "Unknown page: %s", nsurl_access(ctx->url));
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ return true;
+}
/**
* callback to initialise the about scheme fetcher.
@@ -1866,10 +1888,10 @@ fetch_about_setup(struct fetch *fetchh,
for (handler_loop = 0;
handler_loop < about_handler_list_len;
handler_loop++) {
- ctx->handler = about_handler_list[handler_loop].handler;
if (lwc_string_isequal(path,
about_handler_list[handler_loop].lname,
&match) == lwc_error_ok && match) {
+ ctx->handler = about_handler_list[handler_loop].handler;
break;
}
}
@@ -1949,7 +1971,11 @@ static void fetch_about_poll(lwc_string *scheme)
/* Only process non-aborted fetches */
if (c->aborted == false) {
/* about fetches can be processed in one go */
- c->handler(c);
+ if (c->handler == NULL) {
+ fetch_about_404_handler(c);
+ } else {
+ c->handler(c);
+ }
}
/* And now finish */
-----------------------------------------------------------------------
Summary of changes:
content/fetchers/about.c | 30 ++++++++++++++++++++++++++++--
1 file changed, 28 insertions(+), 2 deletions(-)
diff --git a/content/fetchers/about.c b/content/fetchers/about.c
index aa68fd2..e553cb4 100644
--- a/content/fetchers/about.c
+++ b/content/fetchers/about.c
@@ -1792,6 +1792,28 @@ fetch_about_config_handler_aborted:
return false;
}
+static bool
+fetch_about_404_handler(struct fetch_about_context *ctx)
+{
+ nserror res;
+
+ /* content is going to return 404 */
+ fetch_set_http_code(ctx->fetchh, 404);
+
+ /* content type */
+ if (fetch_about_send_header(ctx, "Content-Type: text/plain;
charset=utf-8")) {
+ return false;
+ }
+
+ res = ssenddataf(ctx, "Unknown page: %s", nsurl_access(ctx->url));
+ if (res != NSERROR_OK) {
+ return false;
+ }
+
+ fetch_about_send_finished(ctx);
+
+ return true;
+}
/**
* callback to initialise the about scheme fetcher.
@@ -1866,10 +1888,10 @@ fetch_about_setup(struct fetch *fetchh,
for (handler_loop = 0;
handler_loop < about_handler_list_len;
handler_loop++) {
- ctx->handler = about_handler_list[handler_loop].handler;
if (lwc_string_isequal(path,
about_handler_list[handler_loop].lname,
&match) == lwc_error_ok && match) {
+ ctx->handler = about_handler_list[handler_loop].handler;
break;
}
}
@@ -1949,7 +1971,11 @@ static void fetch_about_poll(lwc_string *scheme)
/* Only process non-aborted fetches */
if (c->aborted == false) {
/* about fetches can be processed in one go */
- c->handler(c);
+ if (c->handler == NULL) {
+ fetch_about_404_handler(c);
+ } else {
+ c->handler(c);
+ }
}
/* And now finish */
--
NetSurf Browser
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org