projects
/
project
/
uhttpd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix 404 and 403 error handling, improve error message output
[project/uhttpd.git]
/
client.c
diff --git
a/client.c
b/client.c
index
9e387c7
..
e1c8c55
100644
(file)
--- 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);
}
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;
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;
{
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_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);
}
uh_connection_close(cl);
}