]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - lib/rbot/httputil.rb
Fix redirection in httputil.get when location is only a partial/realtive url
[user/henk/code/ruby/rbot.git] / lib / rbot / httputil.rb
index bcb05d885b8bd10b4bfc40296364ce4876d2ce9a..e80a45aa388fa4a48e3244f280f1101c6b65c389 100644 (file)
@@ -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