summaryrefslogtreecommitdiff
path: root/client.c
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2012-12-31 18:29:35 +0100
committerFelix Fietkau <nbd@openwrt.org>2012-12-31 18:29:35 +0100
commitc1bb6177e79b6ad139bb8cbe37c598937c406263 (patch)
treefa22a70ea3adf1a24678f1579629ac9dcc22c1f2 /client.c
parent98a231f91d7731d4f13ea9e4c4f568e42349faa2 (diff)
fix 404 and 403 error handling, improve error message output
Diffstat (limited to 'client.c')
-rw-r--r--client.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/client.c b/client.c
index 9e387c7..e1c8c55 100644
--- a/client.c
+++ b/client.c
@@ -51,12 +51,6 @@ void uh_http_header(struct client *cl, int code, const char *summary)
code, summary, conn, enc);
}
-static void uh_client_error_header(struct client *cl, int code, const char *summary)
-{
- uh_http_header(cl, code, summary);
- ustream_printf(cl->us, "Content-Type: text/plain\r\n\r\n");
-}
-
static void uh_connection_close(struct client *cl)
{
cl->state = CLIENT_STATE_DONE;
@@ -92,18 +86,23 @@ uh_client_error(struct client *cl, int code, const char *summary, const char *fm
{
va_list arg;
- uh_client_error_header(cl, code, summary);
+ uh_http_header(cl, code, summary);
+ ustream_printf(cl->us, "Content-Type: text/html\r\n\r\n");
+
+ uh_chunk_printf(cl, "<h1>%s</h1>", summary);
- va_start(arg, fmt);
- uh_chunk_vprintf(cl, fmt, arg);
- va_end(arg);
+ if (fmt) {
+ va_start(arg, fmt);
+ uh_chunk_vprintf(cl, fmt, arg);
+ va_end(arg);
+ }
uh_request_done(cl);
}
static void uh_header_error(struct client *cl, int code, const char *summary)
{
- uh_client_error(cl, code, summary, "%s", summary);
+ uh_client_error(cl, code, summary, NULL);
uh_connection_close(cl);
}