我们想通过 https post 将文件发布到 web 服务器。 我们成功将小文件发布到网络服务器,但是当我们发布大文件(大于 10MB)时,我们收到此错误:
- SSL 读取:error:00000000:lib(0):func(0):reason(0), errno 10054
- curl_http_done:调用过早 == 1
- 关闭连接 0
libcurl 版本:7.50.3
开启ssl版本:openssl-1.0.1t。
我们已经在网络服务器上修改了帖子大小的配置。我们可以通过网页发布大文件,但是,同时,我们不能通过 libcurl 使用 https 发布大文件。 我们能做些什么吗?非常感谢!
我们为 POST 设置的选项如下所示:
curl_global_init(CURL_GLOBAL_ALL);
CURL* hCurl = curl_easy_init();
if (hCurl != NULL)
{
curl_httppost* pFormPost = NULL;
curl_httppost* pLastElem = NULL;
curl_formadd(&pFormPost, &pLastElem,
CURLFORM_COPYNAME, "ufile01",
CURLFORM_FILE, "vlc.rar",
CURLFORM_CONTENTTYPE, "application/octet-stream",
CURLFORM_END);
curl_easy_setopt(hCurl, CURLOPT_HTTPPOST, pFormPost);
curl_easy_setopt(hCurl, CURLOPT_URL, url);
curl_easy_setopt(hCurl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(hCurl, CURLOPT_SSL_VERIFYHOST, 0L);
CURLcode res = curl_easy_perform(hCurl);
if (res != CURLE_OK)
{
printf("Error");
}
curl_formfree(pFormPost);
curl_easy_cleanup(hCurl);
}
curl_global_cleanup();
最佳答案
考虑检查网络服务器上的 POST 大小。对于 PHP,可以通过 post_max_size 进行调整。
关于ssl - libcurl https 发布大文件 ssl 读取错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44181155/