handle some broken redirects to pre-signed S3 URLs#438
Merged
Conversation
Member
Author
|
Now working |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is a change to support https://www.transit.land/feeds/f-9tb-valleymetro
Currently tlib fails to follow the redirect to the pre-signed S3 URL:
✗ transitland validate http://www.phoenixopendata.com/dataset/3eae9a4a-98b9-40c8-8df7-8c00c1756235/resource/28ccc0a5-49c8-495c-b91f-193de5ce2cb7/download/googletransit.zip 2025-04-24T11:22:17-07:00 [INFO ] Validating: http://www.phoenixopendata.com/dataset/3eae9a4a-98b9-40c8-8df7-8c00c1756235/resource/28ccc0a5-49c8-495c-b91f-193de5ce2cb7/download/googletransit.zip Error: could not open reader 'http://www.phoenixopendata.com/dataset/3eae9a4a-98b9-40c8-8df7-8c00c1756235/resource/28ccc0a5-49c8-495c-b91f-193de5ce2cb7/download/googletransit.zip': response status code: 40The problem is because the URL redirect includes a
:443:Turns out Go standard library's net/http will include the :443 port in the Host header of the request, even though that's the default port for HTTPS. S3 isn't expecting that when it checks the signature, so it fails signature validation. In contrast, clients like curl strip out the port from the Host header, if it's a default value. So we'll modify our code to mimic that behavior.