Validate a host so it doesn't contain control characters.
(self, host)
| 1304 | f"(found at least {match.group()!r})") |
| 1305 | |
| 1306 | def _validate_host(self, host): |
| 1307 | """Validate a host so it doesn't contain control characters.""" |
| 1308 | # Prevent CVE-2019-18348. |
| 1309 | match = _contains_disallowed_url_pchar_re.search(host) |
| 1310 | if match: |
| 1311 | raise InvalidURL(f"URL can't contain control characters. {host!r} " |
| 1312 | f"(found at least {match.group()!r})") |
| 1313 | |
| 1314 | def putheader(self, header, *values): |
| 1315 | """Send a request header line to the server. |
no test coverage detected