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
84ad0a72
Commit
84ad0a72
authored
Jun 05, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Be a bit less Postel-y about http header charactersets.
parent
f4a64133
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
14 deletions
+25
-14
cache_http1_proto.c
bin/varnishd/http1/cache_http1_proto.c
+9
-14
b00049.vtc
bin/varnishtest/tests/b00049.vtc
+16
-0
No files found.
bin/varnishd/http1/cache_http1_proto.c
View file @
84ad0a72
...
@@ -116,7 +116,7 @@ static uint16_t
...
@@ -116,7 +116,7 @@ static uint16_t
http1_dissect_hdrs
(
struct
http
*
hp
,
char
*
p
,
struct
http_conn
*
htc
,
http1_dissect_hdrs
(
struct
http
*
hp
,
char
*
p
,
struct
http_conn
*
htc
,
unsigned
maxhdr
)
unsigned
maxhdr
)
{
{
char
*
q
,
*
r
;
char
*
q
,
*
r
,
*
s
;
assert
(
p
>
htc
->
rxbuf_b
);
assert
(
p
>
htc
->
rxbuf_b
);
assert
(
p
<=
htc
->
rxbuf_e
);
assert
(
p
<=
htc
->
rxbuf_e
);
...
@@ -188,7 +188,14 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
...
@@ -188,7 +188,14 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
q
--
;
q
--
;
*
q
=
'\0'
;
*
q
=
'\0'
;
if
(
strchr
(
p
,
':'
)
==
NULL
)
{
for
(
s
=
p
;
*
s
!=
':'
&&
s
<
q
;
s
++
)
{
if
(
!
vct_istchar
(
*
s
))
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Illegal char 0x%02x in header name"
,
*
s
);
return
(
400
);
}
}
if
(
*
s
!=
':'
)
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Header without ':' %.*s"
,
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Header without ':' %.*s"
,
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
return
(
400
);
return
(
400
);
...
@@ -204,18 +211,6 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
...
@@ -204,18 +211,6 @@ http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc,
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
(
int
)(
q
-
p
>
20
?
20
:
q
-
p
),
p
);
return
(
400
);
return
(
400
);
}
}
for
(;
p
<
q
;
p
++
)
{
if
(
vct_islws
(
*
p
))
{
VSLb
(
hp
->
vsl
,
SLT_BogoHeader
,
"Space in header '%.*s'"
,
(
int
)
Tlen
(
hp
->
hd
[
hp
->
nhd
-
1
]),
hp
->
hd
[
hp
->
nhd
-
1
].
b
);
return
(
400
);
}
if
(
*
p
==
':'
)
break
;
}
}
}
if
(
p
<
htc
->
rxbuf_e
)
if
(
p
<
htc
->
rxbuf_e
)
p
+=
vct_skipcrlf
(
p
);
p
+=
vct_skipcrlf
(
p
);
...
...
bin/varnishtest/tests/b00049.vtc
View file @
84ad0a72
...
@@ -7,6 +7,11 @@ server s1 {
...
@@ -7,6 +7,11 @@ server s1 {
varnish v1 -vcl+backend { } -start
varnish v1 -vcl+backend { } -start
logexpect l1 -v v1 -g raw {
expect * 1004 BogoHeader "Illegal char 0x20 in header name"
expect * 1006 BogoHeader "Illegal char 0x2f in header name"
} -start
client c1 {
client c1 {
send "GET / HTTP/1.1\r\n"
send "GET / HTTP/1.1\r\n"
send "Host: foo\r\n"
send "Host: foo\r\n"
...
@@ -30,3 +35,14 @@ client c1 {
...
@@ -30,3 +35,14 @@ client c1 {
rxresp
rxresp
expect resp.status == 400
expect resp.status == 400
} -run
} -run
client c1 {
send "GET / HTTP/1.1\r\n"
send "Host: foo\r\n"
send "Accept/Encoding: gzip\r\n"
send "\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