【发布时间】:2021-02-18 23:28:31
【问题描述】:
我有以下代码:
curl_setopt($this->curl_handle, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all');
curl_setopt($this->curl_handle, CURLOPT_SSL_VERIFYPEER, false);
// set the file to be uploaded
if (!curl_setopt($this->curl_handle, CURLOPT_FILE, $fp_to_download)) {
throw new Exception("Could not download file $local_file");
}
// download file
try {
if (!curl_exec($this->curl_handle)) {
throw new Exception(sprintf('Could not download file. cURL Error: [%s] - %s', curl_errno($this->curl_handle), curl_error($this->curl_handle)));
}
} catch (Exception $e) {
$error_msg = $e->getMessage();
// Fallback to cUrl upload
if (strpos($error_msg, 'SSL23_GET_SERVER_HELLO')) {
return $this->curlProcessHandler('ftp://'.preg_replace('#/+#', '/', $this->server.':'.$this->port.'/'.$remote_file), $local_file);
} else {
throw new Exception("Could not download file $remote_file: $error_msg");
}
}
当我有curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'all'); 时,它返回错误:
Could not download file. cURL Error: [35] - error:1408F10B:SSL routines:ssl3_get_record:wrong version number
当我有curl_setopt($this->curl_handle, CURLOPT_SSLVERSION,'3'); 时,我得到一个不同的错误:
Could not download file. cURL Error: [4] - OpenSSL was built without SSLv3 support
我的 OpenSSL 版本似乎不支持 SSLv3,我不知道如何解决这个问题。 我尝试了不同的方法来更改我的 openssl 版本,但都没有奏效。
【问题讨论】:
-
你没有。您更新任何试图使用 SSLv3 的内容,因为它已经过时且危险。作为参考,SSLv3 支持已于 2014 年 11 月从 Firefox 中移除,因为存在巨大且无法修补的安全漏洞。