Page 1 of 1
Problems with LibCurl.dll
Posted: Sun Feb 12, 2023 9:55 pm
by RichAlgeni
Many of us use Curl here, including myself, for interacting with Email servers. Specifically, I have a client who receives invoices via email. I have a process that reads this email, looks for enclosed pdf's, extracts pdf's, marks the message read, and moves it to an archive folder. I cannot have one process that does this, and some versions of libcurl.dll do not read the email correctly, and other versions do not copy email to another folder correctly. Before I confirmed this, I tested on Windows 10, Windows 11 and Windows Server 2019 machines. I also tested with Yahoo, Google, GoDaddy and Outlook email servers. Once I confirmed these bugs, I reported them to the Curl team, which included detailed logs showing the different versions involved, and even volunteering using email account I had previously setup, to help debug their libraries. The Curl team promptly responded with insults, claiming that I was obviously doing something wrong, and that I should never include personal data in shared logs. Not feeling the love, I responded back that I was familiar with lazy coders, but that I would still be willing to help them. Days passed, and when no one responded, I left another snarky comment, the exact substance of which I cannot recall. Suffice it to say, in my waning years, I have very little patience for things done 'half-assed.' What I ended up doing was I wrote two services, one using libcurl version 7.64.1.1 to do the reading of email, and the other using libcurl version 7.56.1.0 to do the moving to archive folders.
If you need more information, just let me know.
Re: Problems with LibCurl.dll
Posted: Sun Feb 12, 2023 10:47 pm
by infratec
Have you also tested the latest version 7.87.0 ?
Re: Problems with LibCurl.dll
Posted: Mon Feb 13, 2023 1:32 am
by RichAlgeni
No. The last one I tested was 7.84.0.0
I will test the new one this week.
Re: Problems with LibCurl.dll
Posted: Fri Feb 17, 2023 2:19 am
by RichAlgeni
I will need to place the actual program online, as it, along with the results, is too big for this forum.
Here are the results:
Code: Select all
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Inbox/'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 269
* 43 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] Permanent flags
* OK [UNSEEN 42] Is the first unseen message
* OK [UIDVALIDITY 14] UIDVALIDITY value
* OK [UIDNEXT 1052] The next unique identifier value
--------------------------------------------------------------------------------------------------
ExtractRequiredNumber() > numberPrefix = '[UNSEEN '
ExtractRequiredNumber() > lengthPrefix = 8
ExtractRequiredNumber() > numberSuffix = ']'
ExtractRequiredNumber() > foundPrefix = 134
ExtractRequiredNumber() > foundSuffix = 144
ExtractRequiredNumber() > begPosition = 11010317
ExtractRequiredNumber() > messageNumLen = 2
ExtractRequiredNumber() > Extracted Num = 42
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'fetch 42 uid'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 23
* 42 FETCH (UID 1021)
--------------------------------------------------------------------------------------------------
ExtractRequiredNumber() > numberPrefix = '(UID '
ExtractRequiredNumber() > lengthPrefix = 5
ExtractRequiredNumber() > numberSuffix = ')'
ExtractRequiredNumber() > foundPrefix = 12
ExtractRequiredNumber() > foundSuffix = 21
ExtractRequiredNumber() > begPosition = 11010192
ExtractRequiredNumber() > messageNumLen = 4
ExtractRequiredNumber() > Extracted Num = 1021
--------------------------------------------------------------------------------------------------
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
lastExist count in Archive/new_domain/2023 is 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid copy 1021 Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
nextExist count in Archive/new_domain/2023 is 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid copy 1021 Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
nextExist count in Archive/new_domain/2023 is 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid copy 1021 Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
nextExist count in Archive/new_domain/2023 is 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid copy 1021 Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
nextExist count in Archive/new_domain/2023 is 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid copy 1021 Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Archive/new_domain/2023'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 220
nextExist count in Archive/new_domain/2023 is 0
Initial count in Archive/new_domain/2023 was 0, new count is 0, copy was Not successful
curl_easy_cleanup() complete
You'll notice
CURLE_OK is returned, but the copy never actually succeeds. In case you're wondering, I used every combination of beginning slashes and end slashes, the results are the same.
Re: Problems with LibCurl.dll
Posted: Fri Feb 17, 2023 2:31 am
by RichAlgeni
Here is the program itself. You will need to update the user name and password to your own.
https://rca2.com/PB/curl_imap_test.txt
Re: Problems with LibCurl.dll
Posted: Fri Feb 17, 2023 5:48 pm
by RichAlgeni
I have updated the code at the link above to read in the message, and mark it read. We a number of different versions of
libdurl.dll, this is the response:
Code: Select all
imapsUrl = imaps://outlook.office.com/
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/', customRequest = 'EXAMINE Inbox/'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 269
* 43 EXISTS
* 0 RECENT
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)
* OK [PERMANENTFLAGS ()] Permanent flags
* OK [UNSEEN 42] Is the first unseen message
* OK [UIDVALIDITY 14] UIDVALIDITY value
* OK [UIDNEXT 1058] The next unique identifier value
--------------------------------------------------------------------------------------------------
ExtractRequiredNumber() > numberPrefix = '[UNSEEN '
ExtractRequiredNumber() > lengthPrefix = 8
ExtractRequiredNumber() > numberSuffix = ']'
ExtractRequiredNumber() > foundPrefix = 134
ExtractRequiredNumber() > foundSuffix = 144
ExtractRequiredNumber() > begPosition = 11878605
ExtractRequiredNumber() > messageNumLen = 2
ExtractRequiredNumber() > Extracted Num = 42
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'fetch 42 uid'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 23
* 42 FETCH (UID 1021)
--------------------------------------------------------------------------------------------------
ExtractRequiredNumber() > numberPrefix = '(UID '
ExtractRequiredNumber() > lengthPrefix = 5
ExtractRequiredNumber() > numberSuffix = ')'
ExtractRequiredNumber() > foundPrefix = 12
ExtractRequiredNumber() > foundSuffix = 21
ExtractRequiredNumber() > begPosition = 11878480
ExtractRequiredNumber() > messageNumLen = 4
ExtractRequiredNumber() > Extracted Num = 1021
--------------------------------------------------------------------------------------------------
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox/', customRequest = 'uid store 1021 +Flags \Seen'
PBCurlEasyPerform() > Response = 0 - CURLE_OK, receiveAmount = 0
--------------------------------------------------------------------------------------------------
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox;uid=1021
PBCurlEasyPerform() > Error = 78 - Remote file not found
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox;uid=1021
PBCurlEasyPerform() > Error = 78 - Remote file not found
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox;uid=1021
PBCurlEasyPerform() > Error = 78 - Remote file not found
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox;uid=1021
PBCurlEasyPerform() > Error = 78 - Remote file not found
PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox;uid=1021
PBCurlEasyPerform() > Error = 78 - Remote file not found
We were unable to read in the message body
The code does succeed in marking the message as 'read,' but it does not succeed in reading the message body.
Re: Problems with LibCurl.dll
Posted: Fri Feb 17, 2023 6:45 pm
by RichAlgeni
And here is the link to a zip file containing two libcurl dll's. One that read successfully, but does not copy. The other copies successfully, but will not read.
Re: Problems with LibCurl.dll
Posted: Wed Feb 22, 2023 10:54 pm
by RichAlgeni
One more thing I must add, the first time, every time, the code tries to mark a message as deleted, a CURLE_QUOTE_ERROR is returned. One second later, with the exact same syntax, mark as delete returns successfully.
Code: Select all
2023-02-22 12:14:17 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15235 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-22 09:21:10 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15233 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-22 07:39:04 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15231 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-21 20:38:56 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15226 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-21 20:13:51 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15224 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-21 03:55:39 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15220 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-20 22:07:32 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15214 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-20 20:53:26 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15212 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-20 20:52:20 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15210 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-20 14:34:10 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15207 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST
2023-02-20 14:01:03 ProcessArchiving() > PBCurlEasyPerform() > curlURL = 'imaps://outlook.office.com/Inbox', customRequest = 'uid store 15205 +Flags \Deleted' error = 21 - CURLE_QUOTE_ERROR or error in #CURLOPT_CUSTOMREQUEST