From 7390a6805ef08ca0b043ef7b4dc0da0fb05a7e1c Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Thu, 17 Mar 2011 10:20:04 +0000 Subject: implement about:about svn path=/trunk/netsurf/; revision=12085 --- content/fetchers/about.c | 79 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'content') diff --git a/content/fetchers/about.c b/content/fetchers/about.c index 3dfea825f..053051dda 100644 --- a/content/fetchers/about.c +++ b/content/fetchers/about.c @@ -195,12 +195,12 @@ static bool fetch_about_config_handler(struct fetch_about_context *ctx) "

" "

NetSurf Browser Config

" "" - ""); + "\n"); do { res = options_snoptionf(buffer + slen, sizeof buffer - slen, opt_loop, - ""); + "\n"); if (res <= 0) break; /* last option */ @@ -381,6 +381,9 @@ fetch_about_testament_handler_aborted: return false; } +/* Forward declaration because this handler requires the handler table. */ +static bool fetch_about_about_handler(struct fetch_about_context *ctx); + struct about_handlers { const char *name; fetch_about_handler handler; @@ -393,11 +396,83 @@ struct about_handlers about_handler_list[] = { { "config", fetch_about_config_handler }, { "Choices", fetch_about_choices_handler }, { "testament", fetch_about_testament_handler }, + { "about", fetch_about_about_handler }, { "blank", fetch_about_blank_handler } /* The default */ }; #define about_handler_list_len (sizeof(about_handler_list) / sizeof(struct about_handlers)) +/** + * List all the valid about: paths available + * + * \param ctx The fetch context. + * \return true for sucess or false to generate an error. + */ +static bool fetch_about_about_handler(struct fetch_about_context *ctx) +{ + char buffer[1024]; + int code = 200; + int slen; + unsigned int abt_loop = 0; + int res = 0; + + /* content is going to return ok */ + fetch_set_http_code(ctx->fetchh, code); + + /* content type */ + if (fetch_about_send_header(ctx, "Content-Type: text/html")) + goto fetch_about_config_handler_aborted; + + slen = snprintf(buffer, sizeof buffer, + "NetSurf List of About pages" + "" + "" + "" + "

" + "" + "\"NetSurf\"" + "

" + "

NetSurf List of About pages

" + ""); + + if (fetch_about_send_callback(FETCH_DATA, ctx, buffer, slen, + FETCH_ERROR_NO_ERROR)) + goto fetch_about_config_handler_aborted; + + fetch_about_send_callback(FETCH_FINISHED, ctx, 0, 0, + FETCH_ERROR_NO_ERROR); + + return true; + +fetch_about_config_handler_aborted: + return false; +} + + /** callback to initialise the about fetcher. */ static bool fetch_about_initialise(const char *scheme) { -- cgit v1.2.3
%k%t%V
%k%t%V