Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Connections cannot be reused if requests specify Content-Length: 0 #68

j3h opened this Issue · 2 comments

2 participants


I ran into some trouble when attempting to reuse a connection to a Snap server. I eventually narrowed it down to the following:

When send the following via netcat to my Snap server:

GET / HTTP/1.1
Host: localhost:8000
Content-Length: 0

GET / HTTP/1.1
Host: localhost:8000
Content-Length: 0

I only get one HTTP response. After digging for a while, I think the bug is in Snap.Iteratee.takeExactly's handling of zero-length input, but I am not sure.

I removed this case:

takeExactly 0   s = do
    s' <- lift $ runIteratee $ enumEOF s
    case s' of
      (Continue _) -> error "divergent iteratee"
      (Error e)    -> throwError e
      (Yield v _)  -> yield (Yield v EOF) EOF

because there is a case for zero further down, and it looked like it was behaving better.


Looks good to me. Could you please send a pull request? I will apply it.


Could you please verify that the fix works? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.