deal correctly with http/1.0 and keep-alive

svn:r667
This commit is contained in:
Niels Provos 2008-02-26 03:29:36 +00:00
parent 0b114da2b6
commit 960be58869
2 changed files with 5 additions and 1 deletions

View File

@ -49,6 +49,7 @@ Changes in current version:
o do not insert event into list when evsel->add fails o do not insert event into list when evsel->add fails
o add support for PUT/DELETE requests; from Josh Rotenberg o add support for PUT/DELETE requests; from Josh Rotenberg
o introduce evhttp_accept_socket() to accept from an already created socket o introduce evhttp_accept_socket() to accept from an already created socket
o include Content-Length in reply for HTTP/1.0 requests with keep-alive
Changes in 1.4.0: Changes in 1.4.0:

5
http.c
View File

@ -406,9 +406,12 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
req->response_code_line); req->response_code_line);
evbuffer_add(evcon->output_buffer, line, strlen(line)); evbuffer_add(evcon->output_buffer, line, strlen(line));
if (req->major == 1 && req->minor == 1) { if (req->major == 1 && req->minor == 1)
evhttp_maybe_add_date_header(req->output_headers); evhttp_maybe_add_date_header(req->output_headers);
if (req->major == 1 &&
(req->minor == 1 ||
evhttp_is_connection_keepalive(req->input_headers))) {
/* /*
* we need to add the content length if the user did * we need to add the content length if the user did
* not give it, this is required for persistent * not give it, this is required for persistent