From c4b000f9cc377b6a13777eb10e858c90de6264fe Mon Sep 17 00:00:00 2001 From: Max Romanov Date: Tue, 29 Sep 2020 22:57:46 +0300 Subject: [PATCH] Supporting HTTP/1.0 keep-alive. The Apache HTTP server benchmarking tool, ab, issues HTTP/1.0 requests with the 'Connection: Keep-Alive' header and expects a 'Connection: Keep-Alive' header in the response. --- src/nxt_h1proto.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/nxt_h1proto.c b/src/nxt_h1proto.c index 17046187..7c695549 100644 --- a/src/nxt_h1proto.c +++ b/src/nxt_h1proto.c @@ -734,9 +734,16 @@ nxt_h1p_connection(void *ctx, nxt_http_field_t *field, uintptr_t data) r = ctx; field->hopbyhop = 1; - if (field->value_length == 5 && nxt_memcmp(field->value, "close", 5) == 0) { + if (field->value_length == 5 + && nxt_memcasecmp(field->value, "close", 5) == 0) + { r->proto.h1->keepalive = 0; + } else if (field->value_length == 10 + && nxt_memcasecmp(field->value, "keep-alive", 10) == 0) + { + r->proto.h1->keepalive = 1; + } else if (field->value_length == 7 && nxt_memcasecmp(field->value, "upgrade", 7) == 0) {