dovecot-2.2: lib-http: Added support for handling HTTP/1.0 messa...
dovecot at dovecot.org
dovecot at dovecot.org
Sun Sep 15 03:57:22 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/ccd39339596e
changeset: 16754:ccd39339596e
user: Stephan Bosch <stephan at rename-it.nl>
date: Sun Sep 15 03:56:25 2013 +0300
description:
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.
diffstat:
src/lib-http/http-message-parser.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
diffs (32 lines):
diff -r 9da90cf29d91 -r ccd39339596e src/lib-http/http-message-parser.c
--- 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;
}
More information about the dovecot-cvs
mailing list