summaryrefslogtreecommitdiffstats
path: root/Lib/email/test/test_email.py
Commit message (Collapse)AuthorAgeFilesLines
* [2.7] bpo-34155: Dont parse domains containing @ (GH-13079) (GH-16006)Roberto C. Sánchez2019-09-141-0/+14
| | | | | | | | | | | | | This change skips parsing of email addresses where domains include a "@" character, which can be maliciously used since the local part is returned as a complete address. (cherry picked from commit 8cb65d1381b027f0b09ee36bfed7f35bb4dec9a9) Excludes changes to Lib/email/_header_value_parser.py, which did not exist in 2.7. Co-authored-by: jpic <jpic@users.noreply.github.com> https://bugs.python.org/issue34155
* Issue #27895: Spelling fixes (Contributed by Ville Skyttä).Martin Panter2016-09-071-2/+2
|
* Correct misspellings of ISO-8859Martin Panter2016-08-101-2/+2
|
* Issue #6598: Avoid clock wrapping around in test_make_msgid_collisions.Serhiy Storchaka2015-11-101-1/+1
| | | | Use time.time instead of time.clock.
* Issue #6598: Increased time precision and random number range inSerhiy Storchaka2015-05-191-1/+24
| | | | email.utils.make_msgid() to strengthen the uniqueness of the message ID.
* Decreased memory requirements of new tests added in issue21448.Serhiy Storchaka2014-08-121-1/+2
|
* Issue #21448: Fixed FeedParser feed() to avoid O(N**2) behavior when parsing ↵Serhiy Storchaka2014-08-121-5/+52
| | | | | | long line. Original patch by Raymond Hettinger.
* #14983: always add a line end after a MIME boundary marker.R David Murray2014-02-081-5/+10
| | | | | | | | | 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.
* Issue #19590: Use specific asserts in email tests.Serhiy Storchaka2013-11-161-82/+70
|
* #15232: correctly mangle From lines in MIME preamble and epilogueR David Murray2012-07-231-0/+23
|
* Fixed the name of the 'email.Utils' module in tests.Alexander Belopolsky2012-06-221-2/+2
|
* Issue #14653: email.utils.mktime_tz() no longer relies on systemAlexander Belopolsky2012-06-221-0/+6
| | | | mktime() when timezone offest is supplied.
* Merged revisions 87873 via svnmerge fromR. David Murray2011-01-091-0/+11
| | | | | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87873 | r.david.murray | 2011-01-08 21:35:24 -0500 (Sat, 08 Jan 2011) | 12 lines #5871: protect against header injection attacks. This makes Header.encode throw a HeaderParseError if it winds up formatting a header such that a continuation line has no leading whitespace and looks like a header. Since Header accepts values containing newlines and preserves them (and this is by design), without this fix any program that took user input (say, a subject in a web form) and passed it to the email package as a header was vulnerable to header injection attacks. (As far as we know this has never been exploited.) Thanks to Jakub Wilk for reporting this vulnerability. ........
* #1379416: encode charset name to ascii to avoid unicode promotion of outputR. David Murray2010-12-271-0/+7
|
* Merged revisions 87415 via svnmerge fromR. David Murray2010-12-211-0/+11
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r87415 | r.david.murray | 2010-12-21 13:07:59 -0500 (Tue, 21 Dec 2010) | 4 lines Fix the change made for issue 1243654. Surprisingly, it turns out there was no test that exercised this code path. ........
* #1078919: document requirement to use triples for non-ascii add_header parms.R. David Murray2010-12-141-0/+15
|
* Merged revisions 86596 via svnmerge fromEzio Melotti2010-11-211-30/+30
| | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line #9424: Replace deprecated assert* methods in the Python test suite. ........
* Merged revisions 85179 via svnmerge fromR. David Murray2010-10-021-0/+18
| | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85179 | r.david.murray | 2010-10-02 11:58:26 -0400 (Sat, 02 Oct 2010) | 6 lines #1050268: make parseaddr 'quote' the contents of quoted strings in addresses. Also made the doc string for email._parseaddr's 'quote' function more accurate; I'd love to make the function match the old docstring instead, but other code uses it according the existing semantics. ........
* Merged revisions 85142 via svnmerge fromR. David Murray2010-10-011-0/+6
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r85142 | r.david.murray | 2010-10-01 11:40:20 -0400 (Fri, 01 Oct 2010) | 5 lines #10004: in Q encoded word ignore '=xx' when xx is not valid hex. Bug report and fix by Thomas Guettler. ........
* Merged revisions 84310 via svnmerge fromR. David Murray2010-08-251-0/+13
| | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r84310 | r.david.murray | 2010-08-24 20:45:55 -0400 (Tue, 24 Aug 2010) | 8 lines #1194222: make parsedate always return RFC2822 four character years. Two character years are now converted to four character years using the Posix standard rule (<68 == 2000, >=68==1900). This makes the parsed date RFC2822 compliant even if the input is not. Patch and test by Jeffrey Finkelstein. ........
* Merged revisions 83690 via svnmerge fromR. David Murray2010-08-041-1/+10
| | | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r83690 | r.david.murray | 2010-08-03 18:14:10 -0400 (Tue, 03 Aug 2010) | 10 lines #3196: if needed pad a short base64 encoded word before trying to decode. The RFCs encourage following Postel's law: be liberal in what you accept. So if someone forgot to pad the base64 encoded word payload to an even four bytes, we add the padding before handing it to base64mime.decode. Previously, missing padding resulted in a HeaderParseError. Patch by Jason Williams. ........
* Merged revisions 82922 via svnmerge fromR. David Murray2010-07-171-0/+33
| | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/branches/py3k ........ r82922 | r.david.murray | 2010-07-16 21:19:57 -0400 (Fri, 16 Jul 2010) | 4 lines #1555570: correctly handle a \r\n that is split by the read buffer. Patch and test by Tony Nelson. ........
* #4487: have Charset check with codecs for possible aliases.R. David Murray2010-06-041-0/+3
| | | | | | | | | Previously, unexpected results occurred when email was passed, for example, 'utf8' as a charset name, since email would accept it but would *not* use the 'utf-8' codec for it, even though Python itself recognises that as an alias for utf-8. Now Charset checks with codecs for aliases as well as its own internal table. Issue 8898 has been opened to change this further in py3k so that all aliasing is routed through the codecs module.
* #5610: use \Z not $ so we don't eat extra chars when body part ends with \r\n.R. David Murray2010-06-031-0/+18
| | | | | | | | | | 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.
* #1368247: make set_charset/MIMEText automatically encode unicode _payload.R. David Murray2010-06-021-0/+25
| | | | | | | | Fixes (mysterious, to the end user) UnicodeErrors when using utf-8 as the charset and unicode as the _text argument. Also makes the way in which unicode gets encoded to quoted printable for other charsets more sane (it only worked by accident previously). The _payload now is encoded to the charset.output_charset if it is unicode.
* Issue #7472: remove unused code from email.encoders.encode_7or8bit.R. David Murray2010-05-051-0/+7
| | | | | | | | | Yukihiro Nakadaira noticed a typo in encode_7or8bit that was trying to special case iso-2022 codecs. It turns out that the code in question is never used, because whereas it was designed to trigger if the payload encoding was eight bit but its output encoding was 7 bit, in practice the payload is always converted to the 7bit encoding before encode_7or8bit is called. Patch by Shawat Anand.
* Rephrase comment.Ezio Melotti2010-04-221-2/+2
|
* #8474: fix duplicate test in test_email.Ezio Melotti2010-04-221-5/+0
|
* Issue #5277: Fix quote counting when parsing RFC 2231 encoded parameters.R. David Murray2010-04-131-0/+8
|
* Issue #7143: get_payload used to strip any trailing newline from aR. David Murray2010-03-081-1/+5
| | | | | | | | | | base64 transfer-encoded payload *after* decoding it; it no longer does. email had a special method in utils, _bdecode, specifically to do this, so it must have served a purpose at some point, yet it is clearly wrong per RFC. Fixed with Barry's approval, but no backport. Email package minor version number is bumped, now version 4.0.1. Patch by Joaquin Cuenca Abela.
* Issue 7970: When email.Parser.Parser parses a MIME message of typeR. David Murray2010-02-211-0/+12
| | | | | | | | | | message/rfc822 it turns it into an object whose body consists of a list containing a single Message object. HeaderParser, on the other hand, just copies the body as a string. Generator.flatten has a special handler for the message mime type that expected the body to be the one item list. This fails if the message was parsed by HeaderParser. So we now check to see if the body is a string first, and if so just we just emit it.
* #7092: Silence more py3k warnings. Patch by Florent Xicluna.Ezio Melotti2010-02-031-1/+1
|
* Fix issue number in comment.R. David Murray2010-01-161-1/+1
|
* Issue #1670765: Prevent email.generator.Generator from re-wrappingR. David Murray2010-01-161-0/+36
| | | | | | headers in multipart/signed MIME parts, which fixes one of the sources of invalid modifications to such parts by Generator. Patch and tests by Martin von Gagern.
* Kill a couple of "<>"Antoine Pitrou2010-01-041-2/+2
|
* More yearly updates.Georg Brandl2010-01-011-1/+1
|
* convert usage of fail* to assert*Benjamin Peterson2009-06-301-45/+45
|
* A fix for issue 1974, inspired by the patch from Andi Albrecht (aalbrecht),Barry Warsaw2009-03-301-27/+36
| | | | | | though with some changes by me. This patch should not be back ported or forward ported. It's a bit too risky for 2.6 and 3.x does things fairly differently.
* Fix issue #1822: MIMEMultipart.is_multipart() behaves correctly for aFacundo Batista2008-01-191-0/+3
| | | | | just-created (and empty) instance. Added tests for this. Thanks Jonathan Share.
* In response to this SF bug:Barry Warsaw2007-07-131-0/+12
| | | | | | | | | | [ 1752723 ] email.message_from_string: initial line gets discarded I added a test to assert that when the first line of text passed to message_from_string() contains a leading space, the message ends up with the appropriate FirstHeaderLineIsContinuationDefect on its defects list. The bug is invalid.
* SF bug #1582282; decode_header() incorrectly splits not-conformant RFCBarry Warsaw2007-03-141-0/+12
| | | | | | | 2047-like headers where there is no whitespace between encoded words. This fix changes the matching regexp to include a trailing lookahead assertion that the closing ?= must be followed by whitespace, newline, or end-of-string. This also changes the regexp to add the MULTILINE flag.
* Patch #1449244: Support Unicode strings inMartin v. Löwis2007-03-131-0/+7
| | | | | email.message.Message.{set_charset,get_content_charset}. Will backport.
* Tokio Kikuchi's fix for SF bug #1629369; folding whitespace allowed in theBarry Warsaw2007-03-121-1/+7
| | | | | | | | | display name of an email address, e.g. Foo \tBar <foo@example.com> Test case added by Barry.
* Forward port some fixes that were in email 2.5 but for some reason didn't makeBarry Warsaw2006-07-261-0/+44
| | | | | | | it into email 4.0. Specifically, in Message.get_content_charset(), handle RFC 2231 headers that contain an encoding not known to Python, or a character in the data that isn't in the charset encoding. Also forward port the appropriate unit tests.
* More RFC 2231 improvements for the email 4.0 package. As Mark Sapiro rightlyBarry Warsaw2006-07-211-9/+136
| | | | | | | | | | | | | | | | | | | | | | | | points out there are really two types of continued headers defined in this RFC (i.e. "encoded" parameters with the form "name*0*=" and unencoded parameters with the form "name*0="), but we were were handling them both the same way and that isn't correct. This patch should be much more RFC compliant in that only encoded params are %-decoded and the charset/language information is only extract if there are any encoded params in the segments. If there are no encoded params then the RFC says that there will be no charset/language parts. Note however that this will change the return value for Message.get_param() in some cases. For example, whereas before if you had all unencoded param continuations you would have still gotten a 3-tuple back from this method (with charset and language == None), you will now get just a string. I don't believe this is a backward incompatible change though because the documentation for this method already indicates that either return value is possible and that you must do an isinstance(val, tuple) check to discriminate between the two. (Yeah that API kind of sucks but we can't change /that/ without breaking code.) Test cases, some documentation updates, and a NEWS item accompany this patch.
* Port forward from 2.4 branch:Barry Warsaw2006-05-011-0/+6
| | | | | | | | | | Patch #1464708 from William McVey: fixed handling of nested comments in mail addresses. E.g. "Foo ((Foo Bar)) <foo@example.com>" Fixes for both rfc822.py and email package. This patch needs to be back ported to Python 2.3 for email 2.5.
* The email module's parsedate_tz function now sets the daylight savingsAnthony Baxter2006-04-031-2/+2
| | | | | | flag to -1 (unknown) since it can't tell from the date whether it should be set. patch from Aldo Cortesi
* Merge email package 4.0 from the sandbox, including documentation, test cases,Barry Warsaw2006-03-181-52/+73
| | | | and NEWS updates.
* Port relevant patches for SF 1409455 to the trunk for email 3.0/Python 2.5.Barry Warsaw2006-02-081-1/+2
| | | | Will port to Python 2.4.
* Resolves SF bug #1423972.Barry Warsaw2006-02-041-2/+4
|