Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sourceforge URLS #62

Merged
merged 1 commit into from
Jan 11, 2024
Merged

Fix sourceforge URLS #62

merged 1 commit into from
Jan 11, 2024

Conversation

ReillyBrogan
Copy link
Contributor

@ReillyBrogan ReillyBrogan commented Dec 19, 2023

Sourceforge does a lot of redirects to the final download destination and the Golang HTTP client doesn't seem to handle this very well out of the box. We can fix this by stripping the Referer header from all HTTP requests following the redirects.

I wasn't able to make this work with adding this to the grab httpclient (probably something I needed to do with the request body) but that's easily worked around by just doing a HEAD request in the first place and following redirects until we get to the final download URL which we can pass to grab.

Closes #37

@ReillyBrogan ReillyBrogan added the backport-me Backport to stable release label Dec 19, 2023
Sourceforge does a lot of redirects to the final download destination and the Golang HTTP client doesn't seem to handle this very well out of the box. We can fix this by stripping the Referer header from all HTTP requests following the redirects.

I wasn't able to make this work with adding this to the grab httpclient (probably something I needed to do with the request body) but that's easily worked around by just doing a HEAD request in the first place and following redirects until we get to the final download URL which we can pass to grab.

Signed-off-by: Reilly Brogan <[email protected]>
Copy link
Member

@GZGavinZhao GZGavinZhao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

YAY!

@GZGavinZhao GZGavinZhao merged commit f4c7c9f into master Jan 11, 2024
1 check passed
@davidjharder davidjharder deleted the fix-sourceforge branch September 18, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-me Backport to stable release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sourceforge uris work poorly with go-grab
2 participants