curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: 8.7.1 : client read function EOF fail, only x/y of needed bytes read

From: Matt Barnett via curl-library <>
Date: Wed, 27 Mar 2024 13:00:39 +0000 (UTC)

That might be tricky since everything gets blocked from work (even posting to this list!), I will see if I can setup a dev env at home and replicate. In the interim I can say I build static library version of libcurl (linked to OpenSSL 3.2.1 (itself linked to LibSSH2 1.11.0)). nmake /f mode=static VC=16 WITH_SSL=static WITH_SSH2=static ENABLE_SSPI=no DEBUG=no MACHINE=x64 And... this is a generalised version of what I am doing (might contain some typos since I had to type it all out (not cut + paste) and it may not compile because I had to convert across from using a different string implementation in the real code i.e. we don't use std::string) std::string m_publicKey = "" std::string m_privateKey = "matt.pri" std::string strFullFilename = " C:/Temp/Blah.xlsx " std::string strFullURL = sftp://MATT_at_someserver:5022/Blah.xlsx; struct stat file_info; // enable TLSv1.2 only curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2); /* enable uploading */ curl_easy_setopt(curl, CURLOPT_UPLOAD, 1L); // SFTP/SSH curl_easy_setopt(curl, CURLOPT_SSH_AUTH_TYPES, CURLSSH_AUTH_PUBLICKEY); curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_SFTP); curl_easy_setopt(curl, CURLOPT_SSH_PUBLIC_KEYFILE,; curl_easy_setopt(curl, CURLOPT_SSH_PRIVATE_KEYFILE,; // Turn on verbose logging curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, libcurl_trace); const char* filename =; const char* url =; FILE* hd_src = fopen(filename, "r"); if (nullptr == hd_src) { printf("Failed to open file."); exit(-1); } /* specify target */ curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_INFILE, hd_src); /* get the file size of the local file */ fstat(fileno(hd_src), &file_info); curl_off_t fsize = (curl_off_t)file_info.st_size; printf("Local file size : " + numToString(fsize) + " bytes"); curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, (curl_off_t)fsize); res = curl_easy_perform(curl); /* Check for errors */ if (res != CURLE_OK) { fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); } if (fclose(hd_src) == EOF) /* close the local file */ printf("There was an issue closing the local file : " + strFullFilename); /* always cleanup */ curl_easy_cleanup(curl); On Mar 27, 2024, at 11:53 AM, Stefan Eissing <> wrote: Am 27.03.2024 um 12:05 schrieb Matt Barnett via curl-library <>: Hi All I have noticed a possible issue in 8.7.1... I am using libcurl within Visual Studio 2019 C++ on Win x64 to upload files via SFTP With 8.6.0 all works great but when I compile the same project using libs built against 8.7.1 I see the following error : * client read function EOF fail, only 127391/129435 of needed bytes read Before I upload the file I do output the file_info.st_size to my log and it confirms my local file size as 129435 bytes I think the issue is related to the changes in "file: use xfer buf for file:// transfers [23]" Before I waste anyone's time by raising a bug (and before I investigate myself with my admittedly rusty c skills) I wondered if anyone else was seeing the same? First time post to the list - hope I've followed the rules Hi Matt, that sounds like a bug in the refactored code. We would need more information like how you setup the transfer and a log to find out what is going wrong for you. It's probably best to do that in a github issue. Kind Regards, Stefan -- Unsubscribe: Etiquette:

Received on 2024-03-27