CircleCI-Public / circleci-cli-orb

Easily install and use the CircleCI CLI, on CircleCI
https://circleci.com/orbs/registry/orb/circleci/circleci-cli
MIT License
2 stars 11 forks source link

[CIRCLE-24306] Fix install command error that happens with older curl versions #5

Closed lokst closed 4 years ago

lokst commented 4 years ago

Problem

The curl command used by this orb's install command has started failing in some older versions of curl (e.g. curl 7.54.0 (x86_64-apple-darwin18.0)) likely due to recent underlying changes in the web server for https://circle.ci/cli such that it now performs redirection with HTTP/2. The error message shown by curl is curl: (16) Error in the HTTP2 framing layer.

Example of job that encountered the error: https://circleci.com/gh/CircleCI-Public/circleci-cli-orb/102

Based on tests, newer versions of curl do not have this issue (e.g. curl 7.68.0 (x86_64-apple-darwin18.7.0))

Code changes

This fix makes use of the --http1.1 option in curl to prevent usage of HTTP/2, and omits the option for versions of curl that do not support the --http1.1 option, like curl 7.29.0 (x86_64-redhat-linux-gnu).

Versions of curl that do not support --http1.1 likely do not default to HTTP/2 anyway, and hence should be not affected by this issue.

Tests

Example of job that previously failed but now succeeds with fix applied: https://circleci.com/gh/CircleCI-Public/circleci-cli-orb/147 Example of job with fix applied, that skips --http1.1 because the version of curl doesn't support it: https://circleci.com/gh/CircleCI-Public/circleci-cli-orb/152