X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuhttpd.git;a=blobdiff_plain;f=client.c;h=e1c8c55d453aeb4718b1c5a851276523fadb5ce7;hp=9e387c7f4a27b104f2d881ae568a554a564dccaa;hb=c1bb6177e79b6ad139bb8cbe37c598937c406263;hpb=30fff08a44094df9b775f2e4bf9f5abceb847415 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, "

%s

", 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); }