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
a8067c73
Commit
a8067c73
authored
Nov 04, 2015
by
Federico G. Schwindt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Relax IP constant parsing
Fixes #1801.
parent
e267c5fa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
r01801.vtc
bin/varnishtest/tests/r01801.vtc
+58
-0
vss.c
lib/libvarnish/vss.c
+3
-0
No files found.
bin/varnishtest/tests/r01801.vtc
0 → 100644
View file @
a8067c73
varnishtest "Test parsing IP constants"
server s1 {
rxreq
txresp
} -start
varnish v1 -vcl+backend {
import ${vmod_std};
sub vcl_deliver {
set resp.http.foo1 = std.ip("..", "1.2.3.4");
set resp.http.foo2 = std.ip("..", "1.2.3.4:8000");
set resp.http.foo3 = std.ip("..", "1.2.3.4 8000");
set resp.http.foo4 = std.ip("..", "::1");
set resp.http.foo5 = std.ip("..", "[::1]");
set resp.http.foo6 = std.ip("..", "[::1]:8000");
set resp.http.bar1 = std.port("1.2.3.4");
set resp.http.bar2 = std.port("1.2.3.4:8000");
set resp.http.bar3 = std.port("1.2.3.4 8000");
set resp.http.bar4 = std.port("::1");
set resp.http.bar5 = std.port("[::1]");
set resp.http.bar6 = std.port("[::1]:8000");
}
} -start
client c1 {
txreq
rxresp
expect resp.http.foo1 == "1.2.3.4"
expect resp.http.foo2 == "1.2.3.4"
expect resp.http.foo3 == "1.2.3.4"
expect resp.http.foo4 == "::1"
expect resp.http.foo5 == "::1"
expect resp.http.foo6 == "::1"
expect resp.http.bar1 == "80"
expect resp.http.bar2 == "8000"
expect resp.http.bar3 == "8000"
expect resp.http.bar4 == "80"
expect resp.http.bar5 == "80"
expect resp.http.bar6 == "8000"
} -run
varnish v1 -errvcl "could not be resolved to an IP address" {
import ${vmod_std};
sub vcl_deliver {
set resp.http.foo = std.ip("..", "::1::2");
}
}
varnish v1 -errvcl "could not be resolved to an IP address" {
import ${vmod_std};
sub vcl_deliver {
set resp.http.foo = std.ip("..", "1.2.3.4::80");
}
}
lib/libvarnish/vss.c
View file @
a8067c73
...
@@ -56,6 +56,7 @@
...
@@ -56,6 +56,7 @@
* "0.0.0.0" - "0.0.0.0:80"
* "0.0.0.0" - "0.0.0.0:80"
* "[::1]" - "[::1]:80"
* "[::1]" - "[::1]:80"
* "[::]" - "[::]:80"
* "[::]" - "[::]:80"
* "::1"
*
*
* See also RFC5952
* See also RFC5952
*/
*/
...
@@ -86,6 +87,8 @@ vss_parse(char *str, char **addr, char **port)
...
@@ -86,6 +87,8 @@ vss_parse(char *str, char **addr, char **port)
p
=
strchr
(
str
,
':'
);
p
=
strchr
(
str
,
':'
);
if
(
p
==
NULL
)
if
(
p
==
NULL
)
return
(
NULL
);
return
(
NULL
);
if
(
p
[
0
]
==
':'
&&
strchr
(
&
p
[
1
],
':'
))
return
(
NULL
);
if
(
p
==
str
)
if
(
p
==
str
)
*
addr
=
NULL
;
*
addr
=
NULL
;
}
}
...
...
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