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
a658f136
Commit
a658f136
authored
Oct 20, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
encode_length: Or-ing first byte with prefix mask
So that we can preserve leading bits.
parent
4e4fab01
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
lib/nghttp2_hd.c
lib/nghttp2_hd.c
+5
-6
No files found.
lib/nghttp2_hd.c
View file @
a658f136
...
...
@@ -485,12 +485,13 @@ static size_t encode_length(uint8_t *buf, size_t n, int prefix)
{
size_t
k
=
(
1
<<
prefix
)
-
1
;
size_t
len
=
0
;
*
buf
&=
~
k
;
if
(
n
>=
k
)
{
*
buf
++
=
k
;
*
buf
++
|
=
k
;
n
-=
k
;
++
len
;
}
else
{
*
buf
++
=
n
;
*
buf
++
|
=
n
;
return
1
;
}
do
{
...
...
@@ -560,8 +561,8 @@ static int emit_indexed_block(uint8_t **buf_ptr, size_t *buflen_ptr,
return
rv
;
}
bufp
=
*
buf_ptr
+
*
offset_ptr
;
*
bufp
=
0x80u
;
encode_length
(
bufp
,
index
,
7
);
(
*
buf_ptr
)[
*
offset_ptr
]
|=
0x80u
;
*
offset_ptr
+=
blocklen
;
return
0
;
}
...
...
@@ -582,13 +583,11 @@ static int emit_indname_block(uint8_t **buf_ptr, size_t *buflen_ptr,
return
rv
;
}
bufp
=
*
buf_ptr
+
*
offset_ptr
;
*
bufp
=
inc_indexing
?
0
:
0x40u
;
bufp
+=
encode_length
(
bufp
,
index
+
1
,
6
);
bufp
+=
encode_length
(
bufp
,
encvallen
,
8
);
nghttp2_hd_huff_encode
(
bufp
,
*
buflen_ptr
-
(
bufp
-
*
buf_ptr
),
value
,
valuelen
,
side
);
if
(
!
inc_indexing
)
{
(
*
buf_ptr
)[
*
offset_ptr
]
|=
0x40u
;
}
assert
(
bufp
+
encvallen
-
(
*
buf_ptr
+
*
offset_ptr
)
==
(
ssize_t
)
blocklen
);
*
offset_ptr
+=
blocklen
;
return
0
;
...
...
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