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
ba9e912c
Commit
ba9e912c
authored
Nov 28, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Rename isAlpha, isDigit, and isHexDigit as is_...
parent
d867fe64
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
13 deletions
+14
-13
src/http2.h
src/http2.h
+2
-1
src/shrpx_client_handler.cc
src/shrpx_client_handler.cc
+2
-2
src/shrpx_config.cc
src/shrpx_config.cc
+1
-1
src/util.cc
src/util.cc
+2
-2
src/util.h
src/util.h
+7
-7
No files found.
src/http2.h
View file @
ba9e912c
...
...
@@ -340,7 +340,8 @@ std::string normalize_path(InputIt first, InputIt last) {
}
else
{
for
(;
first
<
last
-
2
;)
{
if
(
*
first
==
'%'
)
{
if
(
util
::
isHexDigit
(
*
(
first
+
1
))
&&
util
::
isHexDigit
(
*
(
first
+
2
)))
{
if
(
util
::
is_hex_digit
(
*
(
first
+
1
))
&&
util
::
is_hex_digit
(
*
(
first
+
2
)))
{
auto
c
=
(
util
::
hex_to_uint
(
*
(
first
+
1
))
<<
4
)
+
util
::
hex_to_uint
(
*
(
first
+
2
));
if
(
util
::
in_rfc3986_unreserved_chars
(
c
))
{
...
...
src/shrpx_client_handler.cc
View file @
ba9e912c
...
...
@@ -859,13 +859,13 @@ ssize_t parse_proxy_line_port(const uint8_t *first, const uint8_t *last) {
}
if
(
*
p
==
'0'
)
{
if
(
p
+
1
!=
last
&&
util
::
is
D
igit
(
*
(
p
+
1
)))
{
if
(
p
+
1
!=
last
&&
util
::
is
_d
igit
(
*
(
p
+
1
)))
{
return
-
1
;
}
return
1
;
}
for
(;
p
!=
last
&&
util
::
is
D
igit
(
*
p
);
++
p
)
{
for
(;
p
!=
last
&&
util
::
is
_d
igit
(
*
p
);
++
p
)
{
port
*=
10
;
port
+=
*
p
-
'0'
;
...
...
src/shrpx_config.cc
View file @
ba9e912c
...
...
@@ -471,7 +471,7 @@ LogFragmentType log_var_lookup_token(const char *name, size_t namelen) {
namespace
{
bool
var_token
(
char
c
)
{
return
util
::
is
Alpha
(
c
)
||
util
::
isD
igit
(
c
)
||
c
==
'_'
;
return
util
::
is
_alpha
(
c
)
||
util
::
is_d
igit
(
c
)
||
c
==
'_'
;
}
}
// namespace
...
...
src/util.cc
View file @
ba9e912c
...
...
@@ -67,7 +67,7 @@ const char UPPER_XDIGITS[] = "0123456789ABCDEF";
bool
in_rfc3986_unreserved_chars
(
const
char
c
)
{
static
constexpr
const
char
unreserved
[]
=
{
'-'
,
'.'
,
'_'
,
'~'
};
return
is
Alpha
(
c
)
||
isD
igit
(
c
)
||
return
is
_alpha
(
c
)
||
is_d
igit
(
c
)
||
std
::
find
(
std
::
begin
(
unreserved
),
std
::
end
(
unreserved
),
c
)
!=
std
::
end
(
unreserved
);
}
...
...
@@ -120,7 +120,7 @@ bool in_token(char c) {
static
constexpr
const
char
extra
[]
=
{
'!'
,
'#'
,
'$'
,
'%'
,
'&'
,
'\''
,
'*'
,
'+'
,
'-'
,
'.'
,
'^'
,
'_'
,
'`'
,
'|'
,
'~'
};
return
is
Alpha
(
c
)
||
isD
igit
(
c
)
||
return
is
_alpha
(
c
)
||
is_d
igit
(
c
)
||
std
::
find
(
std
::
begin
(
extra
),
std
::
end
(
extra
),
c
)
!=
std
::
end
(
extra
);
}
...
...
src/util.h
View file @
ba9e912c
...
...
@@ -64,14 +64,14 @@ constexpr const char NGHTTP2_H1_1[] = "http/1.1";
namespace
util
{
inline
bool
is
A
lpha
(
const
char
c
)
{
inline
bool
is
_a
lpha
(
const
char
c
)
{
return
(
'A'
<=
c
&&
c
<=
'Z'
)
||
(
'a'
<=
c
&&
c
<=
'z'
);
}
inline
bool
is
D
igit
(
const
char
c
)
{
return
'0'
<=
c
&&
c
<=
'9'
;
}
inline
bool
is
_d
igit
(
const
char
c
)
{
return
'0'
<=
c
&&
c
<=
'9'
;
}
inline
bool
is
HexD
igit
(
const
char
c
)
{
return
is
D
igit
(
c
)
||
(
'A'
<=
c
&&
c
<=
'F'
)
||
(
'a'
<=
c
&&
c
<=
'f'
);
inline
bool
is
_hex_d
igit
(
const
char
c
)
{
return
is
_d
igit
(
c
)
||
(
'A'
<=
c
&&
c
<=
'F'
)
||
(
'a'
<=
c
&&
c
<=
'f'
);
}
bool
in_rfc3986_unreserved_chars
(
const
char
c
);
...
...
@@ -84,7 +84,7 @@ bool in_token(char c);
bool
in_attr_char
(
char
c
);
// Returns integer corresponding to hex notation |c|. It is undefined
// if is
HexD
igit(c) is false.
// if is
_hex_d
igit(c) is false.
uint32_t
hex_to_uint
(
char
c
);
std
::
string
percent_encode
(
const
unsigned
char
*
target
,
size_t
len
);
...
...
@@ -99,8 +99,8 @@ std::string percent_decode(InputIt first, InputIt last) {
std
::
string
result
;
for
(;
first
!=
last
;
++
first
)
{
if
(
*
first
==
'%'
)
{
if
(
first
+
1
!=
last
&&
first
+
2
!=
last
&&
isHexDigit
(
*
(
first
+
1
))
&&
is
HexD
igit
(
*
(
first
+
2
)))
{
if
(
first
+
1
!=
last
&&
first
+
2
!=
last
&&
is
_hex_digit
(
*
(
first
+
1
))
&&
is_hex_d
igit
(
*
(
first
+
2
)))
{
result
+=
(
hex_to_uint
(
*
(
first
+
1
))
<<
4
)
+
hex_to_uint
(
*
(
first
+
2
));
first
+=
2
;
continue
;
...
...
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