C 和卷发:无法接收握手,需要更多数据
C++ and Curl: Failed to receive handshake, need more data
我正在尝试使用凭据访问FTP。
我从未使用过卷发,对自己的工作有限,尽管我确实研究了许多我使用的功能。我曾经在C中开发了一个有效的FTP客户端和服务器,但是它只是Unix,所以这主要是卷曲的问题(我真的想使用卷发,因为这必须是跨平台,而我不使用除了我自己包装所有东西,我敢肯定我必须知道如何最终使用卷发。)
到目前为止的代码(不包括标题文件,但我真的怀疑它是否需要,由于明显的原因,密码和登录隐藏。它们在Filezilla中进行了测试)
bool FTPClient::DownloadFile()
{
CURL *curl;
CURLcode res;
char buffer[CURL_ERROR_SIZE + 1] = {};
struct FtpFile ftpfile =
{
"test",
NULL
};
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL,
"https://[login]:[password]@lifesanctuary.eu/Update");
curl_easy_setopt(curl, CURLOPT_PORT, 21);
curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, my_fwrite);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &ftpfile);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, buffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (CURLE_OK != res)
{
//ERREUR
fprintf(stderr, "erreur CURL %d:n%sn", res, buffer);
curl_global_cleanup();
return false;
}
}
if (ftpfile.stream)
fclose(ftpfile.stream);
curl_global_cleanup();
return true;
}
输出:
* Trying 91.121.145.87...
* TCP_NODELAY set
* Connected to lifesanctuary.eu (91.121.145.87) port 21 (#0)
* schannel: SSL/TLS connection with lifesanctuary.eu port 21 (step 1/3)
* schannel: checking server certificate revocation
* schannel: sending initial handshake data: sending 185 bytes...
* schannel: sent initial handshake data: sent 185 bytes
* schannel: SSL/TLS connection with lifesanctuary.eu port 21 (step 2/3)
* schannel: failed to receive handshake, need more data
* schannel: SSL/TLS connection with lifesanctuary.eu port 21 (step 2/3)
* schannel: encrypted data got 53
* schannel: encrypted data buffer: offset 53 length 4096
* schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - Le jeton fourni Ó la fonction nÆest pas valide
* Closing connection 0
* schannel: shutting down SSL/TLS connection with lifesanctuary.eu port 21
* schannel: clear security context handle
erreur CURL 35:
schannel: next InitializeSecurityContext failed: SEC_E_INVALID_TOKEN (0x80090308) - Le jeton fourni Ó la fonction nÆest pas valide
我不知道问题是什么。我有潜在客户,搜寻了一点,得出的结论是,我找到了无关的东西,或者我根本不明白。
可能是因为加密,ssl/tls-我在该域中不太了解,设置服务器的人告诉我它使用了TLS,因此我为什么要把那行:
curl_easy_setopt(curl, CURLOPT_SSL_CIPHER_LIST, "TLSv1");
,但我没有真正的想法如何做,看来" TLSV1"是我认为可以适合在我的上下文中的唯一参数。我怀疑这可能是问题。
另外,我认为另一个问题可能是与证书有关的。我不确定为什么,但是我确定我没有处理任何与证书有关的任何内容,而且我也不确定它们是什么。我知道,当我使用Filezilla登录FTP时,我会接受它,但是在这里我显然不是。
那是怎么回事?证书问题?加密问题?也许完全不同?提前致谢。
编辑: - 我假设这是证书问题,因为据我所知,HTTPS需要一个,而我在这方面没有任何事情, - 我正在考虑这可能是一个加密问题,因为此错误代码似乎主要是由此引起的 - 我完全不知道这可能是其他东西!
我认为交付该服务器的人的一系列错误信息是有原因的。有人告诉我多次使用" https://"使用。我正在关闭这个问题,因为它听起来更多是团队的问题,而不是代码中的问题。
- 通过套接字[TCP]传输数据 如何在C / C ++中打包多个整数并使用send() recv()传输数据
- 具有多个模板的模板函数,用于特定数据类型(如字符串)?
- 如何实现高效的算法来计算大型数据集的多个不同值?
- 与多个 for 循环与单个 for 循环 wrt 相关的性能从多映射获取数据
- 多维数组存储三种不同的数据类型?
- C++:在多个线程中访问同一数组/向量的不同单元格是否会产生数据竞赛?
- 在PROGMEM中添加更多数据会中断Arduino Mega 2560上的SPI传输
- C++中的多维数据集:从 std::vector 的 2D 数据到 std::vector 的 2D 网格的最干净方法?
- 结构内具有更多数据类型的单个链表
- 在 C++ 的 iov 中存储更多数据
- C 和卷发:无法接收握手,需要更多数据
- C++使用sql连接器获取元数据,而不需要太多数据
- C++简体版链表,当我加载数据以创建链表并输入更多数据时,似乎存在差距
- Vtk检查多数据对象是否相交
- C++链表实现多数据插入
- MOVL多数据指令与装配优化对比
- C++多次使用更多数据缓冲区
- 读取svm数据并使用更多数据进行再训练
- hiredis,如何检查是否有更多数据可供读取
- cin 直接到向量<int>,当没有更多数据时断开循环