spix_parser 1.8.1 → 1.8.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -21,10 +21,10 @@ class RedirectFollower
|
|
21
21
|
end
|
22
22
|
|
23
23
|
protected
|
24
|
-
def self.redirect_url(response)
|
24
|
+
def self.redirect_url(response, url = "")
|
25
25
|
case response['location'].strip
|
26
26
|
when nil then response.body.match(/<a href=\"([^>]+)\">/i)[1]
|
27
|
-
when %r{^/} then URI::Generic.build(Hash[[:scheme, :host, :path].zip(URI.parse(
|
27
|
+
when %r{^/} then URI::Generic.build(Hash[[:scheme, :host, :path].zip(URI.parse(url).select(:scheme, :host) << "/")]).to_s
|
28
28
|
else response['location']
|
29
29
|
end
|
30
30
|
end
|
data/lib/spix_parser/version.rb
CHANGED