Fix: Handle relative URLs in HTTP redirects #448
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Fixes #442
Pull Request Checklist
bundle exec rspecto make sure that my PR didn't break any testbundle exec rubocopto make sure that my PR is inline with our code stylePull Request Description
This PR fixes issue #442 where
u3d availablefails with "Failed to open TCP connection to :80 (Connection refused - connect(2) for nil port 80)".Problem:
When following HTTP redirects, relative URLs (e.g.,
/new-path) were not being converted to absolute URLs. This causedURI(url)to parse the relative URL, resulting inuri.hostbeingnil, which led toNet::HTTP.startfailing with a connection error.Solution:
Added logic in
Utils.follow_redirectsto detect relative redirect URLs and convert them to absolute URLs using the current URI as the base before following the redirect.Changes:
lib/u3d/utils.rbto handle relative URLs in HTTP redirectsspec/u3d/utils_spec.rbto verify relative URL handlingTesting:
u3d availablecommand which now works correctly