]> granicus.if.org Git - libevent/commitdiff
deal correctly with http/1.0 and keep-alive
authorNiels Provos <provos@gmail.com>
Tue, 26 Feb 2008 03:29:36 +0000 (03:29 +0000)
committerNiels Provos <provos@gmail.com>
Tue, 26 Feb 2008 03:29:36 +0000 (03:29 +0000)
svn:r667

ChangeLog
http.c

index 2569f08c93efa427281241a0b8722dec62bb7f1f..cc123f35f59a4254ae923b774f3e216ffa2f4945 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -49,6 +49,7 @@ Changes in current version:
  o do not insert event into list when evsel->add fails
  o add support for PUT/DELETE requests; from Josh Rotenberg
  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:
diff --git a/http.c b/http.c
index dccb373e544e8d89bc58843d61798e2a6a3ae578..e2e5aeb3c62d93c34c10eb558ca53d10c3a15031 100644 (file)
--- a/http.c
+++ b/http.c
@@ -406,9 +406,12 @@ evhttp_make_header_response(struct evhttp_connection *evcon,
            req->response_code_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);
 
+       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
                 * not give it, this is required for persistent