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
6b8ee350
Commit
6b8ee350
authored
May 23, 2018
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reject headers without name
parent
2a70f51e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
5 deletions
+20
-5
cache_http1_proto.c
bin/varnishd/http1/cache_http1_proto.c
+11
-4
b00040.vtc
bin/varnishtest/tests/b00040.vtc
+9
-1
No files found.
bin/varnishd/http1/cache_http1_proto.c
View file @
6b8ee350
...
...
@@ -155,16 +155,16 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
*
q
++
=
' '
;
}
/* Empty header = end of headers */
if
(
p
==
q
)
break
;
if
(
q
-
p
>
maxhdr
)
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Header too long: %.*s"
,
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
return
(
400
);
}
/* Empty header = end of headers */
if
(
p
==
q
)
break
;
if
(
vct_islws
(
*
p
))
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"1st header has white space: %.*s"
,
...
...
@@ -172,6 +172,13 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
return
(
400
);
}
if
(
*
p
==
':'
)
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Missing header name: %.*s"
,
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
return
(
400
);
}
if
((
p
[
0
]
==
'i'
||
p
[
0
]
==
'I'
)
&&
(
p
[
1
]
==
'f'
||
p
[
1
]
==
'F'
)
&&
p
[
2
]
==
'-'
)
...
...
bin/varnishtest/tests/b00040.vtc
View file @
6b8ee350
...
...
@@ -2,7 +2,7 @@ varnishtest "test certain mailformed requests"
server s1 {
rxreq
# expect req.url == /3
expect req.url == /4
txresp
} -start
...
...
@@ -15,6 +15,7 @@ logexpect l1 -v v1 -g raw {
expect * 1010 BogoHeader {Header has ctrl char 0x01}
expect * 1012 BogoHeader {Header has ctrl char 0x0d}
expect * 1014 BogoHeader {Header has ctrl char 0x0d}
expect * 1016 BogoHeader {Missing header name:.*}
} -start
client c1 {
...
...
@@ -71,6 +72,13 @@ client c1 {
rxresp
expect resp.status == 400
} -run
delay .1
client c1 {
send "GET /8 HTTP/1.1\r\nHost: foo\r\n: Header\r\n\r\n"
rxresp
expect resp.status == 400
} -run
logexpect l1 -wait
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