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
9c58004a
Commit
9c58004a
authored
Jul 20, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
c3ed20b7
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
26 deletions
+26
-26
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+22
-22
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+2
-2
tests/nghttp2_hd_test.c
tests/nghttp2_hd_test.c
+2
-2
No files found.
lib/nghttp2_hd.c
View file @
9c58004a
...
@@ -597,7 +597,7 @@ static uint8_t* decode_length(ssize_t *res, uint8_t *in, uint8_t *last,
...
@@ -597,7 +597,7 @@ static uint8_t* decode_length(ssize_t *res, uint8_t *in, uint8_t *last,
}
}
}
}
static
int
emit_index_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
static
int
emit_index
ed
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_hd_entry
*
ent
)
size_t
*
offset_ptr
,
nghttp2_hd_entry
*
ent
)
{
{
int
rv
;
int
rv
;
...
@@ -614,7 +614,7 @@ static int emit_index_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -614,7 +614,7 @@ static int emit_index_block(uint8_t **buf_ptr, size_t *buflen_ptr,
return
0
;
return
0
;
}
}
static
int
emit_
literal_
indname_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
static
int
emit_indname_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_hd_entry
*
ent
,
size_t
*
offset_ptr
,
nghttp2_hd_entry
*
ent
,
const
uint8_t
*
value
,
size_t
valuelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
int
inc_indexing
)
int
inc_indexing
)
...
@@ -636,7 +636,7 @@ static int emit_literal_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -636,7 +636,7 @@ static int emit_literal_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
return
0
;
return
0
;
}
}
static
int
emit_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
static
int
emit_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
int
inc_indexing
)
int
inc_indexing
)
{
{
...
@@ -682,7 +682,7 @@ static int emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -682,7 +682,7 @@ static int emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
return
0
;
return
0
;
}
}
static
int
emit_subst_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
static
int
emit_subst_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
index
)
size_t
index
)
{
{
...
@@ -755,7 +755,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
...
@@ -755,7 +755,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
if
(
rv
<
0
)
{
if
(
rv
<
0
)
{
return
rv
;
return
rv
;
}
}
rv
=
emit_index_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
ent
);
rv
=
emit_index
ed
_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
ent
);
if
(
rv
<
0
)
{
if
(
rv
<
0
)
{
return
rv
;
return
rv
;
}
}
...
@@ -765,7 +765,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
...
@@ -765,7 +765,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
if
(
ent
)
{
if
(
ent
)
{
/* As long as no eviction kicked in, perform substitution */
/* As long as no eviction kicked in, perform substitution */
if
(
require_eviction_on_subst
(
deflater
,
&
nv
[
i
],
ent
))
{
if
(
require_eviction_on_subst
(
deflater
,
&
nv
[
i
],
ent
))
{
rv
=
emit_
literal_
indname_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
ent
,
rv
=
emit_indname_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
ent
,
nv
[
i
].
value
,
nv
[
i
].
valuelen
,
0
);
nv
[
i
].
value
,
nv
[
i
].
valuelen
,
0
);
}
else
{
}
else
{
nghttp2_hd_entry
*
new_ent
;
nghttp2_hd_entry
*
new_ent
;
...
@@ -787,7 +787,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
...
@@ -787,7 +787,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
}
}
}
}
}
else
{
}
else
{
rv
=
emit_
literal
_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
&
nv
[
i
],
0
);
rv
=
emit_
newname
_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
&
nv
[
i
],
0
);
if
(
rv
<
0
)
{
if
(
rv
<
0
)
{
return
rv
;
return
rv
;
}
}
...
@@ -799,7 +799,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
...
@@ -799,7 +799,7 @@ ssize_t nghttp2_hd_deflate_hd(nghttp2_hd_context *deflater,
nghttp2_hd_ws_entry
*
ws_ent
=
&
deflater
->
ws
[
i
];
nghttp2_hd_ws_entry
*
ws_ent
=
&
deflater
->
ws
[
i
];
if
(
ws_ent
->
cat
==
NGHTTP2_HD_CAT_INDEXED
&&
if
(
ws_ent
->
cat
==
NGHTTP2_HD_CAT_INDEXED
&&
!
ws_ent
->
indexed
.
checked
)
{
!
ws_ent
->
indexed
.
checked
)
{
rv
=
emit_index_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
rv
=
emit_index
ed
_block
(
buf_ptr
,
buflen_ptr
,
&
offset
,
ws_ent
->
indexed
.
entry
);
ws_ent
->
indexed
.
entry
);
if
(
rv
<
0
)
{
if
(
rv
<
0
)
{
return
rv
;
return
rv
;
...
@@ -1092,15 +1092,15 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -1092,15 +1092,15 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
const
uint8_t
*
value
,
size_t
valuelen
,
const
uint8_t
*
value
,
size_t
valuelen
,
int
inc_indexing
)
int
inc_indexing
)
{
{
return
emit_
literal_
indname_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
return
emit_indname_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
ent
,
value
,
valuelen
,
inc_indexing
);
ent
,
value
,
valuelen
,
inc_indexing
);
}
}
int
nghttp2_hd_emit_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
int
nghttp2_hd_emit_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
int
inc_indexing
)
int
inc_indexing
)
{
{
return
emit_
literal
_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
nv
,
inc_indexing
);
return
emit_
newname
_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
nv
,
inc_indexing
);
}
}
int
nghttp2_hd_emit_subst_indname_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
int
nghttp2_hd_emit_subst_indname_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
...
@@ -1113,9 +1113,9 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -1113,9 +1113,9 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
ent
,
value
,
valuelen
,
index
);
ent
,
value
,
valuelen
,
index
);
}
}
int
nghttp2_hd_emit_subst_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
int
nghttp2_hd_emit_subst_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
index
)
size_t
index
)
{
{
return
emit_subst_
literal
_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
nv
,
index
);
return
emit_subst_
newname
_block
(
buf_ptr
,
buflen_ptr
,
offset_ptr
,
nv
,
index
);
}
}
lib/nghttp2_hd.h
View file @
9c58004a
...
@@ -225,7 +225,7 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -225,7 +225,7 @@ int nghttp2_hd_emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
int
inc_indexing
);
int
inc_indexing
);
/* For unittesting purpose */
/* For unittesting purpose */
int
nghttp2_hd_emit_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
int
nghttp2_hd_emit_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
int
inc_indexing
);
int
inc_indexing
);
...
@@ -237,7 +237,7 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
...
@@ -237,7 +237,7 @@ int nghttp2_hd_emit_subst_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
size_t
index
);
size_t
index
);
/* For unittesting purpose */
/* For unittesting purpose */
int
nghttp2_hd_emit_subst_
literal
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
int
nghttp2_hd_emit_subst_
newname
_block
(
uint8_t
**
buf_ptr
,
size_t
*
buflen_ptr
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
*
offset_ptr
,
nghttp2_nv
*
nv
,
size_t
index
);
size_t
index
);
...
...
tests/nghttp2_hd_test.c
View file @
9c58004a
...
@@ -159,7 +159,7 @@ void test_nghttp2_hd_inflate_newname_inc(void)
...
@@ -159,7 +159,7 @@ void test_nghttp2_hd_inflate_newname_inc(void)
nghttp2_nv
*
resnva
;
nghttp2_nv
*
resnva
;
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_SERVER
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_SERVER
);
CU_ASSERT
(
0
==
nghttp2_hd_emit_
literal
_block
(
&
buf
,
&
buflen
,
&
offset
,
CU_ASSERT
(
0
==
nghttp2_hd_emit_
newname
_block
(
&
buf
,
&
buflen
,
&
offset
,
&
nv
,
1
));
&
nv
,
1
));
CU_ASSERT
(
1
==
nghttp2_hd_inflate_hd
(
&
inflater
,
&
resnva
,
buf
,
offset
));
CU_ASSERT
(
1
==
nghttp2_hd_inflate_hd
(
&
inflater
,
&
resnva
,
buf
,
offset
));
assert_nv_equal
(
&
nv
,
resnva
,
1
);
assert_nv_equal
(
&
nv
,
resnva
,
1
);
...
@@ -267,7 +267,7 @@ void test_nghttp2_hd_inflate_newname_subst(void)
...
@@ -267,7 +267,7 @@ void test_nghttp2_hd_inflate_newname_subst(void)
nghttp2_nv
*
resnva
;
nghttp2_nv
*
resnva
;
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_SERVER
);
nghttp2_hd_inflate_init
(
&
inflater
,
NGHTTP2_HD_SIDE_SERVER
);
CU_ASSERT
(
0
==
nghttp2_hd_emit_subst_
literal
_block
(
&
buf
,
&
buflen
,
&
offset
,
CU_ASSERT
(
0
==
nghttp2_hd_emit_subst_
newname
_block
(
&
buf
,
&
buflen
,
&
offset
,
&
nv
,
1
));
&
nv
,
1
));
CU_ASSERT
(
1
==
nghttp2_hd_inflate_hd
(
&
inflater
,
&
resnva
,
buf
,
offset
));
CU_ASSERT
(
1
==
nghttp2_hd_inflate_hd
(
&
inflater
,
&
resnva
,
buf
,
offset
));
assert_nv_equal
(
&
nv
,
resnva
,
1
);
assert_nv_equal
(
&
nv
,
resnva
,
1
);
...
...
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