Conversation
curl < 7.21.0 will output redirection reponse body to the output when compressed, which will cause tarball is prepended with redirection reponse body and leads to checksum mismatch. - add `nvm_curl_use_compression` and `nvm_curl_version`
nvm.sh
Outdated
|
|
||
| nvm_curl_use_compression() { | ||
| if nvm_curl_libz_support && nvm_version_greater_than_or_equal_to nvm_curl_version 7.21.0; then | ||
| return 0; |
There was a problem hiding this comment.
It looks amature here to return 0/1, any suggestions from bash pro is welcome.
There was a problem hiding this comment.
The body of the function can just be nvm_curl_libz_support && nvm_version_greater_than_or_equal_to nvm_curl_version 7.21.0
ljharb
left a comment
There was a problem hiding this comment.
Looks great!
Please also add a unit test for nvm_curl_use_compression :-)
nvm.sh
Outdated
|
|
||
| nvm_curl_use_compression() { | ||
| if nvm_curl_libz_support && nvm_version_greater_than_or_equal_to nvm_curl_version 7.21.0; then | ||
| return 0; |
There was a problem hiding this comment.
The body of the function can just be nvm_curl_libz_support && nvm_version_greater_than_or_equal_to nvm_curl_version 7.21.0
nvm.sh
Outdated
| } | ||
|
|
||
| nvm_curl_version() { | ||
| curl --version | command awk '{ if ($1 == "curl") print $2 }' | command sed 's/-.*$//g' |
There was a problem hiding this comment.
nvm_curl_libz_support uses curl -V; are those identical across all curl versions?
If you're not certain, let's stick with curl -V to be consistent.
6460eae to
cb20548
Compare
|
Added unit tests of nvm_curl_version as well as nvm_curl_use_compression. |
cb20548 to
e199e5f
Compare
|
|
||
| if type "curl" > /dev/null 2>&1 ; then | ||
| curl_exec="$(type "curl")" | ||
| sudo rm -rf "${curl_exec}" |
There was a problem hiding this comment.
i don't think this is necessary (or safe, since this runs on developer's systems); the function below should mask it sufficiently.
|
|
||
| if type "curl" > /dev/null 2>&1 ; then | ||
| curl_exec="$(type "curl")" | ||
| sudo rm -rf "${curl_exec}" |
|
Removed unnecessary curl mask. |
b8c80a5 to
7965796
Compare
|
Thanks! |
Added
curl_use_compressionroutine to determine whether we should add compression flag to curl routine. Fixed #1549