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
7b6f5b3a
Commit
7b6f5b3a
authored
Mar 27, 2024
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http2_hpack: Remove one level of nesting
Better diff with the --ignore-all-space option.
parent
3b0d8adc
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
59 deletions
+54
-59
cache_http2_hpack.c
bin/varnishd/http2/cache_http2_hpack.c
+54
-59
No files found.
bin/varnishd/http2/cache_http2_hpack.c
View file @
7b6f5b3a
...
...
@@ -169,69 +169,64 @@ h2h_addhdr(struct http *hp, struct h2h_decode *d)
return
(
H2SE_ENHANCE_YOUR_CALM
);
}
if
(
*
nm
.
b
==
':'
)
{
/* Match H/2 pseudo headers */
/* XXX: Should probably have some include tbl for
pseudo-headers */
if
(
!
Tstrcmp
(
nm
,
":method"
))
{
hdr
.
b
=
val
.
b
;
n
=
HTTP_HDR_METHOD
;
disallow_empty
=
1
;
/* Check HTTP token */
for
(
p
=
hdr
.
b
;
p
<
hdr
.
e
;
p
++
)
{
if
(
!
vct_istchar
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
else
if
(
!
Tstrcmp
(
nm
,
":path"
))
{
hdr
.
b
=
val
.
b
;
n
=
HTTP_HDR_URL
;
disallow_empty
=
1
;
// rfc9113,l,2693,2705
if
(
Tlen
(
val
)
>
0
&&
*
val
.
b
!=
'/'
&&
Tstrcmp
(
val
,
"*"
))
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Illegal :path pseudo-header %.*s"
,
(
int
)
Tlen
(
val
),
val
.
b
);
/* Match H/2 pseudo headers */
/* XXX: Should probably have some include tbl for pseudo-headers */
if
(
!
Tstrcmp
(
nm
,
":method"
))
{
hdr
.
b
=
val
.
b
;
n
=
HTTP_HDR_METHOD
;
disallow_empty
=
1
;
/* Check HTTP token */
for
(
p
=
hdr
.
b
;
p
<
hdr
.
e
;
p
++
)
{
if
(
!
vct_istchar
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
}
else
if
(
!
Tstrcmp
(
nm
,
":path"
))
{
hdr
.
b
=
val
.
b
;
n
=
HTTP_HDR_URL
;
disallow_empty
=
1
;
/* Path cannot contain LWS or CTL */
for
(
p
=
hdr
.
b
;
p
<
hdr
.
e
;
p
++
)
{
if
(
vct_islws
(
*
p
)
||
vct_isctl
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
else
if
(
!
Tstrcmp
(
nm
,
":scheme"
))
{
/* XXX: What to do about this one? (typically
"http" or "https"). For now set it as a normal
header, stripping the first ':'. */
hdr
.
b
++
;
has_dup
=
d
->
has_scheme
;
d
->
has_scheme
=
1
;
disallow_empty
=
1
;
/* Check HTTP token */
for
(
p
=
val
.
b
;
p
<
val
.
e
;
p
++
)
{
if
(
!
vct_istchar
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
else
if
(
!
Tstrcmp
(
nm
,
":authority"
))
{
/* NB: we inject "host" in place of "rity" for
* the ":authority" pseudo-header.
*/
memcpy
(
d
->
out
+
6
,
"host"
,
4
);
hdr
.
b
+=
6
;
nm
=
Tstr
(
":authority"
);
/* preserve original */
has_dup
=
d
->
has_authority
;
d
->
has_authority
=
1
;
}
else
{
/* Unknown pseudo-header */
// rfc9113,l,2693,2705
if
(
Tlen
(
val
)
>
0
&&
val
.
b
[
0
]
!=
'/'
&&
Tstrcmp
(
val
,
"*"
))
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"
Unknown pseudo-header:
%.*s"
,
vmin_t
(
int
,
Tlen
(
hdr
),
20
),
hdr
.
b
);
return
(
H2SE_PROTOCOL_ERROR
);
// rfc7540,l,2990,2992
"
Illegal :path pseudo-header
%.*s"
,
(
int
)
Tlen
(
val
),
val
.
b
);
return
(
H2SE_PROTOCOL_ERROR
);
}
/* Path cannot contain LWS or CTL */
for
(
p
=
hdr
.
b
;
p
<
hdr
.
e
;
p
++
)
{
if
(
vct_islws
(
*
p
)
||
vct_isctl
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
else
if
(
!
Tstrcmp
(
nm
,
":scheme"
))
{
/* XXX: What to do about this one? (typically
"http" or "https"). For now set it as a normal
header, stripping the first ':'. */
hdr
.
b
++
;
has_dup
=
d
->
has_scheme
;
d
->
has_scheme
=
1
;
disallow_empty
=
1
;
/* Check HTTP token */
for
(
p
=
val
.
b
;
p
<
val
.
e
;
p
++
)
{
if
(
!
vct_istchar
(
*
p
))
return
(
H2SE_PROTOCOL_ERROR
);
}
}
else
if
(
!
Tstrcmp
(
nm
,
":authority"
))
{
/* NB: we inject "host" in place of "rity" for
* the ":authority" pseudo-header.
*/
memcpy
(
d
->
out
+
6
,
"host"
,
4
);
hdr
.
b
+=
6
;
nm
=
Tstr
(
":authority"
);
/* preserve original */
has_dup
=
d
->
has_authority
;
d
->
has_authority
=
1
;
}
else
if
(
nm
.
b
[
0
]
==
':'
)
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Unknown pseudo-header: %.*s"
,
vmin_t
(
int
,
Tlen
(
hdr
),
20
),
hdr
.
b
);
return
(
H2SE_PROTOCOL_ERROR
);
// rfc7540,l,2990,2992
}
if
(
disallow_empty
&&
Tlen
(
val
)
==
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