The current logic for curl_download tries to restart any existing
partial download, but this fails for some servers when the file is
already fully downloaded, returning a status code 416. This updates the
function to check for the file being already downloaded and if so bails
early.
The following command used to fail when run more than once but now works
as expected:
```
brew cask info https://raw.githubusercontent.com/homebrew/homebrew-cask/master/Casks/docker.rb
```
* Some HTTP servers apparently support ranges but don't support HEAD.
* This is a more realistic check anyway since the actual download request
will use GET (not HEAD).
* This fixesHomebrew/brew#5420.
Use the environment variables set by `brew test-bot`. Eventually we'll
disable Travis CI running CodeCov so move `TRAVIS` references to
`HOMEBREW_TRAVIS_CI` so it doesn't need whitelisted.
Also, fix `azure-pipelines.yml` so it's testing the correct version of
Homebrew/brew (the one checked out in the `pwd`).
* global: add RUBY_TWO global variable.
* test-bot: use RUBY_TWO global variable.
* github: produce better curl error messages.
If we don't know why curl has failed then ensure that the error messages
that it produced are included as part of the user output.
* Move GitHub API module to utils/github.rb.
* Move curl method to utils/curl.rb.
* global: use long curl arguments and an array.
This makes the code more self-documenting.
* utils/curl: support reading curl's output.
* utils/github: use curl instead of open-uri.
It has far better proxy support.
* pull: set Homebrew user agent.
* gist-logs: remove trailing whitespace.
* gist-logs: use first instead of [0].
Easier to read.
* gist-logs: use curl-based GitHub.open method.