diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-19 21:47:40 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2006-10-19 21:47:40 +0000 |
commit | 0848deafbc14e15e4fd6e08cfb767fa56045c202 (patch) | |
tree | dfa617ec06de9f4e9c38514cfa90f50179931241 /lib/rbot | |
parent | 9c7eb72b563416afaf43d9119559ab7d1c840a56 (diff) |
Fix redirection in httputil.get when location is only a partial/realtive url
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/httputil.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/rbot/httputil.rb b/lib/rbot/httputil.rb index bcb05d88..e80a45aa 100644 --- a/lib/rbot/httputil.rb +++ b/lib/rbot/httputil.rb @@ -143,6 +143,7 @@ class HttpUtil else uri = URI.parse(uri_or_str.to_s) end + debug "Getting #{uri}" proxy = get_proxy(uri) proxy.open_timeout = opentimeout @@ -174,7 +175,7 @@ class HttpUtil debug "Redirecting #{uri} to #{resp['location']}" yield resp['location'] if block_given? if max_redir > 0 - return get( URI.parse(resp['location']), readtimeout, opentimeout, max_redir-1, cache) + return get( URI.join(uri.to_s, resp['location']), readtimeout, opentimeout, max_redir-1, cache) else warning "Max redirection reached, not going to #{resp['location']}" end |