geemus/excon — pull request #274 by burns (2013-09-22 17:28:28+00:00)
Title: remove defense mechanism in Socket#write

Removes the check for IO#write_nonblock returning more bytes written
than requested. This was a result of an encoding issue (#271).

---

I've used the `while true` and `break` that was originally being used (see #90), and refactored the rescue.
You could use `until data.empty?`.
If you did, note that this would then guard against empty writes.
This is not required, since this method should never be called with an empty string.
But it's a side-effect worth mentioning - as the `@data[:nonblock] == false` case would not.
You could add a check there, or just `return if data.empty?` from the top of the method.