summaryrefslogtreecommitdiffstats
path: root/Lib/email
Commit message (Collapse)AuthorAgeFilesLines
* #14983: always add a line end after a MIME boundary marker.R David Murray2014-02-081-2/+1
| | | | | | | | | This is more RFC compliant (see issue) and fixes a problem with signature verifiers rejecting the part when signed. There is some amount of backward compatibility concern here since it changes the output, but the RFC issue coupled with fixing the problem with signature verifiers seems worth the small risk of breaking code that depends on the current incorrect output.
* #16983: Apply postel's law to encoded words inside quoted strings.R David Murray2014-02-081-0/+7
| | | | | | | | | | This applies only to the new parser. The old parser decodes encoded words inside quoted strings already, although it gets the whitespace wrong when it does so. This version of the patch only handles the most common case (a single encoded word surrounded by quotes), but I haven't seen any other variations of this in the wild yet, so its good enough for now.
* #19772: Do not mutate message when downcoding to 7bit.R David Murray2014-02-081-0/+14
| | | | | | | | | This is a bit of an ugly hack because of the way generator pieces together the output message. The deepcopys aren't too expensive, though, because we know it is only called on messages that are not multiparts, and the payload (the thing that could be large) is an immutable object. Test and preliminary work on patch by Vajrasky Kok.
* #17369: Improve handling of broken RFC2231 values in get_filename.R David Murray2014-02-071-0/+4
| | | | This fixes a regression relative to python2.
* #19063: the unicode-in-set_payload problem isn't getting fixed in 3.4.R David Murray2014-02-071-4/+3
|
* #20206, #5803: more efficient algorithm that doesn't truncate output.R David Murray2014-01-131-82/+60
| | | | | | | | This fixes an edge case (20206) where if the input ended in a character needing encoding but there was no newline on the string, the last byte of the encoded character would be dropped. The fix is to use a more efficient algorithm, provided by Serhiy Storchaka (5803), that does not have the bug.
* #19063: partially fix set_payload handling of non-ASCII string input.R David Murray2013-12-112-11/+26
| | | | | | This is a backward compatible partial fix, the complete fix requires raising an error instead of accepting the invalid input, so the real fix is only suitable for 3.4.
* #19485: clarify get_param example.R David Murray2013-11-031-1/+1
| | | | Patch by Vajrasky Kok.
* #18324: set_payload now correctly handles binary input.R David Murray2013-08-222-16/+6
| | | | | | | | | | | This also backs out the previous fixes for for #14360, #1717, and #16564. Those bugs were actually caused by the fact that set_payload didn't decode to str, thus rendering the model inconsistent. This fix does mean the data processed by the encoder functions goes through an extra encode/decode cycle, but it means the model is always consistent. Future API updates will provide a better way to encode payloads, which will bypass this minor de-optimization. Tests by Vajrasky Kok.
* Fix a couple of typos.Ezio Melotti2013-08-102-4/+4
|
* #18437: fix comment typo.R David Murray2013-07-131-1/+1
|
* #18431: Decode encoded words in atoms in new email parser.R David Murray2013-07-121-2/+21
| | | | | | There is more to be done here in terms of accepting RFC invalid input that some mailers accept, but this covers the valid RFC places where encoded words can occur in structured headers.
* #18044: Fix parsing of encoded words of the form =?utf8?q?=XX...?=R David Murray2013-07-111-36/+7
| | | | | | | | | | The problem was I was only checking for decimal digits after the third '?', not for *hex* digits :(. This changeset also fixes a couple of comment typos, deletes an unused function relating to encoded word parsing, and removed an invalid 'if' test from the folding function that was revealed by the tests written to validate this issue.
* #18380: pass regex flags to the right argument. Patch by Valentina ↵Ezio Melotti2013-07-061-1/+1
| | | | Mukhamedzhanova.
* #14360: make encoders.encode_quopri work.R David Murray2013-06-271-2/+6
| | | | | | | | | There were no tests for the encoders module. encode_base64 worked because it is the default and so got tested implicitly elsewhere, and we use encode_7or8bit internally, so that worked, too. I previously fixed encode_noop, so this fix means that everythign in the encoders module now works, hopefully correctly. Also added an explicit test for encode_base64.
* Merge: #17431: Fix missing import of BytesFeedParser in email.parser.R David Murray2013-03-161-1/+1
|\
| * #17431: Fix missing import of BytesFeedParser in email.parser.R David Murray2013-03-162-1/+5
| | | | | | | | Initial patch contributed by Edmond Burnett.
* | Issue #17047: remove doubled words added in 3.3Terry Jan Reedy2013-03-114-4/+4
| | | | | | | | as reported by Serhiy Storchaka and Matthew Barnett.
* | Merge: PEP8 fixup on previous patch, remove unused imports in test_email.R David Murray2013-03-071-1/+1
|\ \ | |/
| * PEP8 fixup on previous patch, remove unused import in test_email.R David Murray2013-03-072-2/+1
| |
* | Merge: #14645: Generator now emits correct linesep for all parts.R David Murray2013-03-071-4/+18
|\ \ | |/ | | | | | | | | | | | | | | | | Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix.
| * #14645: Generator now emits correct linesep for all parts.R David Murray2013-03-072-4/+53
| | | | | | | | | | | | | | | | | | | | Previously the parts of the message retained whatever linesep they had on read, which means if the messages weren't read in univeral newline mode, the line endings could well be inconsistent. In general sending it via smtplib would result in them getting fixed, but it is better to generate them correctly to begin with. Also, the new send_message method of smtplib does not do the fixup, so that method is producing rfc-invalid output without this fix.
* | Merge: #17171: fix email.encoders.encode_7or8bit when applied to binary data.R David Murray2013-02-111-1/+3
|\ \ | |/
| * #17171: fix email.encoders.encode_7or8bit when applied to binary data.R David Murray2013-02-112-2/+21
| |
* | Merge: #16564: Fix regression in use of encoders.encode_noop with binary data.R David Murray2013-02-092-0/+9
|\ \ | |/
| * #16564: Fix regression in use of encoders.encode_noop with binary data.R David Murray2013-02-093-0/+25
| |
* | Merge: #16948: Fix quopri encoding of non-latin1 character sets.R David Murray2013-02-051-0/+13
|\ \ | |/
| * #16948: Fix quopri encoding of non-latin1 character sets.R David Murray2013-02-052-0/+34
| |
* | #16811: Fix folding of headers with no value in provisional policies.R David Murray2013-02-041-1/+1
| |
* | Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-183-4/+4
|\ \ | |/ | | | | Patch by Serhiy Storchaka.
| * Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-182-3/+3
| | | | | | | | Patch by Serhiy Storchaka.
* | Closes #15925: fix regression in parsedate() and parsedate_tz() that should ↵Georg Brandl2012-09-222-22/+6
| | | | | | | | return None if unable to parse the argument.
* | Merge #15249: Mangle From lines correctly when body contains invalid bytes.R David Murray2012-08-241-0/+2
|\ \ | |/ | | | | Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
| * #15249: Mangle From lines correctly when body contains invalid bytes.R David Murray2012-08-242-1/+17
| | | | | | | | Fix by Colin Su. Test by me, based on a test written by Petri Lehtinen.
* | Issue #665194: Added a small optimizationAlexander Belopolsky2012-08-231-1/+1
| |
* | #665194: fix variable name in exception code path.R David Murray2012-08-231-1/+1
| | | | | | | | | | It was correct in the original patch and I foobared it when I restructured part of the code.
* | #665194: Update email.utils.localtime to use astimezone, and fix bug.R David Murray2012-08-231-29/+22
| | | | | | | | | | | | | | The new code correctly handles historic changes in UTC offsets. A test for this should follow. Original patch by Alexander Belopolsky.
* | Merge #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-231-2/+10
|\ \ | |/
| * #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-232-2/+32
| |
* | #15160: Extend the new email parser to handle MIME headers.R David Murray2012-06-242-18/+943
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code passes all the same tests that the existing RFC mime header parser passes, plus a bunch of additional ones. There are a couple of commented out tests where there are issues with the folding. The folding doesn't normally get invoked for headers parsed from source, and the cases are marginal anyway (headers with invalid binary data) so I'm not worried about them, but will fix them after the beta. There are things that can be done to make this API even more convenient, but I think this is a solid foundation worth having. And the parser is a full RFC parser, so it handles cases that the current parser doesn't. (There are also probably cases where it fails when the current parser doesn't, but I haven't found them yet ;) Oh, yeah, and there are some really ugly bits in the parser for handling some 'postel' cases that are unfortunately common. I hope/plan to to eventually refactor a lot of the code in the parser which should reduce the line count...but there is no escaping the fact that the error recovery is welter of special cases.
* | Issue #14653: email.utils.mktime_tz() no longer relies on systemAlexander Belopolsky2012-06-221-4/+4
|\ \ | |/ | | | | mktime() when timezone offest is supplied.
| * Issue #14653: email.utils.mktime_tz() no longer relies on systemAlexander Belopolsky2012-06-222-4/+10
| | | | | | | | mktime() when timezone offest is supplied.
* | Merge: Update out of date docstring.R David Murray2012-06-171-7/+5
|\ \ | |/
| * Update out of date docstring.R David Murray2012-06-171-7/+5
| |
* | Now that Defects are Exception subclasses, call super.R David Murray2012-06-091-0/+5
| | | | | | | | | | | | | | | | The behavior of MessageDefect is legacy behavior. The chances anyone is actually using the undocumented 'line' attribute is low, but it costs little to retain backward compatibility. Although one of the costs is having to restore normal exception behavior in HeaderDefect. On the other hand, I'll probably add some specialized behavior there later.
* | #1079: Fix parsing of encoded words.R David Murray2012-06-021-4/+41
| | | | | | | | | | | | | | | | | | This is a behavior change: before this leading and trailing spaces were stripped from ASCII parts, now they are preserved. Without this fix we didn't parse the examples in the RFC correctly, so I think breaking backward compatibility here is justified. Patch by Ralf Schlatterbeck.
* | Don't use metaclasses when class decorators can do the job.R David Murray2012-05-312-26/+22
| | | | | | | | | | Thanks to Nick Coghlan for pointing out that I'd forgotten about class decorators.
* | #10839: raise an error on add of duplicate unique headers in new email policiesR David Murray2012-05-293-0/+37
| | | | | | | | | | | | | | | | | | | | | | This feature was supposed to be part of the initial email6 checkin, but it got lost in my big refactoring. In this patch I'm not providing an easy way to turn off the errors, but they only happen when a header is added programmatically, and it is almost never the right thing to do to allow the duplicate to be added. An application that needs to add duplicates of unique headers can create a policy subclass to allow it.
* | #12515: email now registers a defect if the MIME end boundary is missing.R David Murray2012-05-282-3/+14
| | | | | | | | | | | | This commit also restores the news item for 167256 that it looks like Terry inadvertently deleted. (Either that, or I don't understand now merging works...which is equally possible.)
* | #1672568: email now registers defects for base64 payload format errors.R David Murray2012-05-281-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Which also means that it is now producing *something* for any base64 payload, which is what leads to the couple of older test changes in test_email. This is a slightly backward incompatible behavior change, but the new behavior is so much more useful than the old (you can now *reliably* detect errors, and any program that was detecting errors by sniffing for a base64 return from get_payload(decode=True) and then doing its own error-recovery decode will just get the error-recovery decode right away). So this seems to me to be worth the small risk inherent in this behavior change. This patch also refactors the defect tests into a separate test file, since they are no longer just parser tests.