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
b405b4bc
Commit
b405b4bc
authored
Nov 09, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src: Fix token68 decoding
parent
415b8ed6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
2 deletions
+18
-2
src/shrpx-unittest.cc
src/shrpx-unittest.cc
+3
-1
src/util.cc
src/util.cc
+3
-1
src/util_test.cc
src/util_test.cc
+11
-0
src/util_test.h
src/util_test.h
+1
-0
No files found.
src/shrpx-unittest.cc
View file @
b405b4bc
...
@@ -93,7 +93,9 @@ int main(int argc, char* argv[])
...
@@ -93,7 +93,9 @@ int main(int argc, char* argv[])
shrpx
::
test_downstream_get_norm_response_header
)
||
shrpx
::
test_downstream_get_norm_response_header
)
||
!
CU_add_test
(
pSuite
,
"util_streq"
,
shrpx
::
test_util_streq
)
||
!
CU_add_test
(
pSuite
,
"util_streq"
,
shrpx
::
test_util_streq
)
||
!
CU_add_test
(
pSuite
,
"util_inp_strlower"
,
!
CU_add_test
(
pSuite
,
"util_inp_strlower"
,
shrpx
::
test_util_inp_strlower
))
{
shrpx
::
test_util_inp_strlower
)
||
!
CU_add_test
(
pSuite
,
"util_to_base64"
,
shrpx
::
test_util_to_base64
))
{
CU_cleanup_registry
();
CU_cleanup_registry
();
return
CU_get_error
();
return
CU_get_error
();
}
}
...
...
src/util.cc
View file @
b405b4bc
...
@@ -283,7 +283,9 @@ void to_base64(std::string& token68str)
...
@@ -283,7 +283,9 @@ void to_base64(std::string& token68str)
break
;
break
;
}
}
}
}
token68str
+=
std
::
string
(
4
-
token68str
.
size
()
%
4
,
'='
);
if
(
token68str
.
size
()
&
0x3
)
{
token68str
.
append
(
4
-
(
token68str
.
size
()
&
0x3
),
'='
);
}
return
;
return
;
}
}
...
...
src/util_test.cc
View file @
b405b4bc
...
@@ -71,4 +71,15 @@ void test_util_inp_strlower(void)
...
@@ -71,4 +71,15 @@ void test_util_inp_strlower(void)
CU_ASSERT
(
""
==
a
);
CU_ASSERT
(
""
==
a
);
}
}
void
test_util_to_base64
(
void
)
{
std
::
string
x
=
"AAA--B_"
;
util
::
to_base64
(
x
);
CU_ASSERT
(
"AAA++B/="
==
x
);
x
=
"AAA--B_B"
;
util
::
to_base64
(
x
);
CU_ASSERT
(
"AAA++B/B"
==
x
);
}
}
// namespace shrpx
}
// namespace shrpx
src/util_test.h
View file @
b405b4bc
...
@@ -29,6 +29,7 @@ namespace shrpx {
...
@@ -29,6 +29,7 @@ namespace shrpx {
void
test_util_streq
(
void
);
void
test_util_streq
(
void
);
void
test_util_inp_strlower
(
void
);
void
test_util_inp_strlower
(
void
);
void
test_util_to_base64
(
void
);
}
// namespace shrpx
}
// namespace shrpx
...
...
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