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
b92b49f8
Commit
b92b49f8
authored
Jul 20, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup
parent
9c58004a
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
14 deletions
+17
-14
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+14
-11
lib/nghttp2_hd.h
lib/nghttp2_hd.h
+3
-3
No files found.
lib/nghttp2_hd.c
View file @
b92b49f8
...
...
@@ -187,7 +187,7 @@ static int nghttp2_hd_context_init(nghttp2_hd_context *context,
}
else
{
ini_table
=
reshd_table
;
}
context
->
capacity
=
0
;
context
->
hd_table_bufsize
=
0
;
for
(
i
=
0
;
ini_table
[
i
];
i
+=
2
)
{
nghttp2_hd_entry
*
p
=
malloc
(
sizeof
(
nghttp2_hd_entry
));
nghttp2_hd_entry_init
(
p
,
i
/
2
,
NGHTTP2_HD_FLAG_NONE
,
...
...
@@ -195,7 +195,7 @@ static int nghttp2_hd_context_init(nghttp2_hd_context *context,
(
uint8_t
*
)
ini_table
[
i
+
1
],
strlen
(
ini_table
[
i
+
1
]));
context
->
hd_table
[
context
->
hd_tablelen
++
]
=
p
;
context
->
capacity
+=
NGHTTP2_HD_ENTRY_OVERHEAD
+
context
->
hd_table_bufsize
+=
NGHTTP2_HD_ENTRY_OVERHEAD
+
p
->
nv
.
namelen
+
p
->
nv
.
valuelen
;
}
return
0
;
...
...
@@ -277,12 +277,12 @@ static nghttp2_hd_entry* add_hd_table_incremental(nghttp2_hd_context *context,
room
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
)
{
return
NULL
;
}
context
->
capacity
+=
room
;
context
->
hd_table_bufsize
+=
room
;
for
(
i
=
0
;
i
<
context
->
hd_tablelen
&&
context
->
capacity
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
;
++
i
)
{
context
->
hd_table_bufsize
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
;
++
i
)
{
nghttp2_hd_entry
*
ent
=
context
->
hd_table
[
i
];
--
ent
->
ref
;
context
->
capacity
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
context
->
hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
if
(
ent
->
ref
==
0
)
{
nghttp2_hd_entry_free
(
ent
);
free
(
ent
);
...
...
@@ -323,16 +323,18 @@ static nghttp2_hd_entry* add_hd_table_subst(nghttp2_hd_context *context,
context
->
hd_tablelen
<=
subindex
)
{
return
NULL
;
}
context
->
capacity
-=
entry_room
(
context
->
hd_table
[
subindex
]
->
nv
.
namelen
,
context
->
hd_table_bufsize
-=
entry_room
(
context
->
hd_table
[
subindex
]
->
nv
.
namelen
,
context
->
hd_table
[
subindex
]
->
nv
.
valuelen
);
context
->
capacity
+=
room
;
context
->
hd_table_bufsize
+=
room
;
k
=
subindex
;
for
(
i
=
0
;
i
<
context
->
hd_tablelen
&&
context
->
capacity
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
;
++
i
,
--
k
)
{
context
->
hd_table_bufsize
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
;
++
i
,
--
k
)
{
nghttp2_hd_entry
*
ent
=
context
->
hd_table
[
i
];
--
ent
->
ref
;
if
(
i
!=
subindex
)
{
context
->
capacity
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
context
->
hd_table_bufsize
-=
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
);
}
if
(
ent
->
ref
==
0
)
{
nghttp2_hd_entry_free
(
ent
);
...
...
@@ -726,7 +728,8 @@ static int require_eviction_on_subst(nghttp2_hd_context *context,
nghttp2_nv
*
nv
,
nghttp2_hd_entry
*
ent
)
{
return
context
->
capacity
-
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
)
+
return
context
->
hd_table_bufsize
-
entry_room
(
ent
->
nv
.
namelen
,
ent
->
nv
.
valuelen
)
+
entry_room
(
nv
->
namelen
,
nv
->
valuelen
)
>
NGHTTP2_MAX_HD_TABLE_CAPACITY
;
}
...
...
lib/nghttp2_hd.h
View file @
b92b49f8
...
...
@@ -109,10 +109,10 @@ typedef struct {
uint16_t
ws_capacity
;
/* The number of entry the |ws| contains */
uint16_t
wslen
;
/* Abstract
capacity of hd_table as described in the spec. This
is
the sum of length of name/value in hd_table +
/* Abstract
buffer size of hd_table as described in the spec. Th
is
is
the sum of length of name/value in hd_table +
NGHTTP2_HD_ENTRY_OVERHEAD bytes overhead per each entry. */
uint16_t
capacity
;
uint16_t
hd_table_bufsize
;
}
nghttp2_hd_context
;
/*
...
...
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