Check if data contains only RFC 9110 token characters.
(self, data)
| 810 | return self._is_valid_token(method) |
| 811 | |
| 812 | def _is_valid_token(self, data): |
| 813 | """Check if data contains only RFC 9110 token characters.""" |
| 814 | if not data: |
| 815 | return False |
| 816 | for c in data: |
| 817 | if c < 0x21 or c > 0x7e: |
| 818 | return False |
| 819 | # RFC 9110 delimiters: "(),/:;<=>?@[\]{} |
| 820 | if c in b'"(),/:;<=>?@[\\]{}"': |
| 821 | return False |
| 822 | return True |
| 823 | |
| 824 | def _has_invalid_header_chars(self, value): |
| 825 | """RFC 9110 section 5.5: only VCHAR, SP, HTAB, and obs-text allowed.""" |
no outgoing calls
no test coverage detected