lib/aranha/parsers/source_address/http_get.rb in aranha-0.9.0 vs lib/aranha/parsers/source_address/http_get.rb in aranha-0.9.1

- old
+ new

@@ -1,14 +1,19 @@ # frozen_string_literal: true +require 'addressable' require 'net/http' module Aranha module Parsers class SourceAddress class HttpGet class << self + def location_uri(source_uri, location) + ::Addressable::URI.join(source_uri, location).to_s + end + def valid_source?(source) source.to_s =~ %r{\Ahttps?://} end end @@ -43,10 +48,10 @@ case response when Net::HTTPSuccess then response.body when Net::HTTPRedirection then - content_fetch(response['location'], limit - 1) + content_fetch(self.class.location_uri(uri, response['location']), limit - 1) else response.value end end end