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
d867fe64
Commit
d867fe64
authored
Nov 28, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Rename endsWith as ends_with
parent
de247f7d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
22 deletions
+22
-22
src/shrpx_ssl.cc
src/shrpx_ssl.cc
+2
-2
src/util.cc
src/util.cc
+3
-3
src/util.h
src/util.h
+8
-8
src/util_test.cc
src/util_test.cc
+9
-9
No files found.
src/shrpx_ssl.cc
View file @
d867fe64
...
...
@@ -808,7 +808,7 @@ bool tls_hostname_match(const char *pattern, const char *hostname) {
return
false
;
}
return
util
::
istarts_with
(
hostname
,
hnLeftLabelEnd
,
pattern
,
ptWildcard
)
&&
util
::
iends
W
ith
(
hostname
,
hnLeftLabelEnd
,
ptWildcard
+
1
,
util
::
iends
_w
ith
(
hostname
,
hnLeftLabelEnd
,
ptWildcard
+
1
,
ptLeftLabelEnd
);
}
}
// namespace
...
...
src/util.cc
View file @
d867fe64
...
...
@@ -521,7 +521,7 @@ void show_candidates(const char *unkopt, option *options) {
}
// Use cost 0 for suffix match, but match at least 3 characters
if
(
unkoptlen
>=
3
&&
iends
W
ith
(
options
[
i
].
name
,
options
[
i
].
name
+
optnamelen
,
unkopt
,
iends
_w
ith
(
options
[
i
].
name
,
options
[
i
].
name
+
optnamelen
,
unkopt
,
unkopt
+
unkoptlen
))
{
cands
.
emplace_back
(
0
,
options
[
i
].
name
);
continue
;
...
...
@@ -754,7 +754,7 @@ bool check_path(const std::string &path) {
path
.
find
(
'\\'
)
==
std
::
string
::
npos
&&
path
.
find
(
"/../"
)
==
std
::
string
::
npos
&&
path
.
find
(
"/./"
)
==
std
::
string
::
npos
&&
!
util
::
ends
With
(
path
,
"/.."
)
&&
!
util
::
endsW
ith
(
path
,
"/."
);
!
util
::
ends
_with
(
path
,
"/.."
)
&&
!
util
::
ends_w
ith
(
path
,
"/."
);
}
int64_t
to_time64
(
const
timeval
&
tv
)
{
...
...
src/util.h
View file @
d867fe64
...
...
@@ -212,7 +212,7 @@ bool istarts_with(InputIt a, size_t an, const char *b) {
bool
istarts_with
(
const
char
*
a
,
const
char
*
b
);
template
<
typename
InputIterator1
,
typename
InputIterator2
>
bool
ends
W
ith
(
InputIterator1
first1
,
InputIterator1
last1
,
bool
ends
_w
ith
(
InputIterator1
first1
,
InputIterator1
last1
,
InputIterator2
first2
,
InputIterator2
last2
)
{
if
(
last1
-
first1
<
last2
-
first2
)
{
return
false
;
...
...
@@ -220,12 +220,12 @@ bool endsWith(InputIterator1 first1, InputIterator1 last1,
return
std
::
equal
(
first2
,
last2
,
last1
-
(
last2
-
first2
));
}
inline
bool
ends
W
ith
(
const
std
::
string
&
a
,
const
std
::
string
&
b
)
{
return
ends
W
ith
(
std
::
begin
(
a
),
std
::
end
(
a
),
std
::
begin
(
b
),
std
::
end
(
b
));
inline
bool
ends
_w
ith
(
const
std
::
string
&
a
,
const
std
::
string
&
b
)
{
return
ends
_w
ith
(
std
::
begin
(
a
),
std
::
end
(
a
),
std
::
begin
(
b
),
std
::
end
(
b
));
}
template
<
typename
InputIterator1
,
typename
InputIterator2
>
bool
iends
W
ith
(
InputIterator1
first1
,
InputIterator1
last1
,
bool
iends
_w
ith
(
InputIterator1
first1
,
InputIterator1
last1
,
InputIterator2
first2
,
InputIterator2
last2
)
{
if
(
last1
-
first1
<
last2
-
first2
)
{
return
false
;
...
...
@@ -233,8 +233,8 @@ bool iendsWith(InputIterator1 first1, InputIterator1 last1,
return
std
::
equal
(
first2
,
last2
,
last1
-
(
last2
-
first2
),
CaseCmp
());
}
inline
bool
iends
W
ith
(
const
std
::
string
&
a
,
const
std
::
string
&
b
)
{
return
iends
W
ith
(
std
::
begin
(
a
),
std
::
end
(
a
),
std
::
begin
(
b
),
std
::
end
(
b
));
inline
bool
iends
_w
ith
(
const
std
::
string
&
a
,
const
std
::
string
&
b
)
{
return
iends
_w
ith
(
std
::
begin
(
a
),
std
::
end
(
a
),
std
::
begin
(
b
),
std
::
end
(
b
));
}
int
strcompare
(
const
char
*
a
,
const
uint8_t
*
b
,
size_t
n
);
...
...
src/util_test.cc
View file @
d867fe64
...
...
@@ -356,15 +356,15 @@ void test_util_starts_with(void) {
}
void
test_util_ends_with
(
void
)
{
CU_ASSERT
(
util
::
ends
W
ith
(
"foo"
,
"foo"
));
CU_ASSERT
(
util
::
ends
W
ith
(
"foo"
,
""
));
CU_ASSERT
(
util
::
ends
W
ith
(
"ofoo"
,
"foo"
));
CU_ASSERT
(
!
util
::
ends
W
ith
(
"ofoo"
,
"fo"
));
CU_ASSERT
(
util
::
iends
W
ith
(
"fOo"
,
"Foo"
));
CU_ASSERT
(
util
::
iends
W
ith
(
"foo"
,
""
));
CU_ASSERT
(
util
::
iends
W
ith
(
"oFoo"
,
"fOO"
));
CU_ASSERT
(
!
util
::
iends
W
ith
(
"ofoo"
,
"fo"
));
CU_ASSERT
(
util
::
ends
_w
ith
(
"foo"
,
"foo"
));
CU_ASSERT
(
util
::
ends
_w
ith
(
"foo"
,
""
));
CU_ASSERT
(
util
::
ends
_w
ith
(
"ofoo"
,
"foo"
));
CU_ASSERT
(
!
util
::
ends
_w
ith
(
"ofoo"
,
"fo"
));
CU_ASSERT
(
util
::
iends
_w
ith
(
"fOo"
,
"Foo"
));
CU_ASSERT
(
util
::
iends
_w
ith
(
"foo"
,
""
));
CU_ASSERT
(
util
::
iends
_w
ith
(
"oFoo"
,
"fOO"
));
CU_ASSERT
(
!
util
::
iends
_w
ith
(
"ofoo"
,
"fo"
));
}
void
test_util_parse_http_date
(
void
)
{
...
...
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