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
919e9eee
Commit
919e9eee
authored
Jan 17, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: It is enough to check "chunked" in the suffix
parent
e255468b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
2 deletions
+9
-2
src/shrpx_downstream.cc
src/shrpx_downstream.cc
+2
-2
src/util.h
src/util.h
+4
-0
src/util_test.cc
src/util_test.cc
+3
-0
No files found.
src/shrpx_downstream.cc
View file @
919e9eee
...
...
@@ -662,7 +662,7 @@ void Downstream::inspect_http1_request() {
auto
transfer_encoding
=
req_
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
);
if
(
transfer_encoding
)
{
req_
.
fs
.
content_length
=
-
1
;
if
(
util
::
strifind
(
transfer_encoding
->
value
.
c_str
()
,
"chunked"
))
{
if
(
util
::
iends_with_l
(
transfer_encoding
->
value
,
"chunked"
))
{
chunked_request_
=
true
;
}
}
...
...
@@ -672,7 +672,7 @@ void Downstream::inspect_http1_response() {
auto
transfer_encoding
=
resp_
.
fs
.
header
(
http2
::
HD_TRANSFER_ENCODING
);
if
(
transfer_encoding
)
{
resp_
.
fs
.
content_length
=
-
1
;
if
(
util
::
strifind
(
transfer_encoding
->
value
.
c_str
()
,
"chunked"
))
{
if
(
util
::
iends_with_l
(
transfer_encoding
->
value
,
"chunked"
))
{
chunked_response_
=
true
;
}
}
...
...
src/util.h
View file @
919e9eee
...
...
@@ -238,6 +238,10 @@ inline bool iends_with(const std::string &a, const std::string &b) {
return
iends_with
(
std
::
begin
(
a
),
std
::
end
(
a
),
std
::
begin
(
b
),
std
::
end
(
b
));
}
template
<
size_t
N
>
bool
iends_with_l
(
const
std
::
string
&
a
,
const
char
(
&
b
)[
N
])
{
return
iends_with
(
std
::
begin
(
a
),
std
::
end
(
a
),
b
,
b
+
N
-
1
);
}
int
strcompare
(
const
char
*
a
,
const
uint8_t
*
b
,
size_t
n
);
template
<
typename
InputIt
>
bool
strieq
(
const
char
*
a
,
InputIt
b
,
size_t
bn
)
{
...
...
src/util_test.cc
View file @
919e9eee
...
...
@@ -374,6 +374,9 @@ void test_util_ends_with(void) {
CU_ASSERT
(
util
::
iends_with
(
"foo"
,
""
));
CU_ASSERT
(
util
::
iends_with
(
"oFoo"
,
"fOO"
));
CU_ASSERT
(
!
util
::
iends_with
(
"ofoo"
,
"fo"
));
CU_ASSERT
(
util
::
iends_with_l
(
"oFoo"
,
"fOO"
));
CU_ASSERT
(
!
util
::
iends_with_l
(
"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