消息 [330904]
I don't think this is broken, but I do think it could be documented better. You have to read the documentation for `urlparse` to see this:
[Quote]
Following the syntax specifications in RFC 1808, urlparse recognizes a netloc only if it is properly introduced by ‘//’. Otherwise the input is presumed to be a relative URL and thus to start with a path component.
https://docs.python.org/3/library/urllib.parse.html#urllib.parse.urlparse
so the function is correct. You're making two errors:
- providing a relative URL "httpbin.org" and expecting it to be treated as an absolute URL;
- specifying scheme+delimiter instead of the scheme alone.
So I don't think this is a bug. urlsplit rightly accepts any arbitrary string as a scheme (it used to have a whitelist of permitted schemes, and that was a problem), and we can't assume that :/// is ONLY valid for file protocols.
Unless you come up with a convincing argument for why this is a bug, I'm going to change it to a documentation issue. The docs could do with some improvement to make it more clear, although the examples are good. |
|
| 日期 |
用户 |
动作 |
参数 |
| 2018-12-03 00:26:25 | steven.daprano | 修改 | recipients:
+ steven.daprano, orsenthil, SilentGhost, devkral |
| 2018-12-03 00:26:25 | steven.daprano | 修改 | messageid: <1543796785.64.0.788709270274.issue35377@psf.upfronthosting.co.za> |
| 2018-12-03 00:26:25 | steven.daprano | 链接 | issue35377 messages |
| 2018-12-03 00:26:25 | steven.daprano | 创建 | |
|