Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use separate exceptions for open_timeout, timeout
Explicitly track which state we're in with a given connection so that we know whether we've successfully established the TCP connection. For timeouts occurring before we enter the body of the Net::HTTP#start block, assume the request failed establishing the connection, and raise the new RestClient::ConnectTimeout exception (which, for compatibility, is a subclass of RestClient::RequestTimeout). Unfortunately, this is a bit difficult to test without taking advantage of actual network latency - it seems impossible to force Linux to delay SYN/ACKing an incoming connection (even if you don't accept() it and you have listen() backlog set to 0). However, testing with a sufficiently low open_timeout and a sufficiently distant server seems to work. Conflicts: lib/restclient/request.rb
- Loading branch information