| 465 | raise |
| 466 | |
| 467 | def test_unicode_whitespace(self): |
| 468 | # Only tabs and spaces are to be stripped according to the HTTP standard. |
| 469 | # Other unicode whitespace is to be left as-is. In the context of headers, |
| 470 | # this specifically means the whitespace characters falling within the |
| 471 | # latin1 charset. |
| 472 | whitespace = [ |
| 473 | (" ", True), # SPACE |
| 474 | ("\t", True), # TAB |
| 475 | ("\u00a0", False), # NON-BREAKING SPACE |
| 476 | ("\u0085", False), # NEXT LINE |
| 477 | ] |
| 478 | for c, stripped in whitespace: |
| 479 | headers = HTTPHeaders.parse("Transfer-Encoding: %schunked" % c) |
| 480 | if stripped: |
| 481 | expected = [("Transfer-Encoding", "chunked")] |
| 482 | else: |
| 483 | expected = [("Transfer-Encoding", "%schunked" % c)] |
| 484 | self.assertEqual(expected, list(headers.get_all())) |
| 485 | |
| 486 | def test_optional_cr(self): |
| 487 | # Bare CR is not a valid line separator |