tarcieri/http — pull request #115 by ixti (2014-03-28 03:17:21+00:00)
Title: Fix readpartial loop

This closes outstanding bits with socket not being correctly closed and cases when parser was received body data in one chunk.

### Things to keep in mind

##### @socket should belong to Connection...

... and `Connection` should belong to `Response (see #72). This will allow client re-use without having any issues:

``` ruby
client = HTTP::Client.new

res_1 = client.get "http://example.com/chunked-1"
res_2 = client.get "http://example.com/chunked-2"
```

With current implementation, the use-case above will be defected (res1 will never be able to read it's response body - it will be body of second request).

##### There's no need to keep track of Content-Length...

... and/or Transfer-Encoding. This is done by `HTTP::Parser` already. Thus we can safely rely on `HTTP::Response::Parser#finished?` which is true as soon as underlying `HTTP::Parser` reports message end.

### Related issues

- Closes #66
- Closes #69

//cc @sferik @tarcieri