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
6c99ff12
Commit
6c99ff12
authored
Oct 29, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp2_hd: Rename local as deflate
parent
1c17f7f2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
75 additions
and
75 deletions
+75
-75
hdtest/comp_helper.c
hdtest/comp_helper.c
+4
-4
hdtest/deflatehd.c
hdtest/deflatehd.c
+7
-7
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+31
-31
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+10
-10
tests/main.c
tests/main.c
+2
-2
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+20
-20
tests/nghttp2_hd_test.h
tests/nghttp2_hd_test.h
+1
-1
No files found.
hdtest/comp_helper.c
View file @
6c99ff12
...
...
@@ -58,10 +58,10 @@ json_t* dump_header_table(nghttp2_hd_context *context)
json_object_set_new
(
obj
,
"maxSize"
,
json_integer
(
context
->
hd_table_bufsize_max
));
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
)
{
json_object_set_new
(
obj
,
"
local
Size"
,
json_integer
(
context
->
local
_hd_table_bufsize
));
json_object_set_new
(
obj
,
"max
Local
Size"
,
json_integer
(
context
->
local
_hd_table_bufsize_max
));
json_object_set_new
(
obj
,
"
deflate
Size"
,
json_integer
(
context
->
deflate
_hd_table_bufsize
));
json_object_set_new
(
obj
,
"max
Deflate
Size"
,
json_integer
(
context
->
deflate
_hd_table_bufsize_max
));
}
return
obj
;
}
hdtest/deflatehd.c
View file @
6c99ff12
...
...
@@ -16,7 +16,7 @@
typedef
struct
{
nghttp2_hd_side
side
;
size_t
table_size
;
size_t
local
_table_size
;
size_t
deflate
_table_size
;
int
http1text
;
int
dump_header_table
;
}
deflate_config
;
...
...
@@ -271,7 +271,7 @@ static void print_help(void)
" specification, this value is denoted by
\n
"
" SETTINGS_HEADER_TABLE_SIZE.
\n
"
" Default: 4096
\n
"
" -S, --
local
-table-size=<N>
\n
"
" -S, --
deflate
-table-size=<N>
\n
"
" Use first N bytes of dynamic header table
\n
"
" buffer.
\n
"
" Default: 4096
\n
"
...
...
@@ -283,7 +283,7 @@ static struct option long_options[] = {
{
"response"
,
no_argument
,
NULL
,
'r'
},
{
"http1text"
,
no_argument
,
NULL
,
't'
},
{
"table-size"
,
required_argument
,
NULL
,
's'
},
{
"
local
-table-size"
,
required_argument
,
NULL
,
'S'
},
{
"
deflate
-table-size"
,
required_argument
,
NULL
,
'S'
},
{
"dump-header-table"
,
no_argument
,
NULL
,
'd'
},
{
NULL
,
0
,
NULL
,
0
}
};
...
...
@@ -295,7 +295,7 @@ int main(int argc, char **argv)
config
.
side
=
NGHTTP2_HD_SIDE_REQUEST
;
config
.
table_size
=
NGHTTP2_HD_DEFAULT_MAX_BUFFER_SIZE
;
config
.
local_table_size
=
NGHTTP2_HD_DEFAULT_LOCAL_MAX
_BUFFER_SIZE
;
config
.
deflate_table_size
=
NGHTTP2_HD_DEFAULT_MAX_DEFLATE
_BUFFER_SIZE
;
config
.
http1text
=
0
;
config
.
dump_header_table
=
0
;
while
(
1
)
{
...
...
@@ -325,8 +325,8 @@ int main(int argc, char **argv)
}
break
;
case
'S'
:
/* --
local
-table-size */
config
.
local
_table_size
=
strtoul
(
optarg
,
&
end
,
10
);
/* --
deflate
-table-size */
config
.
deflate
_table_size
=
strtoul
(
optarg
,
&
end
,
10
);
if
(
errno
==
ERANGE
||
*
end
!=
'\0'
)
{
fprintf
(
stderr
,
"-S: Bad option value
\n
"
);
exit
(
EXIT_FAILURE
);
...
...
@@ -342,7 +342,7 @@ int main(int argc, char **argv)
break
;
}
}
nghttp2_hd_deflate_init2
(
&
deflater
,
config
.
side
,
config
.
local
_table_size
);
nghttp2_hd_deflate_init2
(
&
deflater
,
config
.
side
,
config
.
deflate
_table_size
);
nghttp2_hd_change_table_size
(
&
deflater
,
config
.
table_size
);
if
(
config
.
http1text
)
{
perform_from_http1text
(
&
deflater
);
...
...
lib/nghttp2_hd.c
View file @
6c99ff12
...
...
@@ -31,7 +31,7 @@
#include "nghttp2_helper.h"
/* Make scalar initialization form of nghttp2_nv */
#define MAKE_NV(N, V) \
#define MAKE_NV(N, V)
\
{ { (uint8_t*)N, (uint8_t*)V, sizeof(N) - 1, sizeof(V) - 1 }, \
1, NGHTTP2_HD_FLAG_NONE }
...
...
@@ -245,7 +245,7 @@ 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
local
_hd_table_bufsize_max
)
size_t
deflate
_hd_table_bufsize_max
)
{
int
rv
;
context
->
role
=
role
;
...
...
@@ -281,9 +281,9 @@ static int nghttp2_hd_context_init(nghttp2_hd_context *context,
context
->
buf_track
=
NULL
;
context
->
buf_track_capacity
=
0
;
}
context
->
local_hd_table_bufsize_max
=
local
_hd_table_bufsize_max
;
context
->
local
_hd_table_bufsize
=
0
;
context
->
local
_hd_tablelen
=
0
;
context
->
deflate_hd_table_bufsize_max
=
deflate
_hd_table_bufsize_max
;
context
->
deflate
_hd_table_bufsize
=
0
;
context
->
deflate
_hd_tablelen
=
0
;
context
->
emit_setlen
=
0
;
context
->
buf_tracklen
=
0
;
context
->
hd_table_bufsize
=
0
;
...
...
@@ -298,15 +298,15 @@ 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_
LOCAL_MAX
_BUFFER_SIZE
);
NGHTTP2_HD_DEFAULT_
MAX_DEFLATE
_BUFFER_SIZE
);
}
int
nghttp2_hd_deflate_init2
(
nghttp2_hd_context
*
deflater
,
nghttp2_hd_side
side
,
size_t
local
_hd_table_bufsize_max
)
size_t
deflate
_hd_table_bufsize_max
)
{
return
nghttp2_hd_context_init
(
deflater
,
NGHTTP2_HD_ROLE_DEFLATE
,
side
,
local
_hd_table_bufsize_max
);
deflate
_hd_table_bufsize_max
);
}
int
nghttp2_hd_inflate_init
(
nghttp2_hd_context
*
inflater
,
nghttp2_hd_side
side
)
...
...
@@ -706,10 +706,10 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
nghttp2_hd_entry
*
ent
=
nghttp2_hd_ringbuf_get
(
&
context
->
hd_table
,
index
);
context
->
hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
)
{
if
(
context
->
hd_table_bufsize
<
context
->
local
_hd_table_bufsize
)
{
context
->
local
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
local
_hd_tablelen
;
if
(
context
->
hd_table_bufsize
<
context
->
deflate
_hd_table_bufsize
)
{
context
->
deflate
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
deflate
_hd_tablelen
;
}
if
(
ent
->
flags
&
NGHTTP2_HD_FLAG_IMPLICIT_EMIT
)
{
/* Emit common header just before it slips away from the
...
...
@@ -728,15 +728,15 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
}
}
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
)
{
while
(
context
->
local
_hd_table_bufsize
+
room
>
context
->
local
_hd_table_bufsize_max
&&
context
->
local
_hd_tablelen
>
0
)
{
size_t
index
=
context
->
local
_hd_tablelen
-
1
;
while
(
context
->
deflate
_hd_table_bufsize
+
room
>
context
->
deflate
_hd_table_bufsize_max
&&
context
->
deflate
_hd_tablelen
>
0
)
{
size_t
index
=
context
->
deflate
_hd_tablelen
-
1
;
nghttp2_hd_entry
*
ent
=
nghttp2_hd_ringbuf_get
(
&
context
->
hd_table
,
index
);
context
->
local
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
local
_hd_tablelen
;
context
->
deflate
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
deflate
_hd_tablelen
;
if
(
ent
->
flags
&
NGHTTP2_HD_FLAG_IMPLICIT_EMIT
)
{
/* Just like a normal eviction, implicit header must be
emitted twice. */
...
...
@@ -775,7 +775,7 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
}
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
&&
room
>
context
->
local
_hd_table_bufsize_max
)
{
room
>
context
->
deflate
_hd_table_bufsize_max
)
{
uint8_t
flags
=
entry_flags
&
~
(
NGHTTP2_HD_FLAG_NAME_ALLOC
|
NGHTTP2_HD_FLAG_VALUE_ALLOC
|
NGHTTP2_HD_FLAG_NAME_GIFT
|
NGHTTP2_HD_FLAG_VALUE_GIFT
);
...
...
@@ -814,9 +814,9 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
new_ent
->
flags
|=
NGHTTP2_HD_FLAG_REFSET
;
nghttp2_hd_ringbuf_push_front
(
&
context
->
hd_table
,
new_ent
);
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
&&
room
<=
context
->
local
_hd_table_bufsize_max
)
{
context
->
local
_hd_table_bufsize
+=
room
;
++
context
->
local
_hd_tablelen
;
room
<=
context
->
deflate
_hd_table_bufsize_max
)
{
context
->
deflate
_hd_table_bufsize
+=
room
;
++
context
->
deflate
_hd_tablelen
;
}
}
return
new_ent
;
...
...
@@ -826,7 +826,7 @@ static ssize_t find_in_hd_table(nghttp2_hd_context *context, nghttp2_nv *nv)
{
size_t
i
;
size_t
max
=
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
?
context
->
local
_hd_tablelen
:
context
->
hd_table
.
len
;
context
->
deflate
_hd_tablelen
:
context
->
hd_table
.
len
;
for
(
i
=
0
;
i
<
max
;
++
i
)
{
nghttp2_hd_entry
*
ent
=
nghttp2_hd_ringbuf_get
(
&
context
->
hd_table
,
i
);
if
(
nghttp2_nv_equal
(
&
ent
->
nv
,
nv
))
{
...
...
@@ -847,7 +847,7 @@ static ssize_t find_name_in_hd_table(nghttp2_hd_context *context,
{
size_t
i
;
size_t
max
=
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
?
context
->
local
_hd_tablelen
:
context
->
hd_table
.
len
;
context
->
deflate
_hd_tablelen
:
context
->
hd_table
.
len
;
for
(
i
=
0
;
i
<
max
;
++
i
)
{
nghttp2_hd_entry
*
ent
=
nghttp2_hd_ringbuf_get
(
&
context
->
hd_table
,
i
);
if
(
ent
->
nv
.
namelen
==
nv
->
namelen
&&
...
...
@@ -881,10 +881,10 @@ int nghttp2_hd_change_table_size(nghttp2_hd_context *context,
nghttp2_hd_entry
*
ent
=
nghttp2_hd_ringbuf_get
(
&
context
->
hd_table
,
index
);
context
->
hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
if
(
context
->
role
==
NGHTTP2_HD_ROLE_DEFLATE
)
{
if
(
context
->
hd_table_bufsize
<
context
->
local
_hd_table_bufsize
)
{
context
->
local
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
local
_hd_tablelen
;
if
(
context
->
hd_table_bufsize
<
context
->
deflate
_hd_table_bufsize
)
{
context
->
deflate
_hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
--
context
->
deflate
_hd_tablelen
;
}
}
nghttp2_hd_ringbuf_pop_back
(
&
context
->
hd_table
);
...
...
@@ -940,7 +940,7 @@ static int deflate_nv(nghttp2_hd_context *deflater,
new_ent
=
NULL
;
}
else
if
(
new_ent
->
nv
.
name
!=
NULL
)
{
/* new_ent->ref > 0 and nv.name is not NULL means that new_ent is
in the reference set and in
local
_hd_table_bufsize */
in the reference set and in
deflate
_hd_table_bufsize */
new_ent
->
flags
|=
NGHTTP2_HD_FLAG_EMIT
;
}
rv
=
emit_indexed_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
index
);
...
...
@@ -1015,7 +1015,7 @@ static int deflate_nv(nghttp2_hd_context *deflater,
free
(
new_ent
);
}
else
if
(
new_ent
->
nv
.
name
!=
NULL
)
{
/* new_ent->ref > 0 and nv.name is not NULL means that new_ent is
in the reference set and in
local
_hd_table_bufsize */
in the reference set and in
deflate
_hd_table_bufsize */
new_ent
->
flags
|=
NGHTTP2_HD_FLAG_EMIT
;
}
incidx
=
1
;
...
...
lib/nghttp2_hd.h
View file @
6c99ff12
...
...
@@ -41,7 +41,7 @@
/* Default size of maximum table buffer size for encoder. Even if
remote decoder notifies larger buffer size for its decoding,
encoder only uses the memory up to this value. */
#define NGHTTP2_HD_DEFAULT_
LOCAL_MAX
_BUFFER_SIZE (1 << 12)
#define NGHTTP2_HD_DEFAULT_
MAX_DEFLATE
_BUFFER_SIZE (1 << 12)
typedef
enum
{
NGHTTP2_HD_SIDE_REQUEST
=
0
,
...
...
@@ -96,18 +96,18 @@ typedef struct {
size_t
hd_table_bufsize_max
;
/* The current effective header table size for encoding. This value
is meaningful iff this context is initialized as
encoder. |
local
_hd_table_bufsize| <= |hd_table_bufsize| must be
encoder. |
deflate
_hd_table_bufsize| <= |hd_table_bufsize| must be
hold. */
size_t
local
_hd_table_bufsize
;
size_t
deflate
_hd_table_bufsize
;
/* The maximum effective header table for encoding. Although header
table size is bounded by |hd_table_bufsize_max|, the encoder can
use smaller buffer by not retaining the header name/values beyond
the |
local
_hd_table_bufsize_max| and not referencing those
the |
deflate
_hd_table_bufsize_max| and not referencing those
entries. This value is meaningful iff this context is initialized
as encoder. */
size_t
local
_hd_table_bufsize_max
;
size_t
deflate
_hd_table_bufsize_max
;
/* The number of effective entry in |hd_table|. */
size_t
local
_hd_tablelen
;
size_t
deflate
_hd_tablelen
;
/* Holding emitted entry in deflating header block to retain
reference count. */
nghttp2_hd_entry
**
emit_set
;
...
...
@@ -159,7 +159,7 @@ void nghttp2_hd_entry_free(nghttp2_hd_entry *ent);
* Initializes |deflater| for deflating name/values pairs.
*
* The encoder only uses up to
* NGHTTP2_HD_DEFAULT_
LOCAL_MAX
_BUFFER_SIZE bytes for header table
* NGHTTP2_HD_DEFAULT_
MAX_DEFLATE
_BUFFER_SIZE bytes for header table
* even if the larger value is specified later in
* nghttp2_hd_change_table_size().
*
...
...
@@ -175,8 +175,8 @@ int nghttp2_hd_deflate_init(nghttp2_hd_context *deflater,
/*
* Initializes |deflater| for deflating name/values pairs.
*
* The encoder only uses up to |
local_hd_table_bufsize_max| bytes for
* header table even if the larger value is specified later in
* The encoder only uses up to |
deflate_hd_table_bufsize_max| bytes
*
for
header table even if the larger value is specified later in
* nghttp2_hd_change_table_size().
*
* This function returns 0 if it succeeds, or one of the following
...
...
@@ -187,7 +187,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
local
_hd_table_bufsize_max
);
size_t
deflate
_hd_table_bufsize_max
);
/*
* Initializes |inflater| for inflating name/values pairs.
...
...
tests/main.c
View file @
6c99ff12
...
...
@@ -229,8 +229,8 @@ int main(int argc, char* argv[])
test_nghttp2_hd_deflate_same_indexed_repr
)
||
!
CU_add_test
(
pSuite
,
"hd_deflate_common_header_eviction"
,
test_nghttp2_hd_deflate_common_header_eviction
)
||
!
CU_add_test
(
pSuite
,
"hd_deflate_
local
_buffer"
,
test_nghttp2_hd_deflate_
local
_buffer
)
||
!
CU_add_test
(
pSuite
,
"hd_deflate_
deflate
_buffer"
,
test_nghttp2_hd_deflate_
deflate
_buffer
)
||
!
CU_add_test
(
pSuite
,
"hd_inflate_indname_inc"
,
test_nghttp2_hd_inflate_indname_inc
)
||
!
CU_add_test
(
pSuite
,
"hd_inflate_indname_inc_eviction"
,
...
...
tests/nghttp2_hd_test.c
View file @
6c99ff12
...
...
@@ -247,7 +247,7 @@ void test_nghttp2_hd_deflate_common_header_eviction(void)
nghttp2_hd_deflate_free
(
&
deflater
);
}
void
test_nghttp2_hd_deflate_
local
_buffer
(
void
)
void
test_nghttp2_hd_deflate_
deflate
_buffer
(
void
)
{
nghttp2_hd_context
deflater
,
inflater
;
size_t
i
;
...
...
@@ -275,7 +275,7 @@ void test_nghttp2_hd_deflate_local_buffer(void)
nv3
.
namelen
=
nv3
.
valuelen
=
sizeof
(
val
);
/* Check the case where entry from static table is inserted to
dynamic header table. And it is out of
local
header table
dynamic header table. And it is out of
deflate
header table
size. */
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
32
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_REQUEST
);
...
...
@@ -290,8 +290,8 @@ void test_nghttp2_hd_deflate_local_buffer(void)
* name/value of all entries must be NULL.
*/
CU_ASSERT
(
2
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_table_bufsize
);
for
(
i
=
0
;
i
<
2
;
++
i
)
{
ent
=
nghttp2_hd_table_get
(
&
deflater
,
i
);
CU_ASSERT
(
ent
->
nv
.
name
==
NULL
);
...
...
@@ -308,7 +308,7 @@ void test_nghttp2_hd_deflate_local_buffer(void)
nghttp2_hd_deflate_free
(
&
deflater
);
nghttp2_hd_inflate_free
(
&
inflater
);
/* 156 buffer size can hold all headers in
local
region */
/* 156 buffer size can hold all headers in
deflate
region */
nghttp2_hd_deflate_init2
(
&
deflater
,
NGHTTP2_HD_SIDE_REQUEST
,
156
);
blocklen
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
buf
,
&
buflen
,
0
,
...
...
@@ -322,8 +322,8 @@ void test_nghttp2_hd_deflate_local_buffer(void)
* 3: k1, v1
*/
CU_ASSERT
(
4
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
4
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
156
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
4
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
156
==
deflater
.
deflate
_hd_table_bufsize
);
for
(
i
=
0
;
i
<
4
;
++
i
)
{
CU_ASSERT
(
nghttp2_hd_table_get
(
&
deflater
,
i
)
->
nv
.
name
!=
NULL
);
CU_ASSERT
(
nghttp2_hd_table_get
(
&
deflater
,
i
)
->
nv
.
value
!=
NULL
);
...
...
@@ -331,15 +331,15 @@ void test_nghttp2_hd_deflate_local_buffer(void)
CU_ASSERT
(
0
==
nghttp2_hd_change_table_size
(
&
deflater
,
156
));
CU_ASSERT
(
4
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
4
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
156
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
4
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
156
==
deflater
.
deflate
_hd_table_bufsize
);
blocklen
=
nghttp2_hd_deflate_hd
(
&
deflater
,
&
buf
,
&
buflen
,
0
,
&
nv3
,
1
);
CU_ASSERT
(
blocklen
>
0
);
/* Now header table should be empty */
CU_ASSERT
(
0
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_table_bufsize
);
nghttp2_hd_deflate_free
(
&
deflater
);
...
...
@@ -357,12 +357,12 @@ void test_nghttp2_hd_deflate_local_buffer(void)
* 2: k10, v10 (R)
* 3: k1, v1 (-) <- name, value must be NULL and not in reference set
*
* But due to the
local
table size limit, name/value of index=3 must
* But due to the
deflate
table size limit, name/value of index=3 must
* be NULL.
*/
CU_ASSERT
(
4
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
3
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
120
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
3
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
120
==
deflater
.
deflate
_hd_table_bufsize
);
for
(
i
=
0
;
i
<
3
;
++
i
)
{
CU_ASSERT
(
nghttp2_hd_table_get
(
&
deflater
,
i
)
->
nv
.
name
!=
NULL
);
CU_ASSERT
(
nghttp2_hd_table_get
(
&
deflater
,
i
)
->
nv
.
value
!=
NULL
);
...
...
@@ -390,8 +390,8 @@ void test_nghttp2_hd_deflate_local_buffer(void)
* 4: k1, v1 (-) <- name, value must be NULL
*/
CU_ASSERT
(
5
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
3
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
118
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
3
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
118
==
deflater
.
deflate
_hd_table_bufsize
);
ent
=
nghttp2_hd_table_get
(
&
deflater
,
3
);
CU_ASSERT
(
0
==
(
ent
->
flags
&
NGHTTP2_HD_FLAG_REFSET
));
ent
=
nghttp2_hd_table_get
(
&
deflater
,
3
);
...
...
@@ -419,8 +419,8 @@ void test_nghttp2_hd_deflate_local_buffer(void)
* name/value of all entries must be NULL.
*/
CU_ASSERT
(
6
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_table_bufsize
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_table_bufsize
);
for
(
i
=
0
;
i
<
6
;
++
i
)
{
ent
=
nghttp2_hd_table_get
(
&
deflater
,
i
);
CU_ASSERT
(
0
==
(
ent
->
flags
&
NGHTTP2_HD_FLAG_REFSET
));
...
...
@@ -601,14 +601,14 @@ void test_nghttp2_hd_change_table_size(void)
CU_ASSERT
(
0
==
nghttp2_hd_change_table_size
(
&
deflater
,
16384
));
CU_ASSERT
(
511
==
deflater
.
hd_table
.
mask
);
CU_ASSERT
(
2
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
2
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
2
==
deflater
.
deflate
_hd_tablelen
);
CU_ASSERT
(
5
==
deflater
.
hd_table
.
buffer
[
deflater
.
hd_table
.
first
]
->
nv
.
namelen
);
CU_ASSERT
(
0
==
nghttp2_hd_change_table_size
(
&
deflater
,
0
));
CU_ASSERT
(
511
==
deflater
.
hd_table
.
mask
);
CU_ASSERT
(
0
==
deflater
.
hd_table
.
len
);
CU_ASSERT
(
0
==
deflater
.
local
_hd_tablelen
);
CU_ASSERT
(
0
==
deflater
.
deflate
_hd_tablelen
);
free
(
buf
);
nghttp2_hd_deflate_free
(
&
deflater
);
...
...
tests/nghttp2_hd_test.h
View file @
6c99ff12
...
...
@@ -28,7 +28,7 @@
void
test_nghttp2_hd_deflate
(
void
);
void
test_nghttp2_hd_deflate_same_indexed_repr
(
void
);
void
test_nghttp2_hd_deflate_common_header_eviction
(
void
);
void
test_nghttp2_hd_deflate_
local
_buffer
(
void
);
void
test_nghttp2_hd_deflate_
deflate
_buffer
(
void
);
void
test_nghttp2_hd_inflate_indname_inc
(
void
);
void
test_nghttp2_hd_inflate_indname_inc_eviction
(
void
);
void
test_nghttp2_hd_inflate_newname_inc
(
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