class HTTP::Timeout::PerOperation

def readpartial(size)

Read data from the socket
def readpartial(size)
  socket.read_nonblock(size)
rescue IO::WaitReadable
  if IO.select([socket], nil, nil, read_timeout)
    retry
  else
    raise TimeoutError, "Read timed out after #{read_timeout} seconds"
  end
end