Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
4bb88b35
Commit
4bb88b35
authored
Mar 22, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: "*" must match at least one character
parent
04145e22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
13 deletions
+17
-13
doc/sources/nghttpx-howto.rst
doc/sources/nghttpx-howto.rst
+5
-4
src/shrpx.cc
src/shrpx.cc
+5
-4
src/shrpx_worker.cc
src/shrpx_worker.cc
+3
-1
src/shrpx_worker_test.cc
src/shrpx_worker_test.cc
+4
-4
No files found.
doc/sources/nghttpx-howto.rst
View file @
4bb88b35
...
...
@@ -269,10 +269,11 @@ time:
We can use ``*`` in the left most position of host to achieve wildcard
suffix match. If ``*`` is the left most character, then the remaining
string should match the request host suffix. For example,
``*.example.com`` matches ``www.example.com`` and ``dev.example.com``,
and does not match ``example.com`` and ``nghttp2.org``. The exact
match (without ``*``) always takes precedence over wildcard match.
string should match the request host suffix. ``*`` must match at
least one character. For example, ``*.example.com`` matches
``www.example.com`` and ``dev.example.com``, and does not match
``example.com`` and ``nghttp2.org``. The exact match (without ``*``)
always takes precedence over wildcard match.
One important thing you have to remember is that we have to specify
default routing pattern for so called "catch all" pattern. To write
...
...
src/shrpx.cc
View file @
4bb88b35
...
...
@@ -1225,10 +1225,11 @@ Connections:
Host can include "*" in the left most position to
indicate wildcard match (only suffix match is done).
For example, host pattern "*www.nghttp2.org" matches
against "www.nghttp2.org" and "1www.ngttp2.org", but
does not match against "nghttp2.org". The exact hosts
match takes precedence over the wildcard hosts match.
The "*" must match at least one character. For example,
host pattern "*.nghttp2.org" matches against
"www.nghttp2.org" and "git.ngttp2.org", but does not
match against "nghttp2.org". The exact hosts match
takes precedence over the wildcard hosts match.
If <PATTERN> is omitted or empty string, "/" is used as
pattern, which matches all request paths (catch-all
...
...
src/shrpx_worker.cc
View file @
4bb88b35
...
...
@@ -321,7 +321,9 @@ size_t match_downstream_addr_group_host(
for
(
auto
it
=
std
::
begin
(
wildcard_patterns
);
it
!=
std
::
end
(
wildcard_patterns
);
++
it
)
{
if
(
!
util
::
ends_with
(
std
::
begin
(
host
),
std
::
end
(
host
),
/* left most '*' must match at least one character */
if
(
host
.
size
()
<=
(
*
it
).
host
.
size
()
||
!
util
::
ends_with
(
std
::
begin
(
host
),
std
::
end
(
host
),
std
::
begin
((
*
it
).
host
),
std
::
end
((
*
it
).
host
)))
{
continue
;
}
...
...
src/shrpx_worker_test.cc
View file @
4bb88b35
...
...
@@ -188,7 +188,7 @@ void test_shrpx_worker_match_downstream_addr_group(void) {
wp
.
back
().
router
.
add_route
(
StringRef
::
from_lit
(
"/echo/"
),
11
);
wp
.
back
().
router
.
add_route
(
StringRef
::
from_lit
(
"/echo/foxtrot"
),
12
);
CU_ASSERT
(
1
0
==
match_downstream_addr_group
(
CU_ASSERT
(
1
1
==
match_downstream_addr_group
(
router
,
wp
,
StringRef
::
from_lit
(
"git.nghttp2.org"
),
StringRef
::
from_lit
(
"/echo"
),
groups
,
255
));
...
...
@@ -200,9 +200,9 @@ void test_shrpx_worker_match_downstream_addr_group(void) {
router
,
wp
,
StringRef
::
from_lit
(
"it.nghttp2.org"
),
StringRef
::
from_lit
(
"/echo"
),
groups
,
255
));
CU_ASSERT
(
12
==
match_downstream_addr_group
(
router
,
wp
,
StringRef
::
from_lit
(
".nghttp2.org"
),
StringRef
::
from_lit
(
"/echo/foxtrot"
),
groups
,
255
));
CU_ASSERT
(
255
==
match_downstream_addr_group
(
router
,
wp
,
StringRef
::
from_lit
(
".nghttp2.org"
),
StringRef
::
from_lit
(
"/echo/foxtrot"
),
groups
,
255
));
CU_ASSERT
(
9
==
match_downstream_addr_group
(
router
,
wp
,
StringRef
::
from_lit
(
"alpha.nghttp2.org"
),
...
...
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