aboutsummaryrefslogtreecommitdiffstats
path: root/tests (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix a test failure in testNewFromString (#311)Jan Engelhardt2024-06-111-1/+1
| | | Fixes an oversight in d296c2d1.
* vmime: prevent loss of a space during text::createFromString (#306)Jan Engelhardt2024-05-212-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ``` mailbox(text("Test München West", charsets::UTF_8), "[email protected]").generate(); ``` produces ``` =?us-ascii?Q?Test_?= =?utf-8?Q?M=C3=BCnchen?= =?us-ascii?Q?West?= <[email protected]> ``` The first space between ``Test`` and ``München`` is encoded as an underscore along with the first word: ``Test_``. The second space between ``München`` and ``West`` is encoded with neither of the two words and thus lost. Decoding the text results in ``Test MünchenWest`` instead of ``Test München West``. This is caused by how ``vmime::text::createFromString()`` handles transitions between 7-bit and 8-bit words: If an 8-bit word follows a 7-bit word, a space is appended to the previous word. The opposite case of a 7-bit word following an 8-bit word *misses* this behaviour. When one fixes this problem, a follow-up issue appears: ``text::createFromString("a b\xFFc d")`` tokenizes the input into ``m_words={word("a "), word("b\xFFc ", utf8), word("d")}``. This "right-side alignment" nature of the whitespace is a problem for word::generate(): As per RFC 2047, spaces between adjacent encoded words are just separators but not meant to be displayed. A space between an encoded word and a regular ASCII text is not just a separator but also meant to be displayed. When word::generate() outputs the b-word, it would have to strip one space, but only when there is a transition from encoded-word to unencoded word. word::generate() does not know whether d will be encoded or unencoded. The idea now is that we could change the tokenization of ``text::createFromString`` such that whitespace is at the *start* of words rather than at the end. With that, word::generate() need not know anything about the next word, but rather only the *previous* one. Thus, in this patch, 1. The tokenization of ``text::createFromString`` is changed to left-align spaces and the function is fixed to account for the missing space on transition. 2. ``word::generate`` learns how to steal a space character. 3. Testcases are adjusted to account for the shifted position of the space. Fixes: #283, #284 Co-authored-by: Vincent Richard <[email protected]>
* tests: switch a byte sequence in textTest (#305)Jan Engelhardt2024-05-211-2/+2
| | | | | Switch out the byte sequence by one that is simiarly random, but one which happens to decode as valid UTF-8, such that the expected and actual strings are shown with reasonable characters on a terminal.
* Fixes/comments for guessBestEncoding (#304)Jan Engelhardt2024-05-212-0/+21
| | | | | | | | | | | * tests: add case for getRecommendedEncoding * vmime: avoid integer multiply wraparound in wordEncoder::guessBestEncoding If the input string is 42949673 characters long or larger, there will be integer overflow on 32-bit platforms when multiplying by 100. Switch that one computation to floating point. * vmime: update comment in wordEncoder::guessBestEncoding
* vmime: avoid changing SEVEN_BIT when encoding::decideImpl sees U+007F (#303)Jan Engelhardt2024-05-211-0/+11
| | | | | | | | | | * vmime: avoid changing SEVEN_BIT when encoding::decideImpl sees U+007F Do not switch to QP/B64 when encountering U+007F. U+007F is part of ASCII just as much as U+0001 is. --------- Co-authored-by: Vincent Richard <[email protected]>
* url: strip leading slash from url-path (#298)Jan Engelhardt2024-03-041-10/+10
|
* url: repair off-by-one bug in extractHost (#297)Jan Engelhardt2024-03-041-2/+11
| | | | | | `hostPart[len]` is pointing to `]`, but we need to check the char after that. Fixes: v0.9.2-187-g874a1d8c
* url: support IPv6 literals (RFC 2732) (#292)Jan Engelhardt2024-01-301-0/+20
|
* Fixed possible recursion crash when parsing mailbox groups.vincent-richard2022-01-252-0/+43
|
* Fixed Cppcheck issues.Vincent Richard2021-11-252-1/+2
|
* Prevent accessing empty bufferibanic2021-05-151-0/+27
|
* #261 Workaround for bad SEARCH response with AOL IMAP servervincent-richard2021-05-111-0/+60
|
* SMTP/DSN refactoring.vincent-richard2021-04-031-8/+25
|
* Fixed parsing of IMAP astring.vincent-richard2021-03-241-0/+56
|
* #250 Fixed unquoted mailbox namevincent-richard2021-02-051-0/+56
|
* Fixed implicit declarations and misc warnings.Vincent Richard2021-01-112-2/+2
|
* Avoid force-encoding display names that fit within qcontentJan Engelhardt2020-12-112-1/+14
| | | | | | | | | When the display name contains an At sign, or anything of the sort, libvmime would forcibly encode this to =?...?=, even if the line is fine ASCII which only needs quoting. rspamd takes excessive quoting as a sign of spam and penalizes such mails by raising the score (rule/match: TO_EXCESS_QP et al.)
* Fixed unit test for DSN support.vincent-richard2020-09-021-16/+16
|
* #238 Fixed whitespace between encoded wordsvincent-richard2020-06-161-0/+85
|
* Added test.vincent-richard2020-06-021-0/+10
|
* Fixed false positives in tests.vincent-richard2020-04-061-72/+94
|
* Map '*' to '\*' in non-strict mode.vincent-richard2020-04-061-0/+45
|
* Added support for pipelined and out-of-order replies.vincent-richard2020-04-051-17/+88
|
* Skip delimiter lines that are not exactly equal to the boundaryJan Engelhardt2019-10-051-0/+38
| | | | | | | | There is crap software out there that generates mails violating the prefix ban clause from RFC 2046 §5.1 ¶2. Switch vmime from a prefix match to an equality match, similar to what Alpine and Thunderbird do too.
* Disregard whitespace between leading boundary hyphens and markerJan Engelhardt2019-10-051-3/+3
| | | | | | | | | | | | The way I read the RFC is that whitespace is not allowed before the boundary marker, only afterwards, so the checks for leading WS are removed, and the missing check for trailing WS is added. See RFC 2046 §5.1.1: """The boundary delimiter line is then defined as a line consisting entirely of two hyphen characters ("-", decimal value 45) followed by the boundary parameter value from the Content-Type header field, optional linear whitespace, and a terminating CRLF."""
* Merge branch 'master' of https://github.com/kisli/vmimeVincent Richard2019-04-181-4/+19
|\
| * Improve address parser for malformed mailbox specificationsJan Engelhardt2019-01-251-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | Spammers use "Name <addr> <addr>" to trick some parsers. My expectations as to what the outcome should be is presented in the updated mailboxTest.cpp. The DFA in mailbox::parseImpl is hereby redone so as to pick the rightmost address-looking portion as the address, rather than something in between. While doing so, it will also no longer mangle the name part anymore (it does this by keeping a "as_if_name" variable around until the end).
| * tests: add more malformation tests to mailboxTestJan Engelhardt2019-01-241-4/+19
| |
* | #213 Add support for invalid empty () in FETCH body structure (non-strict)Vincent Richard2019-04-181-0/+31
|/
* Removed 'stringProxy' since COW std::string is no longer valid in C++11.Vincent Richard2018-09-152-220/+0
|
* More tests.Vincent Richard2018-09-051-0/+8
|
* Fixed bug in implementation of isStringEqualNoCase().Vincent Richard2018-09-051-0/+3
|
* Code style and clarity.Vincent Richard2018-09-0566-2288/+2816
|
* Avoid copy by passing shared_ptr<> with const reference.Vincent Richard2018-08-185-7/+7
|
* Added unit test related to PR #192.Vincent Richard2018-03-121-0/+10
|
* Issue #186: SMTPUTF8 is not an argument to RCPT + UTF8 in recipient address ↵Vincent Richard2017-12-142-65/+141
| | | | must switch the whole message to SMTPUTF8.
* Fixed #186: use SMTPUTF8 only when needed.Vincent Richard2017-12-143-0/+268
|
* Issue #168: multiple sequences of 'LF..' not replaced correctly.Vincent Richard2017-03-281-0/+8
|
* Fixed issue #160: invalid characters in hostname.Vincent Richard2017-02-101-0/+28
|
* Issue #163: default encoder (fallback).Vincent Richard2017-02-081-0/+63
|
* Fixed #159: parsing error on invalid FETCH BODYSTRUCTURE response.Vincent Richard2017-01-181-0/+34
|
* Always ignore newlines between words.Vincent Richard2017-01-021-0/+4
|
* Fixed #149: don't loose charset when fixing invalid broken words.Vincent Richard2016-11-051-13/+66
|
* Clarified object construction where 'enabled_shared_from_this' is used. Use ↵Vincent Richard2016-04-055-21/+11
| | | | it only where it is needed.
* Fixed special value 'last' in message sets.Vincent Richard2016-03-243-1/+93
|
* Fixed types.Vincent Richard2016-03-233-3/+3
|
* Issue #126: fixed warnings about sign mismatch.Vincent Richard2016-03-233-3/+3
|
* Issue #126: more warnings fixed.Vincent Richard2016-03-136-12/+14
|
* Fixed possible endless loop with some buffer sizes (thanks to John van der ↵Vincent Richard2015-06-111-0/+51
| | | | Kamp).
* Estimate generated size of parameterized field.Vincent Richard2015-06-071-0/+140
|