Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

解决 curl: Protocol "https" not supported or disabled in libcurl #77

Open
johnnian opened this issue Jul 13, 2024 · 1 comment
Open
Labels

Comments

@johnnian
Copy link
Owner

johnnian commented Jul 13, 2024

一、现象

在Centos7环境下,执行curl命令报错:

curl: (1) Protocol "https" not supported or disabled in libcurl

二、解决方法

1、检查curl版本情况

[root@~]# curl -V
curl 7.55.1 (x86_64-pc-linux-gnu) libcurl/7.55.1
Release-Date: 2017-08-14
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: AsynchDNS IPv6 Largefile UnixSockets

从结果看,系统安装的curl版本确实不支持https,因此需要重新安装curl

2、重新安装openssl版本

执行以下命令:

[root]# vi install_openssl.sh
#!/bin/bash
wget https://www.openssl.org/source/openssl-1.1.1c.tar.gz
tar -zxvf openssl-1.1.1c.tar.gz
cd openssl-1.1.1c
./config --prefix=/usr/local/openssl   #如果此步骤报错,需要安装perl以及gcc包
make && make install
mv /usr/bin/openssl /usr/bin/openssl.bak
ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
ldconfig -v

[root]# sh install_openssl.sh
[root]# openssl version

3、重新安装curl

执行以下命令:

[root]#  vi install_curl.sh
#!/bin/bash
wget https://curl.se/download/curl-7.78.0.tar.gz
tar -zxvf curl-7.78.0.tar.gz
cd curl-7.78.0/
./configure -with-ssh=/usr/local/ssl
make 
make install

[root]#  sh install_curl.sh

在编译curl的时候报错:

vtls/openssl.c: In function ‘Curl_ossl_seed’:
vtls/openssl.c:279:5: error: implicit declaration of function ‘RAND_egd’ [-Werror=implicit-function-declaration]
     int ret = RAND_egd(data->set.str[STRING_SSL_EGDSOCKET]?
    ^
cc1: some warnings being treated as errors
Makefile:2023: recipe for target 'vtls/libcurl_la-openssl.lo' failed
make[2]: *** [vtls/libcurl_la-openssl.lo] Error 1

原因是系统中安装了多个openssl的包,处理方法是:

yum remove openssl-devel

重新执行一遍

cd curl-7.78.0/
./configure -with-ssh=/usr/local/ssl
make 
make install

确认版本号, 已经增加了“https”模块

[root]# curl --version
curl 7.78.0 (x86_64-pc-linux-gnu) libcurl/7.78.0 OpenSSL/1.1.1c zlib/1.2.7
Release-Date: 2021-07-21
Protocols: dict file ftp ftps gopher gophers http https imap imaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS HSTS HTTPS-proxy IPv6 Largefile libz NTLM NTLM_WB SSL TLS-SRP UnixSockets

三、参考链接

@johnnian johnnian added the Linux label Jul 13, 2024
@jaaleng
Copy link

jaaleng commented Jul 25, 2024

不好意思,我是新手,不知怎么提交了个什么。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants