Fix the default HTTP error template
authorFelix Nawothnig <felix.nawothnig@googlemail.com>
Wed, 26 May 2010 16:50:59 +0000 (12:50 -0400)
committerNick Mathewson <nickm@torproject.org>
Wed, 26 May 2010 17:43:01 +0000 (13:43 -0400)
commit06bd05634d2f1d098b81859c7b7309a5a4b4a746
tree7504455d05c61b6f0f4d2115dfe407ffedb303e8
parent3689bd2d497d8af224532282c263581ea47b6db5
Fix the default HTTP error template

The current template...

<HTML><HEAD><TITLE>%s</TITLE>
</HEAD><BODY>
<H1>Method Not Implemented</H1>
Invalid method in request<P>
</BODY></HTML>

is highly confusing. The given title is easily overlooked and the
hard-coded content is just plain wrong in most cases (I really read
this as "the server did not understand the requested HTTP method)

This patch changes the template to include the error reason in the
body as well as in the header, and to infer the proper reason from
the status code whenever the reason argument is NULL.

This patch also removes a redundant evhttp_add_header from
evhttp_send_error; evhttp_send_page already adds a "Connection:
close" header.
http.c
include/event2/http.h