Ticket #10188: badheader.diff
File badheader.diff, 827 bytes (added by , 16 years ago) |
---|
-
http/__init__.py
263 263 cookiedict[key] = c.get(key).value 264 264 return cookiedict 265 265 266 class BadHeaderError(ValueError): 267 pass 268 266 269 class HttpResponse(object): 267 270 """A basic HTTP response, with content and dictionary-accessed headers.""" 268 271 … … 301 304 def _convert_to_ascii(self, *values): 302 305 """Converts all values to ascii strings.""" 303 306 for value in values: 307 if '\n' in value or '\r' in value: 308 raise BadHeaderError("Header values can't contain newlines (got %r)" % (value)) 304 309 if isinstance(value, unicode): 305 310 try: 306 311 yield value.encode('us-ascii')