From d26cb753310a9780b6760f57e5370df32c439d57 Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Mon, 12 Jan 2026 18:31:31 -0800 Subject: [PATCH] file cache seems done --- gex_httpd/priv/404.html | 11 ----------- gex_httpd/priv/500.html | 11 ----------- gex_httpd/src/gh_client.erl | 32 ++++++++++++++++++++++++++++---- 3 files changed, 28 insertions(+), 26 deletions(-) delete mode 100644 gex_httpd/priv/404.html delete mode 100644 gex_httpd/priv/500.html diff --git a/gex_httpd/priv/404.html b/gex_httpd/priv/404.html deleted file mode 100644 index bfb09f3..0000000 --- a/gex_httpd/priv/404.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - QHL: 404 - - - -

404 Not Found

- - diff --git a/gex_httpd/priv/500.html b/gex_httpd/priv/500.html deleted file mode 100644 index 19d2057..0000000 --- a/gex_httpd/priv/500.html +++ /dev/null @@ -1,11 +0,0 @@ - - - - - QHL: 500 - - - -

500 Internal Server Error

- - diff --git a/gex_httpd/src/gh_client.erl b/gex_httpd/src/gh_client.erl index 9cc7292..3fd9a20 100644 --- a/gex_httpd/src/gh_client.erl +++ b/gex_httpd/src/gh_client.erl @@ -283,8 +283,7 @@ handle_entry(Socket, Entry) -> respond(Socket, Response). http_err(Socket, 404) -> - HtmlPath = filename:join([zx:get_home(), "priv", "404.html"]), - {ok, ResponseBody} = file:read_file(HtmlPath), + ResponseBody = bdy_404(), Headers = [{"content-type", "text/html"}], Response = #response{headers = Headers, code = 404, @@ -292,8 +291,7 @@ http_err(Socket, 404) -> respond(Socket, Response); % default error is 500 http_err(Socket, _) -> - HtmlPath = filename:join([zx:get_home(), "priv", "500.html"]), - {ok, ResponseBody} = file:read_file(HtmlPath), + ResponseBody = bdy_500(), Headers = [{"content-type", "text/html"}], Response = #response{headers = Headers, code = 500, @@ -301,6 +299,32 @@ http_err(Socket, _) -> respond(Socket, Response). +bdy_404() -> + ["" + "" + "" + "" + "QHL: 404" + "" + "" + "

404 Not Found

" + "" + ""]. + + +bdy_500() -> + ["" + "" + "" + "" + "QHL: 500 Internal Server Error" + "" + "" + "

500 Internal Server Error

" + "" + ""]. + + respond(Socket, R = #response{code = Code, headers = Headers, body = Body}) -> Slogan = slogan(Code), BodyBytes = iolist_to_binary(Body),