现象:
执行curl 命令返回失败
root@array-virtual-machine:curl -s -o /dev/null -k --tlsv1 -A 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko' -H 'Host: 192.168.120.89' -c 6454cookie.txt -d 'method=localdb&uname=c1&pwd=admin&pwd1=&pwd2=&uniqueid=IqTfyZzS5mOvCcSS&hardwareid=pMDpZPwPBELVZg6DJsbgImwCp06Q7DDv' -X POST https://192.168.120.89/prx/000/http/localhost/login
root@array-virtual-machine:echo $?
1
排错方法:
1、加上 -v 参数查看详细信息,查看错误原因
curl -v -s -o /dev/null -k --tlsv1 -A 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko' -H 'Host: 192.168.120.89' -c 6454cookie.txt -d 'method=localdb&uname=c1&pwd=admin&pwd1=&pwd2=&uniqueid=IqTfyZzS5mOvCcSS&hardwareid=pMDpZPwPBELVZg6DJsbgImwCp06Q7DDv' -X POST https://192.168.120.89/prx/000/http/localhost/login
* Protocol https not supported or disabled in libcurl
* Closing connection -1
2、curl -V 查看当前支持的协议列表,发现确实不支持https协议,以前都是可以访问https的,不知道中间是不是有人安装了别的curl版本
root@array-virtual-machine:/home/wurr/login# curl -V
curl 7.35.0 (x86_64-unknown-linux-gnu) libcurl/7.35.0 zlib/1.2.11
Protocols: dict file ftp gopher http imap pop3 rtsp smtp telnet tftp
Features: IPv6 Largefile libz
解决方法:
重新安装curl,执行以下命令
apt-get update
apt install curl
使用curl -V 查看已经支持了https协议
root@array-virtual-machine:~/wurr/login# curl -V
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets