Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
1c8ab006
Commit
1c8ab006
authored
Sep 29, 2018
by
gejun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes to hpack
parent
30a11278
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
9 deletions
+8
-9
hpack.cpp
src/brpc/details/hpack.cpp
+8
-9
No files found.
src/brpc/details/hpack.cpp
View file @
1c8ab006
...
...
@@ -114,7 +114,7 @@ public:
int
start_index
()
const
{
return
_start_index
;
}
int
end_index
()
const
{
return
start_index
()
+
_header_queue
.
size
();
}
static
size_t
HeaderSize
(
const
Header
&
h
)
{
static
inline
size_t
HeaderSize
(
const
Header
&
h
)
{
// https://tools.ietf.org/html/rfc7541#section-4.1
return
h
.
name
.
size
()
+
h
.
value
.
size
()
+
32
;
}
...
...
@@ -125,15 +125,14 @@ public:
const
size_t
entry_size
=
HeaderSize
(
*
h
);
DCHECK_LE
(
entry_size
,
size
());
const
uint64_t
id
=
_add_times
-
_header_queue
.
size
();
RemoveHeaderFromIndexes
(
*
h
,
id
);
if
(
_need_indexes
)
{
RemoveHeaderFromIndexes
(
*
h
,
id
);
}
_size
-=
entry_size
;
_header_queue
.
pop
();
}
void
RemoveHeaderFromIndexes
(
const
Header
&
h
,
uint64_t
expected_id
)
{
if
(
!
_need_indexes
)
{
return
;
}
const
uint64_t
*
v
=
_header_index
.
seek
(
h
);
DCHECK
(
v
);
if
(
*
v
==
expected_id
)
{
...
...
@@ -150,7 +149,7 @@ public:
CHECK
(
!
h
.
name
.
empty
());
const
size_t
entry_size
=
HeaderSize
(
h
);
while
(
!
empty
()
&&
(
size
()
+
entry_size
>
max_size
())
)
{
while
(
!
empty
()
&&
(
_size
+
entry_size
)
>
_max_size
)
{
PopHeader
();
}
...
...
@@ -703,9 +702,9 @@ void HPacker::Encode(butil::IOBufAppender* out, const Header& header,
// This header is already in the index table
return
EncodeInteger
(
out
,
0x80
,
7
,
index
);
}
}
// The header can't be indexed or the header wasn't in the index table
int
name_index
=
FindNameFromIndexTable
(
header
.
name
);
}
// The header can't be indexed or the header wasn't in the index table
const
int
name_index
=
FindNameFromIndexTable
(
header
.
name
);
if
(
options
.
index_policy
==
HPACK_INDEX_HEADER
)
{
// TODO: Add Options that indexes name independently
_encode_table
->
AddHeader
(
header
);
...
...
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