diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-04-26 19:09:26 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-04-26 19:09:26 -0700 |
commit | 31bd370baef622aaa5dd14084f27baf2fabf506c (patch) | |
tree | fce1df35cf3f90ad9249436a749770ae42d3ca57 | |
parent | 6066e9f608460adf46b215a9b6e5f351a87ba4b0 (diff) | |
download | kcar-31bd370baef622aaa5dd14084f27baf2fabf506c.tar.gz |
-rw-r--r-- | ext/kcar/kcar.rl | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/kcar/kcar.rl b/ext/kcar/kcar.rl index 8c2b465..d2c8f6c 100644 --- a/ext/kcar/kcar.rl +++ b/ext/kcar/kcar.rl @@ -515,6 +515,8 @@ static VALUE body_eof(VALUE self) * * 1. MUST be HTTP/1.1 +or+ HTTP/1.0 with "Connection: keep-alive" * 2. MUST NOT have "Connection: close" set + * 3. If there is a response body, either a) Content-Length is set + * or b) chunked encoding is used */ static VALUE keepalive(VALUE self) { @@ -524,8 +526,11 @@ static VALUE keepalive(VALUE self) if ( HP_FL_TEST(hp, HASBODY) ) { if (HP_FL_TEST(hp, CHUNKED) || (hp->len.content >= 0)) return Qtrue; + + /* unknown Content-Length and not chunked, we must assume close */ return Qfalse; - } else { /* 100 Continue */ + } else { + /* 100 Continue, 304 Not Modified, etc... */ return Qtrue; } } |