about summary refs log tree commit diff
path: root/library/std/src/net/parser.rs
AgeCommit message (Collapse)AuthorLines
2023-02-26Move IpAddr and SocketAddr to coreLinus Färnstrand-500/+0
2022-08-26Support parsing IP addresses from a byte stringmarmeladema-13/+125
2022-05-09Use Rust 2021 prelude in std itself.Mara Bos-1/+0
2022-04-19Improve AddrParseError descriptionChris Morgan-11/+28
The existing description was incorrect for socket addresses, and misleading: users would see “invalid IP address syntax” and suppose they were supposed to provide an IP address rather than a socket address. I contemplated making it two variants (IP, socket), but realised we can do still better for the IPv4 and IPv6 types, so here it is as six. I contemplated more precise error descriptions (e.g. “invalid IPv6 socket address syntax: expected a decimal scope ID after %”), but that’s a more invasive change, and probably not worthwhile anyway.
2021-08-10Specify maximum IP address lengthSmittyvb-1/+1
Co-authored-by: Cheng XU <3105373+xu-cheng@users.noreply.github.com>
2021-07-11Simplify leading zero checksSmitty-5/+2
2021-07-09Reject too-long IPs quickerSmitty-1/+6
Now that there can't be a bunch of leading zeros, parsing can be optimized a bit.
2021-07-08Disallow octal zeros in IPv4 addressesSmitty-9/+17
2021-03-30Disallow octal format in Ipv4 stringCheng XU-1/+13
In its original specification, leading zero in Ipv4 string is interpreted as octal literals. So a IP address 0127.0.0.1 actually means 87.0.0.1. This confusion can lead to many security vulnerabilities. Therefore, in [IETF RFC 6943], it suggests to disallow octal/hexadecimal format in Ipv4 string all together. Existing implementation already disallows hexadecimal numbers. This commit makes Parser reject octal numbers. Fixes #83648. [IETF RFC 6943]: https://tools.ietf.org/html/rfc6943#section-3.1.1
2021-03-05(std::net::parser): Fix capitalization of IP versionspierwill-16/+16
Also add some missing punctuation in doc and code comments.
2020-10-06Parse SocketAddrV6::scope_idTamir Duberstein-2/+11
2020-10-06Avoid unused returnTamir Duberstein-9/+12
2020-10-04Inline "eof" methodsTamir Duberstein-13/+2
2020-10-04Avoid unchecked casts in net parserTamir Duberstein-23/+46
2020-08-31std: move "mod tests/benches" to separate filesLzu Tao-143/+3
Also doing fmt inplace as requested.
2020-08-15Move to intra doc links in std::netAlexis Bourget-8/+0
2020-07-27mv std libs to library/mark-0/+474