summaryrefslogtreecommitdiffstats
path: root/Lib/email/feedparser.py
Commit message (Collapse)AuthorAgeFilesLines
* bpo-30835: email: Fix AttributeError when parsing invalid CTE (GH-13598)Abhilash Raj2019-06-041-1/+1
| | | | | | | | | | | | | | | | | | | | * bpo-30835: email: Fix AttributeError when parsing invalid Content-Transfer-Encoding Parsing an email containing a multipart Content-Type, along with a Content-Transfer-Encoding containing an invalid (non-ASCII-decodable) byte will fail. email.feedparser.FeedParser._parsegen() gets the header and attempts to convert it to lowercase before comparing it with the accepted encodings, but as the header contains an invalid byte, it's returned as a Header object rather than a str. Cast the Content-Transfer-Encoding header to a str to avoid this. Found using the AFL fuzzer. Reported-by: Daniel Axtens <dja@axtens.net> Signed-off-by: Andrew Donnellan <andrew@donnellan.id.au> * Add email and NEWS entry for the bugfix.
* #20476: Deal with the message_factory circular import differently.R David Murray2016-09-101-1/+5
| | | | | | | It turns out we can't depend on email.message getting imported every place message_factory is needed, so to avoid a circular import we need to special case Policy.message_factory=None in the parser instead of using monkey patching. I had a feeling that was a bad idea when I did it.
* #20476: add a message_factory policy attribute to email.R David Murray2016-09-091-8/+1
|
* #27364: fix "incorrect" uses of escape character in the stdlib.R David Murray2016-09-081-4/+4
| | | | | | | And most of the tools. Patch by Emanual Barry, reviewed by me, Serhiy Storchaka, and Martin Panter.
* #22233: Only split headers on \r and/or \n, per email RFCs.R David Murray2016-09-071-16/+17
| | | | Original patch by Martin Panter, new policy fixes by me.
* #27522: break unintended cycle in feedparser.R David Murray2016-07-161-3/+6
| | | | Patch by Costas.
* Issue #21448: Improve performance of the email feedparserRaymond Hettinger2015-05-231-8/+8
|
* handle headers with no key (closes #19996)Benjamin Peterson2015-01-261-1/+10
| | | | Patch by Cory Benfield.
* Issue #21448: Fixed FeedParser feed() to avoid O(N**2) behavior when parsing ↵Serhiy Storchaka2014-08-121-8/+18
| | | | | | long line. Original patch by Raymond Hettinger.
* #20476: use EmailMessage as factory if non-compat32 policy is used.R David Murray2014-02-071-8/+17
| | | | | In 3.5 I will fix this right by adding a message_factory attribute to the policy.
* #15220: simplify and speed up feedparser's line splitting.R David Murray2013-02-141-18/+9
| | | | | Original patch submitted by QNX, modified for clarity by me (mostly comments). QNX reports a 30% speed up in average email parsing time.
* Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-2/+2
|\ | | | | | | Patch by Serhiy Storchaka.
| * Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov2012-12-181-2/+2
| | | | | | | | Patch by Serhiy Storchaka.
* | #12515: email now registers a defect if the MIME end boundary is missing.R David Murray2012-05-281-3/+11
| | | | | | | | | | | | 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.)
* | #14925: email now registers a defect for missing header/body separator.R David Murray2012-05-281-5/+5
| | | | | | | | | | | | | | This patch also deprecates the MalformedHeaderDefect. My best guess is that this defect was rendered obsolete by a refactoring of the parser, and the corresponding defect for the new parser (which this patch introduces) was overlooked.
* | #14731: refactor email policy framework.R David Murray2012-05-251-10/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch primarily does two things: (1) it adds some internal-interface methods to Policy that allow for Policy to control the parsing and folding of headers in such a way that we can construct a backward compatibility policy that is 100% compatible with the 3.2 API, while allowing a new policy to implement the email6 API. (2) it adds that backward compatibility policy and refactors the test suite so that the only differences between the 3.2 test_email.py file and the 3.3 test_email.py file is some small changes in test framework and the addition of tests for bugs fixed that apply to the 3.2 API. There are some additional teaks, such as moving just the code needed for the compatibility policy into _policybase, so that the library code can import only _policybase. That way the new code that will be added for email6 will only get imported when a non-compatibility policy is imported.
* | Merge #11686: add missing entries to email __all__ lists.R David Murray2012-03-171-1/+1
|\ \ | |/ | | | | Original patch by Steffen Daode Nurpmeso
| * #11686: add missing entries to email __all__ lists.R David Murray2012-03-171-1/+1
| | | | | | | | Original patch by Steffen Daode Nurpmeso
* | #1874: detect invalid multipart CTE and report it as a defect.R David Murray2011-06-221-0/+5
| |
* | #11731: simplify/enhance parser/generator API by introducing policy objects.R David Murray2011-04-181-6/+17
| | | | | | | | | | | | | | | | This new interface will also allow for future planned enhancements in control over the parser/generator without requiring any additional complexity in the parser/generator API. Patch reviewed by Éric Araujo and Barry Warsaw.
* | Remove unused method from internal class.R David Murray2011-04-151-3/+0
|/
* #11605: don't use set/get_payload in feedparser; they do conversions.R David Murray2011-04-061-2/+2
| | | | | Really the whole API needs to be gone over to restore the separation of concerns; but that's what email6 is about.
* #4661: add bytes parsing and generation to email (email version bump to 5.1.0)R. David Murray2010-10-081-0/+7
| | | | | | | | The work on this is not 100% complete, but everything is present to allow real-world testing of the code. The only remaining major todo item is to (hopefully!) enhance the handling of non-ASCII bytes in headers converted to unicode by RFC2047 encoding them rather than replacing them with '?'s.
* #1555570: correctly handle a \r\n that is split by the read buffer.R. David Murray2010-07-171-0/+4
| | | | Patch and test by Tony Nelson.
* Merged revisions 81675 via svnmerge fromR. David Murray2010-06-161-1/+1
| | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r81675 | r.david.murray | 2010-06-03 11:43:20 -0400 (Thu, 03 Jun 2010) | 10 lines #5610: use \Z not $ so we don't eat extra chars when body part ends with \r\n. If a body part ended with \r\n, feedparser, using '$' to terminate its search for the newline, would match on the \r\n, and think that it needed to strip two characters in order to account for the line end before the boundary. That made it chop one too many characters off the end of the body part. Using \Z makes the match correct. Patch and test by Tony Nelson. ........
* Patch# 1258 by Christian Heimes: kill basestring.Guido van Rossum2007-10-161-1/+1
| | | | I like this because it makes the code shorter! :-)
* Copying the email package back, despite its failings.Guido van Rossum2007-08-301-0/+480
|
* Remove the email package for now.Guido van Rossum2007-08-251-480/+0
| | | | | | Once Barry and the email-sig have a working new version we'll add it back. If it doesn't make the 3.0a deadline (release August 31), too bad.
* PEP 3114: rename .next() to .__next__() and add next() builtin.Georg Brandl2007-04-211-2/+2
|
* Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters2006-04-211-0/+480
number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.