tmm1/http_parser.rb — Issue #12: "Could not parse data entirely" errors
Author: oz
Created: 2012-01-16 20:45:43+00:00
State: open

While using twitter-stream (which uses http_parser.rb) to consume Twitter's firehose, I often get HTTP::Parser::Error exceptions.

It seems I am not the only one since [this Gist](https://gist.github.com/792489) from @igrigorik underlines the issues perfectly while parsing a GET query to google.ca.

How to reproduce?

```ruby
# test.rb:
require 'http/parser' # http_parser.rb

h = Http::Parser.new
h.on_headers_complete = proc {|h| p [:headers, h] }
h.on_body = proc {|b| p [:on_body, b] }
h.on_message_complete = proc { p [:complete] }

h << `curl -i www.google.ca`
```

When running this you'd get:

```ruby
test.rb:8:in `<<': Could not parse data entirely (HTTP::Parser::Error) from test.rb:8:in `

'
```

HTH.