Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
414dbe96
Commit
414dbe96
authored
Aug 18, 2014
by
Vicent Marti
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2525 from libgit2/cmn/http-recv-buffer
http: make sure we can consume the data we request
parents
1a85eca0
294c6f29
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
src/transports/http.c
+20
-4
No files found.
src/transports/http.c
View file @
414dbe96
...
...
@@ -607,7 +607,23 @@ replay:
}
while
(
!*
bytes_read
&&
!
t
->
parse_finished
)
{
t
->
parse_buffer
.
offset
=
0
;
size_t
data_offset
;
/*
* Make the parse_buffer think it's as full of data as
* the buffer, so it won't try to recv more data than
* we can put into it.
*
* data_offset is the actual data offset from which we
* should tell the parser to start reading.
*/
if
(
buf_size
>=
t
->
parse_buffer
.
len
)
{
t
->
parse_buffer
.
offset
=
0
;
}
else
{
t
->
parse_buffer
.
offset
=
t
->
parse_buffer
.
len
-
buf_size
;
}
data_offset
=
t
->
parse_buffer
.
offset
;
if
(
gitno_recv
(
&
t
->
parse_buffer
)
<
0
)
return
-
1
;
...
...
@@ -628,8 +644,8 @@ replay:
bytes_parsed
=
http_parser_execute
(
&
t
->
parser
,
&
t
->
settings
,
t
->
parse_buffer
.
data
,
t
->
parse_buffer
.
offset
);
t
->
parse_buffer
.
data
+
data_offset
,
t
->
parse_buffer
.
offset
-
data_offset
);
t
->
parser
.
data
=
NULL
;
...
...
@@ -647,7 +663,7 @@ replay:
if
(
t
->
parse_error
<
0
)
return
-
1
;
if
(
bytes_parsed
!=
t
->
parse_buffer
.
offset
)
{
if
(
bytes_parsed
!=
t
->
parse_buffer
.
offset
-
data_offset
)
{
giterr_set
(
GITERR_NET
,
"HTTP parser error: %s"
,
http_errno_description
((
enum
http_errno
)
t
->
parser
.
http_errno
));
...
...
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