homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Ben.Darnell
Recipients Ben.Darnell
Date 2011年07月10日.20:56:03
SpamBayes Score 3.477612e-06
Marked as misclassified No
Message-id <1310331365.35.0.0304262740475.issue12529@psf.upfronthosting.co.za>
In-reply-to
Content
cgi.parse_header doesn't work on headers that contain combinations of double quotes and semicolons (although it works with either type of character individually). 
>>> cgi.parse_header('form-data; name="files"; filename="fo\\"o;bar"')
('form-data', {'name': 'files', 'filename': '"fo\\"o'})
This issue is present in python 2.7 and 3.2. One solution is to change _parseparam as follows (same as email.message._parseparam):
def _parseparam(s):
 while s[:1] == ';':
 s = s[1:]
 end = s.find(';')
 while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2:
 end = s.find(';', end + 1)
 if end < 0:
 end = len(s)
 f = s[:end]
 yield f.strip()
 s = s[end:]
History
Date User Action Args
2011年07月10日 20:56:05Ben.Darnellsetrecipients: + Ben.Darnell
2011年07月10日 20:56:05Ben.Darnellsetmessageid: <1310331365.35.0.0304262740475.issue12529@psf.upfronthosting.co.za>
2011年07月10日 20:56:04Ben.Darnelllinkissue12529 messages
2011年07月10日 20:56:03Ben.Darnellcreate

AltStyle によって変換されたページ (->オリジナル) /