Ruby 2.0 compatibility

Refactored the `read` method to bring it in line with the `IO#read` spec
and make it compatible with `IO.copy_stream`. Before this it hanged
indefinitely and caused various socket IO write errors in Net::HTTP and
net-http-persistent.
Merge pull request #25 from mislav/ruby2-compat

Ruby 2.0 compatibility