[Python-Dev] Parameters in message headers (original) (raw)
Gustavo Niemeyer niemeyer@conectiva.com
Sun, 7 Apr 2002 18:49:57 -0300
- Previous message: [Python-Dev] IDLE patch (was: Searching Python docs)
- Next message: [Python-Dev] Re: Parameters in message headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Barry!
I've had some problems with messages which doesn't follow the RFC when regarding to parameter building. More specificaly, I've found the following header in a message (in one line):
Content-Type: multipart/mixed; boundary = b71528a4d486932a8bdd3c50d1048d7c7
This breaks the email package because, following the RFC, there should be no spaces surrounding the "=" symbol, and the Message class, as expected, breaks this spliting in "=". OTOH, the RFC defines parameters as follows:
parameter := attribute "=" value
attribute := token ; Matching of attributes ; is ALWAYS case-insensitive.
value := token / quoted-string
token := 1*<any (US-ASCII) CHAR except SPACE, CTLs, or tspecials>
So, there's no chance of finding a space surrounding "=", unless the parameter is not written as defined in the RFC. Thus, it's safe to strip the name and value fields.
If you choose to keep following the RFC strictly, I'll understand. OTOH, parsing bad written headers safely would be nice as well. I can send a patch, if necessary.
Thanks!
-- Gustavo Niemeyer
[ 2AAC 7928 0FBF 0299 5EB5 60E2 2253 B29A 6664 3A0C ]
- Previous message: [Python-Dev] IDLE patch (was: Searching Python docs)
- Next message: [Python-Dev] Re: Parameters in message headers
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]