Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
513ef481
Unverified
Commit
513ef481
authored
Apr 02, 2018
by
Kenton Varda
Committed by
GitHub
Apr 02, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #654 from capnproto/harris/allow-underscore-in-hostname
Allow underscores in URL hostnames
parents
2ae725f3
23e13c1d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
url-test.c++
c++/src/kj/compat/url-test.c++
+4
-0
url.c++
c++/src/kj/compat/url.c++
+5
-1
No files found.
c++/src/kj/compat/url-test.c++
View file @
513ef481
...
...
@@ -265,6 +265,10 @@ KJ_TEST("parse / stringify URL") {
// Scheme and host are forced to lower-case.
parseAndCheck
(
"hTtP://capNprotO.org/fOo/bAr"
,
"http://capnproto.org/fOo/bAr"
);
// URLs with underscores in their hostnames are allowed, but you probably shouldn't use them. They
// are not valid domain names.
parseAndCheck
(
"https://bad_domain.capnproto.org/"
);
}
KJ_TEST
(
"URL percent encoding"
)
{
...
...
c++/src/kj/compat/url.c++
View file @
513ef481
...
...
@@ -38,7 +38,11 @@ constexpr auto END_QUERY_PART = parse::anyOfChars("&#");
constexpr
auto
SCHEME_CHARS
=
ALPHAS
.
orGroup
(
DIGITS
).
orAny
(
"+-."
);
constexpr
auto
NOT_SCHEME_CHARS
=
SCHEME_CHARS
.
invert
();
constexpr
auto
HOST_CHARS
=
ALPHAS
.
orGroup
(
DIGITS
).
orAny
(
".-:[]"
);
// [] is for ipv6 literals
constexpr
auto
HOST_CHARS
=
ALPHAS
.
orGroup
(
DIGITS
).
orAny
(
".-:[]_"
);
// [] is for ipv6 literals.
// _ is not allowed in domain names, but the WHATWG URL spec allows it in hostnames, so we do, too.
// TODO(soon): The URL spec actually allows a lot more than just '_', and requires nameprepping to
// Punycode. We'll have to decide how we want to deal with all that.
void
toLower
(
String
&
text
)
{
for
(
char
&
c
:
text
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment