C++ LibCurl makes program crash for some reason

0

I have trouble executing a LibCurl statement, at least it seems. I try to send off a 15MB file to a port where a script is listening that will process the file and return a response. However, before I get any response, the program crashes (only on 1 pptx file of 15MB, which is way larger than 'normal' other files)

However, does anyone see something strange in the LibCurl logs:

* timeout on name lookup is not supported
*   Trying 127.0.0.1...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 13621 (#0)
> PUT //File processing argument//
Host: localhost:13621
Accept: application/json
Accept: application/json
Content-Length: 15828910

* We are completely uploaded and fine
< HTTP/1.1 200 OK
< Content-Type: application/json
< Date: Tue, 14 Mar 2017 20:37:41 GMT
< Transfer-Encoding: chunked
< Server: Jetty(8.y.z-SNAPSHOT)
<
* Curl_http_done: called premature == 0
* Connection #0 to host localhost left intact

Process returned -1073741571 (0xC00000FD)   execution time : 12.682 s

The code I use:

curl = curl_easy_init();
if (curl) {
    CurlResponse = "";
    host = "localhost:13621";
    LibcurlHeaders = curl_slist_append(LibcurlHeaders, "Expect:");
    LibcurlHeaders = curl_slist_append(LibcurlHeaders, "Accept: application/json");
    curl_easy_setopt(curl, CURLOPT_URL, (host).c_str());
    curl_easy_setopt(curl, CURLOPT_UPLOAD, 1);
    curl_easy_setopt(curl, CURLOPT_READDATA, fd);
    curl_easy_setopt(curl, CURLOPT_HTTPHEADER, LibcurlHeaders);
    curl_easy_setopt(curl, CURLOPT_VERBOSE, CurlVerbose);
    curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)file_info.st_size);
    curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, LibcurlResponse);
    curl_easy_setopt(curl, CURLOPT_WRITEDATA, &CurlResponse);
    res = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
    }
curl_global_cleanup();

Thanks for your reply

c++
crash
libcurl
asked on Stack Overflow Mar 14, 2017 by TVA van Hesteren • edited Mar 14, 2017 by TVA van Hesteren

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0