-
-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
Try getting page content with both headers #11517
Try getting page content with both headers #11517
Conversation
This isn’t a huge issue overall, so no strong feelings on the implementation. But it’s worth considering instead a I mention this because while a “wrong” user agent typically leads to failure to get a page, on occasion it leads to getting the wrong page (typically the Windows version). |
I will be removing the multiple user-agent logic from This will happen as soon as I've finished my open Homebrew/brew PRs but I'm trying not too spin too many plates at once. However, it may be best if I simply create a draft PR and I can mark it as ready for review when my other PRs are finished. This would make the changes visible and give me something to link to, as there have been a number of related requests lately. In general, I was against the idea of making a follow-up request with a different user agent in
That said, I will at least test this out (with some additional debugging information added to the JSON output) to collect concrete evidence on how this PR behaves. I'll have to do a few runs across homebrew/core and homebrew/cask, so it will take a few hours at a minimum. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this for homebrew/core, this change didn't affect any checks that use #page_content
. Testing this for homebrew/cask, this change only affects the casks you already mentioned (hook
, hopper-debugger-server
, keycue
) and camo-studio
(which also requires the :browser
user-agent).
Like the related #page_headers
logic, this change does lead to two requests where we only need one but livecheck doesn't offer an alternative yet, it only affects a few casks, and it will be removed in the near future.
Since the undesirable side effects of this are minimal at the moment, this can technically be merged. If we do, I'll have to walk back these changes as part of my work to allow for configuration options in livecheck
blocks but that shouldn't be too much trouble.
I would have preferred to leave these four checks broken until I introduce configuration options in the near future but I'm amenable to merging this since it's your first Homebrew/brew PR.
Merging given @samford's comment. Thanks so much for your contribution! Without people like you submitting PRs we couldn't run this project. You rock, @n-thumann! |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Some casks are depending on
user_agent: :fake
, likehopper-debugger-server
,keycue
orhook
(after merging Homebrew/homebrew-cask#106972). When runninglivecheck
on them, the fake UA will not affect the request for fetching the version and therefore fail.This PR changes
page_content(url)
livecheck strategy to try both user agents (:default
and:browser
). The changes are analogue to b9741dd. It basically wraps the existing code inside aneach
loop.With this PR applied the request will try both headers and the livecheck will succeed: