Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
4d3037a1
Commit
4d3037a1
authored
Mar 22, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Generalize HPACK length encoding
Fixes #2260
parent
5b70451f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
22 deletions
+26
-22
cache_http2_deliver.c
bin/varnishd/http2/cache_http2_deliver.c
+22
-21
t02000.vtc
bin/varnishtest/tests/t02000.vtc
+4
-1
No files found.
bin/varnishd/http2/cache_http2_deliver.c
View file @
4d3037a1
...
...
@@ -154,6 +154,24 @@ h2_minimal_response(struct req *req, uint16_t status)
return
(
0
);
}
static
uint8_t
*
h2_enc_len
(
uint8_t
*
p
,
unsigned
bits
,
unsigned
val
)
{
assert
(
bits
<
8
);
unsigned
mask
=
(
1U
<<
bits
)
-
1U
;
if
(
val
>=
mask
)
{
*
p
++
|=
(
uint8_t
)
mask
;
val
-=
mask
;
while
(
val
>=
128
)
{
*
p
++
=
0x80
|
((
uint8_t
)
val
&
0x7f
);
val
>>=
7
;
}
}
*
p
++
=
(
uint8_t
)
val
;
return
(
p
);
}
void
__match_proto__
(
vtr_deliver_f
)
h2_deliver
(
struct
req
*
req
,
struct
boc
*
boc
,
int
sendbody
)
{
...
...
@@ -205,23 +223,13 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
VSLb
(
req
->
vsl
,
SLT_Debug
,
"HP {%d,
\"
%s
\"
,
\"
%s
\"
} <%s>"
,
hps
->
idx
,
hps
->
name
,
hps
->
val
,
hp
->
hd
[
u
].
b
);
if
(
hps
->
idx
<
15
)
{
*
p
++
=
0x10
|
hps
->
idx
;
}
else
{
*
p
++
=
0x1f
;
*
p
++
=
hps
->
idx
-
0x0f
;
}
*
p
=
0x10
;
p
=
h2_enc_len
(
p
,
4
,
hps
->
idx
);
}
else
{
*
p
++
=
0x10
;
sz
--
;
if
(
sz
<
127
)
{
*
p
++
=
(
uint8_t
)
sz
;
}
else
{
*
p
++
=
0x7f
;
*
p
++
=
(
uint8_t
)
sz
-
0x7f
;
}
p
=
h2_enc_len
(
p
,
7
,
sz
);
for
(
sz1
=
0
;
sz1
<
sz
;
sz1
++
)
*
p
++
=
(
uint8_t
)
tolower
(
hp
->
hd
[
u
].
b
[
sz1
]);
...
...
@@ -230,14 +238,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
while
(
vct_islws
(
*++
r
))
continue
;
sz
=
hp
->
hd
[
u
].
e
-
r
;
assert
(
sz
<=
254
);
if
(
sz
<
127
)
{
*
p
++
=
(
uint8_t
)
sz
;
}
else
if
(
sz
<
127
*
2
)
{
*
p
++
=
0x7f
;
*
p
++
=
(
uint8_t
)
sz
-
0x7f
;
}
p
=
h2_enc_len
(
p
,
7
,
sz
);
memcpy
(
p
,
r
,
sz
);
p
+=
sz
;
assert
(
WS_Inside
(
req
->
ws
,
p
,
NULL
));
...
...
bin/varnishtest/tests/t02000.vtc
View file @
4d3037a1
...
...
@@ -3,7 +3,10 @@ varnishtest "Direct H2 start"
server s1 {
rxreq
expect req.http.host == foo.bar
txresp -bodylen 10
txresp \
-hdr "H234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789I: foo" \
-hdr "Foo: H234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789I" \
-bodylen 10
} -start
varnish v1 -vcl+backend {} -start
...
...
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