Opened 3 years ago

Last modified 8 months ago

#24213 new New feature

RFC 2231 Section 4.1 is not implemented

Reported by: Raúl Cumplido Owned by: Raúl Cumplido
Component: HTTP handling Version: master
Severity: Normal Keywords:
Cc: raulcumplido@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Anton Samarchyan)

Currently RFC 2231 Section 4 is implemented (there is a closed PR from me for a fix), but section 4.1 of the RFC is not implemented:
http://tools.ietf.org/html/rfc2231#section-4.1
Section 4.1 is about being able to have parameter continuation when combining Character Set and language Language headers:

Content-Type: application/x-stuff
    title*0*=us-ascii'en'This%20is%20even%20more%20
    title*1*=%2A%2A%2Afun%2A%2A%2A%20
    title*2="isn't it!"

Change History (5)

comment:1 Changed 3 years ago by Raúl Cumplido

Cc: raulcumplido@… added
Needs tests: set
Type: UncategorizedNew feature

comment:2 Changed 3 years ago by Berker Peksag

If I understand you correctly, this is already implemented in the stdlib email module:

from email import message_from_string

s = """\
Content-Type: application/x-stuff;
\ttitle*0*=\"us-ascii'en'This%20is%20even%20more%20\";
\ttitle*1*=\"%2A%2A%2Afun%2A%2A%2A%20\";
\ttitle*2=\"isn't it!\"
"""

m = message_from_string(s)
print(m.get_param('title'))

# output is
# ('us-ascii', 'en', "This is even more ***fun*** isn't it!")

See also https://hg.python.org/cpython/file/default/Lib/test/test_email/test_email.py#l5220 for relevant tests.

comment:3 Changed 3 years ago by Raúl Cumplido

Yes, this is exactly what we should implement. The status is still new so I'll expect someone to Accept it or close it :)

comment:4 Changed 3 years ago by Claude Paroz

Component: UncategorizedHTTP handling
Needs tests: unset
Triage Stage: UnreviewedAccepted

Here you go :-)

comment:5 Changed 8 months ago by Anton Samarchyan

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top