willdurand/Geocoder — pull request #96 by warmans (2012-09-27 21:37:21+00:00)
Title: Bug with HTTP SocketAdapter Header Parsing

When using the SocketAdapter with sources that return JSON the end of headers is not identified correctly resulting in JSON being mis-identified as a header and a blank response body being returned.

This bug was encountered using freegeoip

e.g. this should fail with old version of file:

```php
$adapter = new \Geocoder\HttpAdapter\SocketAdapter();
$adapter->getContent('http://freegeoip.net/json/68.145.37.34') //returns nothing
```
If you inspected the parsed header information in the adapter you should see the response body at the end of the array.

Note: The HTTP standard says the end of headers is delimited with a line containing only a CRLF but I can't figure out how to match this specifically ("\r\n" etc. doesn't work). Testing for the first empty line seems like an OK way to deal with it for lack of any better ideas.

Note 2: I didn't run the tests (it's late here) so you would probably want to do that if you merge this fix.