Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
SMTP binary file transfer using a callback results in corrupted file #4860
I did this
Transfer a binary file using SMTP. Use the curl_mime_data_cb function to obtain
When other means are used to pass the data to curl (name of a file, text string)
The internal buffering in cURL seems to send a few buffered bytes twice, omitting others.
That produces a file like this :
The attached mime.c example program mails that to me using SMTP. The received mail has an
Small line 003613
There is corruption at that point, always. Part is repeated, another part is missing.
So every 3600-ish lines the problem repeats, showing a buffering problem.
When the "binary" in the test program is changed into "text" (see lines 101/102), the problem does NOT occur.
I expected the following
Binary files should be transferred correctly :-)
I tested with 2 versions: The first is the one we currently incorporate in our producte: curl-7.65.1.
curl -V output:
The 2nd is the latest one from https://curl.haxx.se/download.html: curl-7.68.0
Both fail in exactly the same way.
Bug was spotted on Windows, reproduced on Linux. I think it is OS independent.
Hi, That was quick
Maybe this is not the problem, but you should not use "binary" encoding with SMTP.
That said, I'll investigate if there is a problem with encoders.
1st: I'm much impressed with the speedy responses here and the level of support that actually helps :-)
I did a clone of the latest GIT repository, built and tested: Problem persists.
Good news: Bug is gone, patch #4833 fixes the issue.
@monnerat: A user-program of ours used curl_mime_encoder(part,"binary");
Thanks very much for your support in this!