From 8c2e83f98ec8ba9dd2e02f9579b6b2cdefc1b8af Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Fri, 14 Aug 2009 22:39:11 -0700 Subject: http: support for "Connection: keep-alive" ab still sends this with HTTP/1.0 requests, which is unfortunate, but synthetic benchmarks are good for marketing purposes! --- ext/unicorn_http/unicorn_http.rl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'ext') diff --git a/ext/unicorn_http/unicorn_http.rl b/ext/unicorn_http/unicorn_http.rl index 220069b..88fb163 100644 --- a/ext/unicorn_http/unicorn_http.rl +++ b/ext/unicorn_http/unicorn_http.rl @@ -100,8 +100,12 @@ static void write_value(VALUE req, struct http_parser *hp, VALIDATE_MAX_LENGTH(hp->s.field_len, FIELD_NAME); f = uncommon_field(PTR_TO(start.field), hp->s.field_len); } else if (f == g_http_connection) { - if (STR_CSTR_CASE_EQ(v, "close")) - hp->flags &= ~UH_FL_KEEPALIVE; + if (hp->flags & UH_FL_KAMETHOD) { + if (STR_CSTR_CASE_EQ(v, "keep-alive")) + hp->flags |= UH_FL_KAVERSION; + else if (STR_CSTR_CASE_EQ(v, "close")) + hp->flags &= ~UH_FL_KEEPALIVE; + } } else if (f == g_content_length) { hp->len.content = parse_length(RSTRING_PTR(v), RSTRING_LEN(v)); if (hp->len.content < 0) -- cgit v1.2.3-24-ge0c7