Mercurial > cpython-lru_cache-weakref
comparison Lib/cgi.py @ 72990:8564d2b240b6
default - Fix closes Issue12529 - cgi.parse_header failure on double quotes and
semicolons. Patch by Ben Darnell and Petri Lehtinen.
| author | Senthil Kumaran <senthil@uthcode.com> |
|---|---|
| date | Thu, 20 Oct 2011 01:06:59 +0800 |
| parents | 66e519792e4c f5bd78b11275 |
| children | f82ebf9b3a52 |
comparison
equal
deleted
inserted
replaced
| 72987:3bed4b7b46a9 | 72990:8564d2b240b6 |
|---|---|
| 298 | 298 |
| 299 def _parseparam(s): | 299 def _parseparam(s): |
| 300 while s[:1] == ';': | 300 while s[:1] == ';': |
| 301 s = s[1:] | 301 s = s[1:] |
| 302 end = s.find(';') | 302 end = s.find(';') |
| 303 while end > 0 and s.count('"', 0, end) % 2: | 303 while end > 0 and (s.count('"', 0, end) - s.count('\\"', 0, end)) % 2: |
| 304 end = s.find(';', end + 1) | 304 end = s.find(';', end + 1) |
| 305 if end < 0: | 305 if end < 0: |
| 306 end = len(s) | 306 end = len(s) |
| 307 f = s[:end] | 307 f = s[:end] |
| 308 yield f.strip() | 308 yield f.strip() |
