python / cpython

The Python programming language
https://www.python.org
Other
62.47k stars 29.99k forks source link

tiptoe around broken Content-type #37059

Closed smontanaro closed 22 years ago

smontanaro commented 22 years ago
BPO 597593
Nosy @smontanaro, @warsaw
Files
  • generator.diff
  • 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: ```python assignee = 'https://github.com/warsaw' closed_at = created_at = labels = ['library'] title = 'tiptoe around broken Content-type' updated_at = user = 'https://github.com/smontanaro' ``` bugs.python.org fields: ```python activity = actor = 'barry' assignee = 'barry' closed = True closed_date = None closer = None components = ['Library (Lib)'] creation = creator = 'skip.montanaro' dependencies = [] files = ['4525'] hgrepos = [] issue_num = 597593 keywords = ['patch'] message_count = 3.0 messages = ['40979', '40980', '40981'] nosy_count = 2.0 nosy_names = ['skip.montanaro', 'barry'] pr_nums = [] priority = 'normal' resolution = 'fixed' stage = None status = 'closed' superseder = None type = None url = 'https://bugs.python.org/issue597593' versions = ['Python 2.3'] ```

    smontanaro commented 22 years ago

    I have absolutely no idea how common this might be or whether it is correct or not, but I encountered a mail message today with this Content-type header:

    Content-type: text

    The email.Generator.Generator class barfs trying to split the content type:

       main, sub = ctype.split('/')

    The attached patch solves this particular problem. I don't know if it falls into the "be relaxed in what you accept" rubric or not, but the attached patch got me by this particular bump.

    Skip

    warsaw commented 22 years ago

    Logged In: YES user_id=12800

    RFC 2045, section 5.2 states that syntactically invalid Content-Type: headers should use the text/plain default. Thanks for pointing out this bug, I'll work out a more thorough fix.

    warsaw commented 22 years ago

    Logged In: YES user_id=12800

    Patches applied to cvs.