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

curl: echo any cookies received on a redirect #11790

Merged
merged 1 commit into from Sep 1, 2021

Conversation

FnControlOption
Copy link
Contributor

@FnControlOption FnControlOption commented Jul 29, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

Using a browser or wget, opening https://www.crushftp.com/early10/CrushFTP10.zip sets some cookies and then redirects to https://www.crushftp.com/CrushFTP10.zip

Using curl or attempting to directly download https://www.crushftp.com/CrushFTP10.zip fails because it requires the cookies that are set by https://www.crushftp.com/early10/CrushFTP10.zip

As seen in Homebrew/homebrew-cask#109237, these cookies can be set for brew install but brew audit still fails. This can be fixed by adding --cookie-jar /dev/null to the curl arguments, which makes the cookies persist even after a redirect.

Additionally, I've added a retry to download_strategy.rb that makes it unnecessary to set cookies in Homebrew/homebrew-cask#109237.

rescue ErrorDuringExecution => e
if e.status.exitstatus == 22 && resolved_url != url && is_redirection
ohai "Downloading from #{url}"
resolved_url = url
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain why this fixes things? It feels like a strange fix to override our internal state about what the original URL was like this. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't quite remember... It's technically not needed though, so I'll remove it.

@github-actions
Copy link

github-actions bot commented Sep 1, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@github-actions github-actions bot added the stale No recent activity label Sep 1, 2021
@MikeMcQuaid
Copy link
Member

Thanks again @FnControlOption!

@github-actions github-actions bot removed the stale No recent activity label Sep 1, 2021
@MikeMcQuaid MikeMcQuaid merged commit 8352f1a into Homebrew:master Sep 1, 2021
@github-actions github-actions bot added the outdated PR was locked due to age label Oct 2, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants