0

We want to post files to web server through https post. we successfully post small files to web sever, but when we post big file(lager than 10MB), we receive this error:

  • SSL read: error:00000000:lib(0):func(0):reason(0), errno 10054
  • Curl_http_done: called premature == 1
  • Closing connection 0

libcurl version: 7.50.3

open ssl version: openssl-1.0.1t.

We have already modifed the configuration of post size on the web server. We can post big files through web page, but, at the same time, we can't post big file through libcurl with https post. Anything we can do with this? Thanks very much!

The options we are setting for the POST are shown below:

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();
lym
  • 85
  • 1
  • 1
  • 6

1 Answers1

1

Consider to check POST size on web server. For PHP it can be adjusted by post_max_size

Tom Lime
  • 1,154
  • 11
  • 15
  • Thanks for your reply. We have already modifed the configuration of post size on the web server. We can post big files through web page, but, at the same time, we can't post big file through libcurl with https post. – lym May 25 '17 at 14:14
  • 10054 is related to network (TCP connection reset), read this comment for more info https://stackoverflow.com/a/25496383/775159 i also can advice to disable AV/FW on host you run libcurl from – Tom Lime May 25 '17 at 14:58
  • I have already closed AV/FW, but also the same. We are using IIS7.5 as our web server, and on the client, I notice libcurl print "SSL connection using TLSV1.0/AES128-SHA".Is it possible because the openssl version? – lym May 25 '17 at 15:32
  • try to compile and run with `curl_easy_perform_ev` instead of `curl_easy_perform`. – Tom Lime May 25 '17 at 20:04