| 266 | |
| 267 | |
| 268 | def nodelike_urlparse(url: str) -> ParseResult: |
| 269 | parsed = urlparse(url, allow_fragments=True) |
| 270 | |
| 271 | # https://url.spec.whatwg.org/#special-scheme |
| 272 | is_special_url = parsed.scheme in ["http", "https", "ws", "wss", "ftp", "file"] |
| 273 | if is_special_url: |
| 274 | # special urls have a list path, list paths are serialized as follows: https://url.spec.whatwg.org/#url-path-serializer |
| 275 | # urllib diverges, so we patch it here |
| 276 | if parsed.path == "": |
| 277 | parsed = parsed._replace(path="/") |
| 278 | |
| 279 | return parsed |
| 280 | |
| 281 | |
| 282 | class HarLookupResult(TypedDict, total=False): |