Skip to content

Commit

Permalink
Add ToASCII: CheckHyphens = false
Browse files Browse the repository at this point in the history
  • Loading branch information
rmisev committed May 28, 2017
1 parent 5dad8c2 commit 9cbc9c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/url_idna.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,15 @@ static_assert(sizeof(char16_t) == sizeof(UChar), "");
url_result IDNToASCII(const char16_t* src, size_t src_len, simple_buffer<char16_t>& output) {
// https://url.spec.whatwg.org/#concept-domain-to-ascii
// http://www.unicode.org/reports/tr46/#ToASCII
// VerifyDnsLength = false
static const uint32_t UIDNA_ERR_MASK = ~(uint32_t)(
UIDNA_ERROR_EMPTY_LABEL | UIDNA_ERROR_LABEL_TOO_LONG |
UIDNA_ERROR_DOMAIN_NAME_TOO_LONG
// VerifyDnsLength = false
UIDNA_ERROR_EMPTY_LABEL
| UIDNA_ERROR_LABEL_TOO_LONG
| UIDNA_ERROR_DOMAIN_NAME_TOO_LONG
// CheckHyphens = false
| UIDNA_ERROR_LEADING_HYPHEN
| UIDNA_ERROR_TRAILING_HYPHEN
| UIDNA_ERROR_HYPHEN_3_4
);

// uidna_nameToASCII uses int32_t length
Expand Down
2 changes: 1 addition & 1 deletion test/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ int main(int argc, char** argv)
err |= test_from_file(run_parser_tests, "w3c-tests/urltestdata-mano.json");
// err |= test_from_file(run_parser_tests, "w3c-tests/urltestdata-mano-bandymai.json");

// err |= test_from_file(run_host_parser_tests, "w3c-tests/toascii.json");
err |= test_from_file(run_host_parser_tests, "w3c-tests/toascii.json");

err |= test_from_file(run_setter_tests, "w3c-tests/setters_tests.json");

Expand Down

0 comments on commit 9cbc9c0

Please sign in to comment.