[issue1079] decode_header does not follow RFC 2047

2009-04-04 Thread Tony Nelson
Tony Nelson added the comment: The email package does not follow the RFCs in anything to do with header parsing or decoding. This is a known deficiency. So no, I am not thinking of atoms at all -- and neither is email.header.decode_header()! :-( Until email.header actually parses headers

[issue4491] email.Header.decode_header() doesn't work if encoded-word was separeted by CRLF

2009-04-03 Thread Tony Nelson
Tony Nelson added the comment: See patch in issue1079. I don't think email.header can require whitespace until it decodes parsed headers, as whitespace is not always required. -- nosy: +barry, tony_nelson versions: +Python 2.7 ___ Python tr

[issue1079] decode_header does not follow RFC 2047

2009-04-03 Thread Tony Nelson
Tony Nelson added the comment: I think the problem is best viewed as headers are not being parsed according to RFC2822 and decoded after that, so the recognition of encoded words should be looser, and not require whitespace around them, as it is not required in all contexts. Patch and test

[issue4487] Add utf8 alias for email charsets

2009-04-03 Thread Tony Nelson
Changes by Tony Nelson : -- versions: +Python 2.6, Python 2.7 ___ Python tracker <http://bugs.python.org/issue4487> ___ ___ Python-bugs-list mailing list Unsub

[issue4487] Add utf8 alias for email charsets

2009-04-03 Thread Tony Nelson
Tony Nelson added the comment: This seems entirely reasonable, helpful, and in accord with the mapping of ascii to us-ascii. I recommend accepting this patch or a slightly fancier one that would also do "utf_8". There are pobably other encoding names with the same issue of being a

[issue3169] email/header.py doesn't handle Base64 headers that have been insufficiently padded.

2009-04-02 Thread Tony Nelson
Changes by Tony Nelson : -- nosy: +barry ___ Python tracker <http://bugs.python.org/issue3169> ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.pyth

[issue3169] email/header.py doesn't handle Base64 headers that have been insufficiently padded.

2009-04-02 Thread Tony Nelson
Tony Nelson added the comment: Postel's law suggests that, as bad padding can be repaired, decode_header ought to do so. The patch does that, adds a test for it, and alters another test to still properly fail on really bad encoded data. The test doesn't check a single character enco

[issue1555570] email parser incorrectly breaks headers with a CRLF at 8192

2009-04-02 Thread Tony Nelson
Tony Nelson added the comment: The OP's diagnosis of a buffer boundary problem is correct, but incomplete. The problem can be reproduced by calling feedparser FeedParser.feed() directly, or as my patch test does, by calling BufferedSubFile.push() directly. The proper fix is for push

[issue5638] test_httpservers fails CGI tests if --enable-shared

2009-03-31 Thread Tony Nelson
New submission from Tony Nelson : test_httpservers fails the CGI tests if Python was built as a shared library (./config --enable-shared) and not yet installed. To run such a Python without installing it, the command line must define LD_LIBRARY_PATH to point to the build directory. I see that

[issue5610] email feedparser.py CRLFLF bug: $ vs \Z

2009-03-30 Thread Tony Nelson
Tony Nelson added the comment: make test still passes all tests except test_httpservers on my Python 2.6.1 build. The network resource was not enabled and tk is not available. The new test for CRLFLF at the end of a message body is added to Lib/email/test_email at the end of the TestParsers

[issue5610] email feedparser.py CRLFLF bug: $ vs \Z

2009-03-30 Thread Tony Nelson
New submission from Tony Nelson : feedparser.py does not pares mixed newlines properly. NLCRE_eol, which is used to search for the various newlines at End Of Line, uses $ to match the end of string, but $ also matches \n$, due to a wise long-ago patch by the Effbot. This causes feedparser to

[issue1522237] _threading_local.py logic error in _localbase __new__

2009-03-30 Thread Tony Nelson
Tony Nelson added the comment: Thanks, Amaury. The new test works here on Python2.6.1, failing without the fix and passing with it. (Passing MyLocal(a=1) and failing MyLocal(1), as expected.) With the fix, _threading_local.py supports positional arguments to subclass __init__, as well as

[issue795081] email.Message param parsing problem II

2008-03-02 Thread Tony Nelson
Tony Nelson added the comment: If I understand RFC2822 3.2.2. Quoted characters (heh), unquoting must be done in one pass, so the current replace().replace() is wrong. It will change '\\"' to '"', but it should become '\"' when unquoted. This se