Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add IPv4 variant to Host and remove custom Ipv6 address type #135

Merged
merged 1 commit into from Nov 15, 2015

Conversation

@pyfisch
Copy link
Contributor

pyfisch commented Nov 14, 2015

The Whatwg URL Standard was changed to describe Ipv4 address
parsing. Before this change there was no difference made
between domains and Ipv4 addresses. This change also removes
the custom Ipv6 type and uses the types provided by std for
ip addresses.

https://url.spec.whatwg.org/#syntax-host-ipv4

Note heap_size feature is broken because the HeapSizeOf trait is not yet implemented for the ip addresses.

Review on Reviewable

@pyfisch
Copy link
Contributor Author

pyfisch commented Nov 14, 2015

@pyfisch
Copy link
Contributor Author

pyfisch commented Nov 14, 2015

By the way this solves #116

@untitaker
Copy link
Contributor

untitaker commented Nov 14, 2015

@pyfisch I think you should file a PR against heapsize regarding that commit.

bors-servo added a commit to servo/heapsize that referenced this pull request Nov 15, 2015
Add Ipv4Addr and Ipv6Addr for use in rust-url

Needed for servo/rust-url#135.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/heapsize/16)
<!-- Reviewable:end -->
bors-servo added a commit to servo/heapsize that referenced this pull request Nov 15, 2015
Add Ipv4Addr and Ipv6Addr for use in rust-url

Needed for servo/rust-url#135.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/heapsize/16)
<!-- Reviewable:end -->
@Manishearth
Copy link
Member

Manishearth commented Nov 15, 2015

Blocked on servo/heapsize#17 getting r+ since crates and the repo weren't in sync.

@Ms2ger
Copy link
Contributor

Ms2ger commented Nov 15, 2015

Please bump the heapsize dep to 0.1.3.

@pyfisch
Copy link
Contributor Author

pyfisch commented Nov 15, 2015

done

@Ms2ger
Copy link
Contributor

Ms2ger commented Nov 15, 2015

And squash the commits, please

@pyfisch pyfisch force-pushed the pyfisch:ipv4addr branch from 4db330c to 543d51a Nov 15, 2015
The Whatwg URL Standard was changed to describe Ipv4 address
parsing. Before this change there was no difference made
between domains and Ipv4 addresses. This change also removes
the custom Ipv6 type and uses the types provided by std for
ip addresses.

This is a breaking change. Version bumped to 0.3.0
@pyfisch pyfisch force-pushed the pyfisch:ipv4addr branch from 543d51a to ecc7bb7 Nov 15, 2015
@pyfisch
Copy link
Contributor Author

pyfisch commented Nov 15, 2015

done

@Ms2ger
Copy link
Contributor

Ms2ger commented Nov 15, 2015

@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2015

📌 Commit ecc7bb7 has been approved by Ms2ger

@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2015

Testing commit ecc7bb7 with merge f71d0f4...

bors-servo added a commit that referenced this pull request Nov 15, 2015
Add IPv4 variant to Host and remove custom Ipv6 address type

The Whatwg URL Standard was changed to describe Ipv4 address
parsing. Before this change there was no difference made
between domains and Ipv4 addresses. This change also removes
the custom Ipv6 type and uses the types provided by std for
ip addresses.

https://url.spec.whatwg.org/#syntax-host-ipv4

Note `heap_size` feature is broken because the HeapSizeOf trait is not yet implemented for the ip addresses.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/135)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Nov 15, 2015

☀️ Test successful - travis

@bors-servo bors-servo merged commit ecc7bb7 into servo:master Nov 15, 2015
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@pyfisch pyfisch deleted the pyfisch:ipv4addr branch Nov 15, 2015
@Ms2ger
Copy link
Contributor

Ms2ger commented Nov 16, 2015

Thanks!

'\0', '\t', '\n', '\r', ' ', '#', '%', '/', ':', '?', '@', '[', '\\', ']'
][..]).is_some() {
Err(ParseError::InvalidDomainCharacter)
if let Ok(addr) = input.parse() {

This comment has been minimized.

@SimonSapin

SimonSapin Nov 18, 2015

Member

@pyfisch @Ms2ger have you verified that Ipv4Addr::parse and Ipv6::parse match https://url.spec.whatwg.org/#host-parsing in every edge case? For example: leading zeros, hex/octal components in v4, …

@SimonSapin
Copy link
Member

SimonSapin commented Nov 18, 2015

I’ve reverted this change. It looks like there was a misunderstanding in the review, sorry. At least the IPv4 parsing of the standard library differs from https://url.spec.whatwg.org/#concept-ipv4-parser . (Note that the "parsing" and "serialization" sections of the spec are more relevant to implementation than the "syntax" sections, which only give a high level overview as opposed to exact algorithms.)

I don’t know if the current parsing or serialization behavior of std for IPv6 happens to match the current spec, but I don’t think we should rely on it staying that way. (I don’t know if it should. Web compatibility with all its weirdness is an overriding concern for browsers, but not as much for a programming language standard library.)

@pyfisch, could you please open a new PR? But keep the existing fmt and parse methods for IPv6, and write IPv4 parsing per https://url.spec.whatwg.org/#concept-ipv4-parser . Or let us know if you’d rather someone else does this work.

@SimonSapin
Copy link
Member

SimonSapin commented Nov 18, 2015

(Edge cases to look for in IPv4 include: leading zeroes, hexadecimal or octal components, less than 4 components.)

@pyfisch
Copy link
Contributor Author

pyfisch commented Nov 18, 2015

I will create a new pull request which will use custom parse methods as they are described in the urlspec. The canonical formatting is unambiguous so I will try to use the methods provided by std but add many tests for edge cases.

@SimonSapin
Copy link
Member

SimonSapin commented Nov 18, 2015

Sounds great, thanks! And yes, serialisation has fewer edge cases than parsing.

@SimonSapin
Copy link
Member

SimonSapin commented Nov 19, 2015

Please also add "Fixes #116" in the new PR or commit message. Thanks!

SimonSapin added a commit that referenced this pull request Nov 19, 2015
… to work around rust-lang/crates.io#76

0.3.0 was published and then yanked:
#135 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

6 participants
You can’t perform that action at this time.