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