The solution to the problem of "tlsv1 alert protocol version" reported when executing curl

1. Log

When executing the curl command directly or indirectly, the error is as follows:

curl: (35) error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version


2. Solutions

When searching online, you must pay attention to the error codes here 35, and 1404B42Ethey must be consistent, otherwise it is not the problem you encountered.

Some say to upgrade py, some say to upgrade openssl, all kinds of solutions have been tried to no avail.

It suddenly occurred to me that after a problem occurred recently, there was a missed report when the terminal requested 504, which was caused by the local proxy configuration.

So try to remove the agent in the environment variable:

vim ~/.bash_profile

Check and empty the http and https environment variables, for example:

export HTTP_PROXY=
export HTTPS_PROXY=
export NO_PROXY="localhost,127.0.0.1"
export http_proxy=$HTTP_PROXY
export https_proxy=$HTTPS_PROXY
export no_proxy=$NO_PROXY

It is enough to ensure that the proxy of http and https is set to empty, and it is not necessary to follow the example completely.

Then make it work:

source ~/.bash_profile

After that, the curl-related commands are executed normally.

I didn't find such a solution on the Internet, and it can be regarded as an additional solution for people who encounter problems.

Guess you like

Origin blog.csdn.net/zy13608089849/article/details/129139991