-
-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Add audit check for URL schema #3318
Conversation
"--output", "/dev/null", | ||
url_to_access, | ||
user_agent: :fake | ||
) |
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.
This will download the whole file to /dev/null
, won't it? It should use --head
.
It would be good to share more code here with |
@MikeMcQuaid Ok, I will have a look. |
@MikeMcQuaid is this the kind of code reuse you envisioned? |
@Git-Jiro Yes, something like that. You may want to extract the |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@MikeMcQuaid Do you have an example for me where I can look at a similar refactoring? I would like to see how other people handled similar situations in the code base. |
@Git-Jiro I don't have a good example I can think of but I can answer more specific questions and provide review feedback. |
Ok, sounds like a plan! |
@MikeMcQuaid What do you think about my first version of this refactoring? |
@Git-Jiro Looks great, thanks for that! I'm happy to 🚢 this when @reitermarkus is. |
@@ -275,6 +277,17 @@ def core_formula_url | |||
"#{core_tap.default_remote}/blob/master/Formula/#{cask.token}.rb" | |||
end | |||
|
|||
def check_https_availability | |||
check_url_for_https_availability(cask.url) unless cask.url.to_s.empty? |
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.
This should probably also use cask.url.user_agent
.
@@ -275,6 +277,18 @@ def core_formula_url | |||
"#{core_tap.default_remote}/blob/master/Formula/#{cask.token}.rb" | |||
end | |||
|
|||
def check_https_availability | |||
user_agents = cask.url.user_agent.to_s.empty? ? [:default] : [cask.url.user_agent] |
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.
#user_agent
already defaults to :default
by itself.
Thanks, @Git-Jiro, nice work here! |
brew tests
with your changes locally?This implements: Homebrew/homebrew-cask#25403