Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

decode_header() fails on multiline headers #46910

Closed
cschnee mannequin opened this issue Apr 19, 2008 · 3 comments
Closed

decode_header() fails on multiline headers #46910

cschnee mannequin opened this issue Apr 19, 2008 · 3 comments
Labels
stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error

Comments

@cschnee
Copy link
Mannequin

cschnee mannequin commented Apr 19, 2008

BPO 2658
Nosy @warsaw, @bitdancer
Superseder
  • bpo-1079: decode_header does not follow RFC 2047
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2012-06-03.16:28:42.047>
    created_at = <Date 2008-04-19.12:41:33.120>
    labels = ['type-bug', 'library', 'expert-email']
    title = 'decode_header() fails on multiline headers'
    updated_at = <Date 2012-06-03.16:28:42.046>
    user = 'https://bugs.python.org/cschnee'

    bugs.python.org fields:

    activity = <Date 2012-06-03.16:28:42.046>
    actor = 'r.david.murray'
    assignee = 'none'
    closed = True
    closed_date = <Date 2012-06-03.16:28:42.047>
    closer = 'r.david.murray'
    components = ['Library (Lib)', 'email']
    creation = <Date 2008-04-19.12:41:33.120>
    creator = 'cschnee'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 2658
    keywords = []
    message_count = 3.0
    messages = ['65630', '162220', '162222']
    nosy_count = 4.0
    nosy_names = ['barry', 'cschnee', 'r.david.murray', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'resolved'
    status = 'closed'
    superseder = '1079'
    type = 'behavior'
    url = 'https://bugs.python.org/issue2658'
    versions = ['Python 3.3']

    @cschnee
    Copy link
    Mannequin Author

    cschnee mannequin commented Apr 19, 2008

    email.Header.decode_header() does not correctly deal with multiline
    Headerlines.
    header.py in revision 54371 (1) changes the behaviour, whereas
    previously multiline headers where parsed correctly, header.py 54371
    introduced a new regex part, that renders such headers invalid and they
    won't be parsed as expected.
    Given the following header line (doesn't matter if its parsed from a
    mail or read from a string) which represents IMHO a valid RFC2047 header
    line:

    from email.Header import decode_header
    decode_header('=?windows-1252?Q?=22M=FCller_T=22?=\r\n <T.Mueller@xxx.com>')

    this will result in:
    header.py (54371):
    [('=?windows-1252?Q?=22M=FCller_T=22?=\r\n <T.Mueller@xxx.com>', None)]

    resp. with header.py (54370):
    [('"M\xfcller T"', 'windows-1252'), (' <T.Mueller@xxx.com>', None)]

    Actually both seem parsed wrong, but with 54370 the result looks more
    sane (the space should be IMO removed). 
    Once the CRLF sequence is removed from the header it works fine and all
    looks as expected:
    >>> decode_header('=?windows-1252?Q?=22M=FCller_T=22?= <T.Mueller@xxx.com>')
    [('"M\xfcller T"', 'windows-1252'), ('<T.Mueller@xxx.com>', None)]

    This problem might or might not be related to

    (1) http://svn.python.org/view?rev=54371&view=rev

    @cschnee cschnee mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Apr 19, 2008
    @warsaw warsaw assigned bitdancer and unassigned warsaw May 5, 2010
    @bitdancer bitdancer removed their assignment May 16, 2012
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jun 3, 2012

    New changeset 0808cb8c60fd by R David Murray in branch 'default':
    bpo-2658: Add test for issue fixed by fix for bpo-1079.
    http://hg.python.org/cpython/rev/0808cb8c60fd

    @bitdancer
    Copy link
    Member

    This is fixed by the fix for bpo-1079. I've added the test to the test suite.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir topic-email type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants