Mercurial > dovecot > original-hg > dovecot-2.2
changeset 16754:ccd39339596e
lib-http: Added support for handling HTTP/1.0 messages explicitly.
This means that default connection persistence semantics are inverted for
HTTP/1.0 and keep-alive Connection option is recognized.
author | Stephan Bosch <stephan@rename-it.nl> |
---|---|
date | Sun, 15 Sep 2013 03:56:25 +0300 |
parents | 9da90cf29d91 |
children | bcaee8677d7d |
files | src/lib-http/http-message-parser.c |
diffstat | 1 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-http/http-message-parser.c Sun Sep 15 03:55:57 2013 +0300 +++ b/src/lib-http/http-message-parser.c Sun Sep 15 03:56:25 2013 +0300 @@ -308,6 +308,7 @@ int http_message_parse_headers(struct http_message_parser *parser) { const unsigned char *field_data; + struct http_message *msg = &parser->msg; const char *field_name, *error; size_t field_size; int ret; @@ -320,6 +321,20 @@ &field_name, &field_data, &field_size, &error)) > 0) { if (field_name == NULL) { /* EOH */ + + /* handle HTTP/1.0 persistence */ + if (msg->version_major == 1 && msg->version_minor == 0 && + !msg->connection_close) { + const char *const *option; + + msg->connection_close = TRUE; + array_foreach(&msg->connection_options, option) { + if (strcasecmp(*option, "Keep-Alive") == 0) { + msg->connection_close = FALSE; + break; + } + } + } return 1; }