diff --git a/content/fetchers/about/about.c b/content/fetchers/about/about.c index 651894249..db7038b7b 100644 --- a/content/fetchers/about/about.c +++ b/content/fetchers/about/about.c @@ -40,6 +40,7 @@ #include "utils/corestrings.h" #include "utils/utils.h" #include "utils/ring.h" +#include "utils/messages.h" #include "content/fetch.h" #include "content/fetchers.h" @@ -242,7 +243,9 @@ bool fetch_about_srverror(struct fetch_about_context *ctx) if (fetch_about_send_header(ctx, "Content-Type: text/plain")) return false; - res = fetch_about_ssenddataf(ctx, "Server error 500"); + res = fetch_about_ssenddataf(ctx, "%s 500 %s", + messages_get("FetchErrorCode"), + messages_get("HTTP500")); if (res != NSERROR_OK) { return false; } @@ -498,7 +501,7 @@ static bool fetch_about_about_handler(struct fetch_about_context *ctx) fetch_set_http_code(ctx->fetchh, 200); /* content type */ - if (fetch_about_send_header(ctx, "Content-Type: text/html")) + if (fetch_about_send_header(ctx, "Content-Type: text/html; charset=utf-8")) goto fetch_about_config_handler_aborted; res = fetch_about_ssenddataf(ctx, @@ -546,16 +549,30 @@ static bool fetch_about_404_handler(struct fetch_about_context *ctx) { nserror res; + const char *title; /* 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")) { + if (fetch_about_send_header(ctx, + "Content-Type: text/html; charset=utf-8")) { return false; } - res = fetch_about_ssenddataf(ctx, "Unknown page: %s", nsurl_access(ctx->url)); + title = messages_get("HTTP404"); + res = fetch_about_ssenddataf(ctx, + "\n\n" + "%s\n" + "\n" + "\n" + "\n" + "

%s

\n" + "

%s %d %s %s

\n" + "\n\n", + title, title, messages_get("FetchErrorCode"), 404, + messages_get("FetchFile"),nsurl_access(ctx->url)); if (res != NSERROR_OK) { return false; } diff --git a/content/fetchers/file/file.c b/content/fetchers/file/file.c index ff3a1b1f6..c17f92987 100644 --- a/content/fetchers/file/file.c +++ b/content/fetchers/file/file.c @@ -243,16 +243,26 @@ static void fetch_file_process_error(struct fetch_file_context *ctx, int code) fetch_set_http_code(ctx->fetchh, code); /* content type */ - if (fetch_file_send_header(ctx, "Content-Type: text/html")) + if (fetch_file_send_header(ctx, "Content-Type: text/html; charset=utf-8")) goto fetch_file_process_error_aborted; snprintf(key, sizeof key, "HTTP%03d", code); title = messages_get(key); - snprintf(buffer, sizeof buffer, "%s" - "

%s

" - "

Error %d while fetching file %s

", - title, title, code, nsurl_access(ctx->url)); + snprintf(buffer, sizeof buffer, + "" + "%s" + "\n" + "" + "\n" + "

%s

\n" + "

%s %d %s %s

\n" + "\n\n", + title, title, + messages_get("FetchErrorCode"), code, + messages_get("FetchFile"), nsurl_access(ctx->url)); msg.type = FETCH_DATA; msg.data.header_or_data.buf = (const uint8_t *) buffer; @@ -681,7 +691,7 @@ static void fetch_file_process_dir(struct fetch_file_context *ctx, goto fetch_file_process_dir_aborted; /* content type */ - if (fetch_file_send_header(ctx, "Content-Type: text/html")) + if (fetch_file_send_header(ctx, "Content-Type: text/html; charset=utf-8")) goto fetch_file_process_dir_aborted; msg.type = FETCH_DATA; diff --git a/content/fetchers/resource.c b/content/fetchers/resource.c index c8176f34b..360d4e0c1 100644 --- a/content/fetchers/resource.c +++ b/content/fetchers/resource.c @@ -229,16 +229,26 @@ static bool fetch_resource_notfound_handler(struct fetch_resource_context *ctx) fetch_set_http_code(ctx->fetchh, code); /* content type */ - if (fetch_resource_send_header(ctx, "Content-Type: text/html")) + if (fetch_resource_send_header(ctx, "Content-Type: text/html; charset=utf-8")) goto fetch_resource_notfound_handler_aborted; snprintf(key, sizeof key, "HTTP%03d", code); title = messages_get(key); - snprintf(buffer, sizeof buffer, "%s" - "

%s

" - "

Error %d while fetching file %s

", - title, title, code, nsurl_access(ctx->url)); + snprintf(buffer, sizeof buffer, + "" + "%s" + "\n" + "" + "\n" + "

%s

\n" + "

%s %d %s %s

\n" + "\n\n", + title, title, + messages_get("FetchErrorCode"), code, + messages_get("FetchFile"), nsurl_access(ctx->url)); msg.type = FETCH_DATA; msg.data.header_or_data.buf = (const uint8_t *) buffer; diff --git a/resources/FatMessages b/resources/FatMessages index bda91910a..7825cb395 100644 --- a/resources/FatMessages +++ b/resources/FatMessages @@ -1560,17 +1560,26 @@ zh_CN.all.TryAgain:重试 # ======================= # en.all.FetchErrorTitle:Error occurred fetching page +fr.all.FetchErrorTitle:Problème rencontré lors de la récupération de la page it.all.FetchErrorTitle:Errore durante il recupero della pagina zh_CN.all.FetchErrorTitle:获取页面时发生错误 en.all.FetchErrorDescription:An error occurred when connecting to %s +fr.all.FetchErrorDescription:Une erreur s'est produite lors de la connexion à %s it.all.FetchErrorDescription:Si è verificato un errore durante la connessione a %s zh_CN.all.FetchErrorDescription:连接到 %s 时发生错误 # Generic fetcher failure (really a programming error) -en.all.FetchFailedToFinish:The fetcher for this request failed to complete +en.all.FetchFailedToFinish:The fetch for this request failed to complete +fr.all.FetchFailedToFinish:La recherche de cette requête n’a pas réussi zh_CN.all.FetchFailedToFinish:无法完成此请求的提取程序 +en.all.FetchErrorCode:Error code +fr.all.FetchErrorCode:Code d'erreur + +en.all.FetchFile:fetching file +fr.all.FetchFile:récupérer le fichier + # SSL certificate viewer # ======================