Mar 27, 2024. 09:45 working code, response[location] is nil if no redirect, otherwise it has the localized url

fromuri = 'https://support.mozilla.org/de/kb/troubleshoot-mode-thunderbird'
from_uri= URI(fromuri)
Net::HTTP.start(from_uri.host, from_uri.port,
                     :use_ssl => from_uri.scheme == 'https') do |http|
  request = Net::HTTP::Get.new from_uri.request_uri
  response = http.request request # Net::HTTPResponse object
  response_uri = response['location']
  pp response ; puts response['location'] ;
  puts response_uri
end
Standard

One thought on “

Leave a comment