drbrain / net-http-persistent

Thread-safe persistent connections with Net::HTTP
http://seattlerb.rubyforge.org/net-http-persistent
339 stars 117 forks source link

Use #respond_to? instead of === to determine URI-ness #67

Closed mckern closed 4 years ago

mckern commented 9 years ago

Persistent#request_setup has a check on the class of the value req_or_uri which tests to see if req_or_uri is an instance of URI. But there's a good chance that someone might pass an instance of Addressable::URI instead of URI, which will fail this check.

Addressable::URI is basically a drop-in replacement for URI, so there's no reason to care which of these objects are passed, just that it responds to the #request_uri method. So, #respond_to? to the rescue!

drbrain commented 9 years ago

Last night I got the tests passing on master, so tonight I should be able to merge this and other outstanding pull requests for a 1.9.x release (to be followed by a 2.x release when I'm sure everything is in good order).