Skip to content

Commit

Permalink
audit: prefer https/s over ftp where known available
Browse files Browse the repository at this point in the history
The FTP protocol is prone to getting firewalled to death in places, so where
we know we can avoid that by using either secure or more commonly accepted
protocols let's do so.

Examples of output:

```
* Stable: ftp://ftp.cpan.org/pub/CPAN/authors/id/N/NE/NEILB/Time-Duration-1.20.tar.gz should be `http://search.cpan.org/CPAN/authors/id/N/NE/NEILB/Time-Duration-1.20.tar.gz`
* Stable: Please use https:// for ftp://ftp.mirrorservice.org/sites/lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_4.89.tar.bz2
```
  • Loading branch information
DomT4 committed May 31, 2016
1 parent 92e3570 commit 331fdba
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Library/Homebrew/cmd/audit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1175,6 +1175,16 @@ def audit_urls
end
end

# Prefer HTTP/S when possible over FTP protocol due to possible firewalls.
urls.each do |p|
case p
when %r{^ftp://ftp\.mirrorservice\.org}
problem "Please use https:// for #{p}"
when %r{^ftp://ftp\.cpan\.org/pub/CPAN(.*)}i
problem "#{p} should be `http://search.cpan.org/CPAN#{$1}`"
end
end

# Check SourceForge urls
urls.each do |p|
# Skip if the URL looks like a SVN repo
Expand Down

0 comments on commit 331fdba

Please sign in to comment.