Skip to content

[idna] Preserve leading dots in host #337

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

Closed
wants to merge 1 commit into from

Conversation

behnam
Copy link
Contributor

@behnam behnam commented May 12, 2017

A retry of #171

This diff changes the behavior of ToASCII step to match the spec and
prevent failures on some cases when a domain name starts with leading
dots (FULL STOPs), as requested in
#166.

The change in the code results in a few failures for test cases of the
Conformance Testing data provided with UTS #46. But, as the header of
the test data file (IdnaTest.txt) says: "If the file does not indicate
an error, then the implementation must either have an error, or must
have a matching result."

Therefore, failing on those test cases does not break conformance with
UTS #46, and to some level, anticipated.

As mentioned in #166, a feedback
is submitted for this inconsistency and the test logic can be improved
later if the data file addresses the comments.

Until then, we can throw less errors and maintain passing conformance
tests with this diff.

To keep the side-effects of ignoring errors during test runs as minimum
as possible, I have separated TooShortForDns error from
TooLongForDns. The Error struct has been kept private, so the change
won't affect any library users.

Fix #166


This change is Reviewable

@behnam
Copy link
Contributor Author

behnam commented May 17, 2017

r? @SimonSapin

@Hoverbear
Copy link

@behnam Please be patient. :) rust-url has had a lot of PRs/issues since around this was posted. I imagine Simon has a bit of a backlog. Thank you for your contribution though!

A retry of servo#171

This diff changes the behavior of ToASCII step to match the spec and
prevent failures on some cases when a domain name starts with leading
dots (FULL STOPs), as requested in
servo#166.

The change in the code results in a few failures for test cases of the
Conformance Testing data provided with UTS servo#46. But, as the header of
the test data file (IdnaTest.txt) says: "If the file does not indicate
an error, then the implementation must either have an error, or must
have a matching result."

Therefore, failing on those test cases does not break conformance with
UTS servo#46, and to some level, anticipated.

As mentioned in servo#166, a feedback
is submitted for this inconsistency and the test logic can be improved
later if the data file addresses the comments.

Until then, we can throw less errors and maintain passing conformance
tests with this diff.

To keep the side-effects of ignoring errors during test runs as minimum
as possible, I have separated `TooShortForDns` error from
`TooLongForDns`. The `Error` struct has been kept private, so the change
won't affect any library users.

Fix servo#166
@behnam
Copy link
Contributor Author

behnam commented May 29, 2017

New implementation of this, plus lots of other updates to improve validation (bidi) rules is here: #351

Closing this, as looks like there's no interest for a quick and dirty fix.

@behnam behnam closed this May 29, 2017
bors-servo pushed a commit that referenced this pull request Jun 21, 2017
[idna] Update data to Unicode 10.0 and fix logic

* Change the behavior of ToASCII step to match the spec and prevent failures on some cases when a domain name starts with leading dots (FULL STOPs), as requested in #166. (Another attempt on #337 and #171)

* Update `IdnaTest.txt` file to UCD 10.0 and fix Validation Rules, specially Bidi Rules, for the tests to pass.

* Add TODO marks for new flags introduced in Unicode 10.0 version of UTS#46. (http://www.unicode.org/reports/tr46/proposed.html)

* Add integration test for `rust-url` crate for the new behavior.

Fix #166

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-url/351)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants