Permalink
Browse files

Regression: setting proxy with URI

client.proxy = '' and client.proxy = URI.parse('') broken by
f29310d. Fixed.
  • Loading branch information...
1 parent efd6344 commit 796a731ac7da4cbac779c9c8f7bfc73a25289c69 @nahi nahi committed May 30, 2011
Showing with 5 additions and 7 deletions.
  1. +1 −1 lib/httpclient.rb
  2. +2 −3 test/test_http-access2.rb
  3. +2 −3 test/test_httpclient.rb
View
@@ -438,7 +438,7 @@ def proxy
#
# Calling this method resets all existing sessions.
def proxy=(proxy)
- if proxy.nil? || proxy.empty?
+ if proxy.nil? || proxy.to_s.empty?
@proxy = nil
@proxy_auth.reset_challenge
else
@@ -117,9 +117,8 @@ def test_proxy
assert_raises(URI::InvalidURIError) do
@client.proxy = "http://"
end
- assert_raises(ArgumentError) do
- @client.proxy = ""
- end
+ @client.proxy = ""
+ assert_nil(@client.proxy)
@client.proxy = "http://foo:1234"
assert_equal(URI.parse("http://foo:1234"), @client.proxy)
uri = URI.parse("http://bar:2345")
@@ -153,9 +153,8 @@ def test_proxy
assert_raises(URI::InvalidURIError) do
@client.proxy = "http://"
end
- assert_raises(ArgumentError) do
- @client.proxy = ""
- end
+ @client.proxy = ""
+ assert_nil(@client.proxy)
@client.proxy = "http://admin:admin@foo:1234"
assert_equal(URI.parse("http://admin:admin@foo:1234"), @client.proxy)
uri = URI.parse("http://bar:2345")

0 comments on commit 796a731

Please sign in to comment.