Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
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
pistache
Commits
6d38ea58
Unverified
Commit
6d38ea58
authored
Oct 28, 2020
by
Kip
Committed by
GitHub
Oct 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #829 from BenjaminBeichler/master
fix chunked transfer decoding
parents
c04166ca
88a30838
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
include/pistache/http.h
include/pistache/http.h
+1
-0
src/common/http.cc
src/common/http.cc
+8
-6
No files found.
include/pistache/http.h
View file @
6d38ea58
...
...
@@ -502,6 +502,7 @@ private:
Message
*
message
;
size_t
bytesRead
;
ssize_t
size
;
ssize_t
alreadyAppendedChunkBytes
;
};
State
parseContentLength
(
StreamCursor
&
cursor
,
...
...
src/common/http.cc
View file @
6d38ea58
...
...
@@ -412,6 +412,7 @@ BodyStep::Chunk::Result BodyStep::Chunk::parse(StreamCursor &cursor) {
revert
.
ignore
();
size
=
sz
;
alreadyAppendedChunkBytes
=
0
;
}
if
(
size
==
0
)
...
...
@@ -421,17 +422,18 @@ BodyStep::Chunk::Result BodyStep::Chunk::parse(StreamCursor &cursor) {
StreamCursor
::
Token
chunkData
(
cursor
);
const
ssize_t
available
=
cursor
.
remaining
();
if
(
static_cast
<
ssize_t
>
(
available
+
message
->
body_
.
size
())
<
size
)
{
if
(
available
+
alreadyAppendedChunkBytes
<
size
+
2
)
{
cursor
.
advance
(
available
);
message
->
body_
.
append
(
chunkData
.
rawText
(),
available
);
alreadyAppendedChunkBytes
+=
available
;
return
Incomplete
;
}
cursor
.
advance
(
size
-
message
->
body_
.
size
());
cursor
.
advance
(
size
-
alreadyAppendedChunkBytes
);
//trailing EOL
cursor
.
advance
(
2
);
if
(
!
cursor
.
advance
(
2
))
return
Incomplete
;
message
->
body_
.
append
(
chunkData
.
rawText
(),
size
-
message
->
body_
.
size
());
message
->
body_
.
append
(
chunkData
.
rawText
(),
size
-
alreadyAppendedChunkBytes
);
return
Complete
;
}
...
...
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