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
e61876cc
Commit
e61876cc
authored
Dec 14, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp2_hd: Provide dedicated function to enable no reference set feature
parent
41104f7b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
22 deletions
+28
-22
hdtest/deflatehd.c
hdtest/deflatehd.c
+2
-2
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+12
-11
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+9
-5
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+5
-4
No files found.
hdtest/deflatehd.c
View file @
e61876cc
...
...
@@ -384,8 +384,8 @@ int main(int argc, char **argv)
break
;
}
}
nghttp2_hd_deflate_init2
(
&
deflater
,
config
.
side
,
config
.
deflate_table_size
,
config
.
no_refset
);
nghttp2_hd_deflate_init2
(
&
deflater
,
config
.
side
,
config
.
deflate_table_size
);
nghttp2_hd_deflate_set_no_refset
(
&
deflater
,
config
.
no_refset
);
nghttp2_hd_change_table_size
(
&
deflater
,
config
.
table_size
);
if
(
config
.
http1text
)
{
perform_from_http1text
(
&
deflater
);
...
...
lib/nghttp2_hd.c
View file @
e61876cc
...
...
@@ -246,14 +246,13 @@ static void nghttp2_hd_ringbuf_pop_back(nghttp2_hd_ringbuf *ringbuf)
static
int
nghttp2_hd_context_init
(
nghttp2_hd_context
*
context
,
nghttp2_hd_role
role
,
nghttp2_hd_side
side
,
size_t
deflate_hd_table_bufsize_max
,
uint8_t
no_refset
)
size_t
deflate_hd_table_bufsize_max
)
{
int
rv
;
context
->
role
=
role
;
context
->
side
=
side
;
context
->
bad
=
0
;
context
->
no_refset
=
no_refset
;
context
->
no_refset
=
0
;
context
->
hd_table_bufsize_max
=
NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE
;
rv
=
nghttp2_hd_ringbuf_init
(
&
context
->
hd_table
,
...
...
@@ -279,24 +278,20 @@ static int nghttp2_hd_context_init(nghttp2_hd_context *context,
int
nghttp2_hd_deflate_init
(
nghttp2_hd_context
*
deflater
,
nghttp2_hd_side
side
)
{
return
nghttp2_hd_context_init
(
deflater
,
NGHTTP2_HD_ROLE_DEFLATE
,
side
,
NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE
,
0
);
NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE
);
}
int
nghttp2_hd_deflate_init2
(
nghttp2_hd_context
*
deflater
,
nghttp2_hd_side
side
,
size_t
deflate_hd_table_bufsize_max
,
uint8_t
no_refset
)
size_t
deflate_hd_table_bufsize_max
)
{
return
nghttp2_hd_context_init
(
deflater
,
NGHTTP2_HD_ROLE_DEFLATE
,
side
,
deflate_hd_table_bufsize_max
,
no_refset
);
deflate_hd_table_bufsize_max
);
}
int
nghttp2_hd_inflate_init
(
nghttp2_hd_context
*
inflater
,
nghttp2_hd_side
side
)
{
return
nghttp2_hd_context_init
(
inflater
,
NGHTTP2_HD_ROLE_INFLATE
,
side
,
0
,
0
);
return
nghttp2_hd_context_init
(
inflater
,
NGHTTP2_HD_ROLE_INFLATE
,
side
,
0
);
}
static
void
nghttp2_hd_context_free
(
nghttp2_hd_context
*
context
)
...
...
@@ -329,6 +324,12 @@ void nghttp2_hd_inflate_free(nghttp2_hd_context *inflater)
nghttp2_hd_context_free
(
inflater
);
}
void
nghttp2_hd_deflate_set_no_refset
(
nghttp2_hd_context
*
deflater
,
uint8_t
no_refset
)
{
deflater
->
no_refset
=
no_refset
;
}
static
size_t
entry_room
(
size_t
namelen
,
size_t
valuelen
)
{
return
NGHTTP2_HD_ENTRY_OVERHEAD
+
namelen
+
valuelen
;
...
...
lib/nghttp2_hd.h
View file @
e61876cc
...
...
@@ -188,9 +188,6 @@ int nghttp2_hd_deflate_init(nghttp2_hd_context *deflater,
* for header table even if the larger value is specified later in
* nghttp2_hd_change_table_size().
*
* If nonzero is given in the |no_refset|, the encoder first clears
* the reference set each time on deflation.
*
* This function returns 0 if it succeeds, or one of the following
* negative error codes:
*
...
...
@@ -199,8 +196,7 @@ int nghttp2_hd_deflate_init(nghttp2_hd_context *deflater,
*/
int
nghttp2_hd_deflate_init2
(
nghttp2_hd_context
*
deflater
,
nghttp2_hd_side
side
,
size_t
deflate_hd_table_bufsize_max
,
uint8_t
no_refset
);
size_t
deflate_hd_table_bufsize_max
);
/*
* Initializes |inflater| for inflating name/values pairs.
...
...
@@ -224,6 +220,14 @@ void nghttp2_hd_deflate_free(nghttp2_hd_context *deflater);
*/
void
nghttp2_hd_inflate_free
(
nghttp2_hd_context
*
inflater
);
/*
* Sets the availability of reference set in the |deflater|. If
* |no_refset| is nonzero, the deflater will first emit index=0 in the
* each invocation of nghttp2_hd_deflate_hd() to clear up reference
* set. By default, the deflater uses reference set.
*/
void
nghttp2_hd_deflate_set_no_refset
(
nghttp2_hd_context
*
deflater
,
uint8_t
no_refset
);
/*
* Changes header table size in |context|. This may trigger eviction
...
...
tests/nghttp2_hd_test.c
View file @
e61876cc
...
...
@@ -278,7 +278,7 @@ void test_nghttp2_hd_deflate_deflate_buffer(void)
/* Check the case where entry from static table is inserted to
dynamic header table. And it is out of deflate header table
size. */
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
32
,
0
);
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
32
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_REQUEST
);
blocklen
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
buf
,
&
buflen
,
0
,
nva4
,
ARRLEN
(
nva4
));
...
...
@@ -310,7 +310,7 @@ void test_nghttp2_hd_deflate_deflate_buffer(void)
nghttp2_hd_inflate_free
(
&
inflater
);
/* 156 buffer size can hold all headers in deflate region */
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
156
,
0
);
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
156
);
blocklen
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
buf
,
&
buflen
,
0
,
nva1
,
ARRLEN
(
nva1
));
CU_ASSERT
(
blocklen
>
0
);
...
...
@@ -344,7 +344,7 @@ void test_nghttp2_hd_deflate_deflate_buffer(void)
nghttp2_hd_deflate_free
(
&
deflater
);
/* Check more complex use case */
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
155
,
0
);
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
155
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_REQUEST
);
blocklen
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
buf
,
&
buflen
,
0
,
nva1
,
ARRLEN
(
nva1
));
...
...
@@ -452,7 +452,8 @@ void test_nghttp2_hd_deflate_clear_refset(void)
size_t
i
;
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE
,
1
);
NGHTTP2_HD_DEFAULT_MAX_DEFLATE_BUFFER_SIZE
);
nghttp2_hd_deflate_set_no_refset
(
&
deflater
,
1
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_REQUEST
);
for
(
i
=
0
;
i
<
2
;
++
i
)
{
...
...
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