Yes, I believe that's what this code does: if the buffer.length == 0, i.e. if we didn't read anything, then we want to read again (with the code that follow, i.e. IO.select + timeout). The buffer will only be empty, if the above read_nonblock didn't read anything. In that case we don't need to call the response block, since we have nothing to deliver yet.

The other way around: if we did read something, we want to return that result quickly. For example you get back to `response.rb` in line 104 with a response block (or 108 without), which will deliver the partial result and then try to read from the socket again until it breaks (EOF or failure).