geemus/excon — pull request #271 by burns (2013-09-18 06:30:39+00:00)
Title: ensure nonblock loop in Socket#write operates on a binary string

Ensures that String#size returns bytes and String#slice properly
references the bytes remaining. If +data+ is a UTF-8 encoded string with
multi-byte characters, this would cause data loss on partial writes, and
could cause +written+ to exceed +data.size+.

Currently, this is possible when:
- writing the request+headers
- writing the SSL Proxy connection request
- when datum[:body] is a String AND the user supplied the Content-Length header

It looks like this is why the `break` conditional and nil check were added.
These could be removed if you think this was indeed the issue.