From 0848deafbc14e15e4fd6e08cfb767fa56045c202 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 19 Oct 2006 21:47:40 +0000 Subject: Fix redirection in httputil.get when location is only a partial/realtive url --- lib/rbot/httputil.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib') 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 -- cgit v1.2.3