From f0b7955d3d31ca825ff0717e2cf4d087fc925226 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 28 Sep 2020 00:03:18 +0100 Subject: split out about scheme query timeout page --- content/fetchers/about/about.c | 121 +---------------------------------------- 1 file changed, 1 insertion(+), 120 deletions(-) (limited to 'content/fetchers/about/about.c') diff --git a/content/fetchers/about/about.c b/content/fetchers/about/about.c index 9f1b3e9cc..d1547ae13 100644 --- a/content/fetchers/about/about.c +++ b/content/fetchers/about/about.c @@ -57,6 +57,7 @@ #include "query.h" #include "query_auth.h" #include "query_privacy.h" +#include "query_timeout.h" #include "atestament.h" typedef bool (*fetch_about_handler)(struct fetch_about_context *); @@ -385,126 +386,6 @@ static bool fetch_about_welcome_handler(struct fetch_about_context *ctx) } -/** - * 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 = fetch_about_ssenddataf(ctx, - "\n\n" - "%s\n" - "\n" - "\n" - "\n" - "

%s

\n", - title, title); - if (res != NSERROR_OK) { - goto fetch_about_query_timeout_handler_aborted; - } - - res = fetch_about_ssenddataf(ctx, - "
"); - if (res != NSERROR_OK) { - goto fetch_about_query_timeout_handler_aborted; - } - - res = get_query_description(siteurl, - "TimeoutDescription", - &description); - if (res == NSERROR_OK) { - res = fetch_about_ssenddataf(ctx, "

%s

", description); - free(description); - if (res != NSERROR_OK) { - goto fetch_about_query_timeout_handler_aborted; - } - } - res = fetch_about_ssenddataf(ctx, "

%s

", reason); - if (res != NSERROR_OK) { - goto fetch_about_query_timeout_handler_aborted; - } - - res = fetch_about_ssenddataf(ctx, - "
" - "" - "" - "
", - 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 = fetch_about_ssenddataf(ctx, - "", - url_s); - free(url_s); - if (res != NSERROR_OK) { - goto fetch_about_query_timeout_handler_aborted; - } - - res = fetch_about_ssenddataf(ctx, "
\n\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; -} /** -- cgit v1.2.3