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
d3d6c5e3
Commit
d3d6c5e3
authored
Mar 24, 2015
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug that inflater->nvbufs is not reset
parent
125e32eb
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
22 deletions
+13
-22
lib/nghttp2_buf.c
lib/nghttp2_buf.c
+7
-15
lib/nghttp2_buf.h
lib/nghttp2_buf.h
+2
-3
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+2
-0
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+1
-2
tests/nghttp2_buf_test.c
tests/nghttp2_buf_test.c
+1
-2
No files found.
lib/nghttp2_buf.c
View file @
d3d6c5e3
...
@@ -410,31 +410,23 @@ ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) {
...
@@ -410,31 +410,23 @@ ssize_t nghttp2_bufs_remove(nghttp2_bufs *bufs, uint8_t **out) {
len
+=
nghttp2_buf_len
(
&
chain
->
buf
);
len
+=
nghttp2_buf_len
(
&
chain
->
buf
);
}
}
if
(
!
len
)
{
if
(
len
==
0
)
{
res
=
NULL
;
res
=
NULL
;
}
else
{
return
0
;
res
=
nghttp2_mem_malloc
(
bufs
->
mem
,
len
);
}
if
(
res
==
NULL
)
{
res
=
nghttp2_mem_malloc
(
bufs
->
mem
,
len
);
return
NGHTTP2_ERR_NOMEM
;
if
(
res
==
NULL
)
{
}
return
NGHTTP2_ERR_NOMEM
;
}
}
nghttp2_buf_wrap_init
(
&
resbuf
,
res
,
len
);
nghttp2_buf_wrap_init
(
&
resbuf
,
res
,
len
);
for
(
chain
=
bufs
->
head
;
chain
;
chain
=
chain
->
next
)
{
for
(
chain
=
bufs
->
head
;
chain
;
chain
=
chain
->
next
)
{
buf
=
&
chain
->
buf
;
buf
=
&
chain
->
buf
;
resbuf
.
last
=
nghttp2_cpymem
(
resbuf
.
last
,
buf
->
pos
,
nghttp2_buf_len
(
buf
));
if
(
resbuf
.
last
)
{
resbuf
.
last
=
nghttp2_cpymem
(
resbuf
.
last
,
buf
->
pos
,
nghttp2_buf_len
(
buf
));
}
nghttp2_buf_reset
(
buf
);
nghttp2_buf_shift_right
(
&
chain
->
buf
,
bufs
->
offset
);
}
}
bufs
->
cur
=
bufs
->
head
;
*
out
=
res
;
*
out
=
res
;
return
(
ssize_t
)
len
;
return
(
ssize_t
)
len
;
...
...
lib/nghttp2_buf.h
View file @
d3d6c5e3
...
@@ -313,9 +313,8 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b);
...
@@ -313,9 +313,8 @@ int nghttp2_bufs_orb_hold(nghttp2_bufs *bufs, uint8_t b);
* function allocates the contagious memory to store all data in
* function allocates the contagious memory to store all data in
* |bufs| and assigns it to |*out|.
* |bufs| and assigns it to |*out|.
*
*
* On successful return, nghttp2_bufs_len(bufs) returns 0, just like
* The contents of |bufs| is left unchanged.
* after calling nghttp2_bufs_reset().
*
* This function returns the length of copied data and assigns the
* This function returns the length of copied data and assigns the
* pointer to copied data to |*out| if it succeeds, or one of the
* pointer to copied data to |*out| if it succeeds, or one of the
* following negative error codes:
* following negative error codes:
...
...
lib/nghttp2_hd.c
View file @
d3d6c5e3
...
@@ -1328,6 +1328,8 @@ static int hd_inflate_remove_bufs(nghttp2_hd_inflater *inflater, nghttp2_nv *nv,
...
@@ -1328,6 +1328,8 @@ static int hd_inflate_remove_bufs(nghttp2_hd_inflater *inflater, nghttp2_nv *nv,
return
NGHTTP2_ERR_NOMEM
;
return
NGHTTP2_ERR_NOMEM
;
}
}
nghttp2_bufs_reset
(
&
inflater
->
nvbufs
);
buflen
=
rv
;
buflen
=
rv
;
if
(
value_only
)
{
if
(
value_only
)
{
...
...
lib/nghttp2_hd.h
View file @
d3d6c5e3
...
@@ -324,8 +324,7 @@ void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx);
...
@@ -324,8 +324,7 @@ void nghttp2_hd_huff_decode_context_init(nghttp2_hd_huff_decode_context *ctx);
* be initialized by nghttp2_hd_huff_decode_context_init(). The result
* be initialized by nghttp2_hd_huff_decode_context_init(). The result
* will be added to |dest|. This function may expand |dest| as
* will be added to |dest|. This function may expand |dest| as
* needed. The caller is responsible to release the memory of |dest|
* needed. The caller is responsible to release the memory of |dest|
* by calling nghttp2_bufs_free() or export its content using
* by calling nghttp2_bufs_free().
* nghttp2_bufs_remove().
*
*
* The caller must set the |final| to nonzero if the given input is
* The caller must set the |final| to nonzero if the given input is
* the final block.
* the final block.
...
...
tests/nghttp2_buf_test.c
View file @
d3d6c5e3
...
@@ -198,8 +198,7 @@ void test_nghttp2_bufs_remove(void) {
...
@@ -198,8 +198,7 @@ void test_nghttp2_bufs_remove(void) {
CU_ASSERT
(
11
==
outlen
);
CU_ASSERT
(
11
==
outlen
);
CU_ASSERT
(
0
==
memcmp
(
"hello world"
,
out
,
outlen
));
CU_ASSERT
(
0
==
memcmp
(
"hello world"
,
out
,
outlen
));
CU_ASSERT
(
0
==
nghttp2_bufs_len
(
&
bufs
));
CU_ASSERT
(
11
==
nghttp2_bufs_len
(
&
bufs
));
CU_ASSERT
(
bufs
.
cur
->
buf
.
pos
==
bufs
.
cur
->
buf
.
begin
);
mem
->
free
(
out
,
NULL
);
mem
->
free
(
out
,
NULL
);
nghttp2_bufs_free
(
&
bufs
);
nghttp2_bufs_free
(
&
bufs
);
...
...
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