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.
The text was updated successfully, but these errors were encountered:
Hi, That was quick 😊 Could you give me a quick pointer on how to obtain that #4833 version/patch? Ruurd From: Daniel Stenberg <email@example.com> Sent: Tuesday, 28 January 2020 10:31 To: curl/curl <firstname.lastname@example.org> Cc: Ruurd Beerstra <Ruurd.Beerstra@infor.com>; Author <email@example.com> Subject: Re: [curl/curl] SMTP binary file transfer using a callback results in corrupted file (#4860) Sent by an external sender ------------------------------------ @monnerat<https://github.com/monnerat> is redoing that callback logic in #4833<#4833>, it would be most interesting if you would be able to try that patch and see if you can still reproduce the problem! — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub<#4860?email_source=notifications&email_token=AKYUE3REYCOA6NHJBLIVDCTQ773N7A5CNFSM4KMPBV5KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKCTVJA#issuecomment-579156644>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKYUE3XUA7YQK63K4NR6UNTQ773N7ANCNFSM4KMPBV5A>.
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!