Commit 1e0e7b4c authored by Federico G. Schwindt's avatar Federico G. Schwindt

Remove backward compatibility

This kills `remove', `.request' and `.response'.  Use `unset', `.method'
and `.reason' instead.
ok phk.
parent 8f26bf57
......@@ -9,7 +9,7 @@ varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.http.Foo = "bar";
set beresp.status = 523;
set beresp.response = "not ok";
set beresp.reason = "not ok";
set beresp.uncacheable = true;
set beresp.ttl = 0s;
return (deliver);
......
......@@ -28,13 +28,13 @@ varnish v1 -vcl+backend {
sub vcl_error {
if (req.restarts == 2) {
set obj.status = 200;
set obj.response = "restart=2";
set obj.reason = "restart=2";
} elsif (req.restarts > 2) {
set obj.status = 501;
set obj.response = "restart>2";
set obj.reason = "restart>2";
} elsif (req.restarts < 2) {
set obj.status = 500;
set obj.response = "restart<2";
set obj.reason = "restart<2";
}
}
} -start
......
varnishtest "{be}req.request compat check"
server s1 {
rxreq
expect req.method == "GETABCD"
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
set req.method = req.request + "A";
set req.request = req.method + "B";
return (pass);
}
sub vcl_backend_fetch {
set bereq.method = bereq.request + "C";
set bereq.request = bereq.method + "D";
}
} -start
client c1 {
txreq
rxresp
} -run
......@@ -9,7 +9,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.request == "PURGE") {
if (req.method == "PURGE") {
return (purge);
}
}
......
......@@ -18,8 +18,8 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
remove req.http.hdr1;
remove req.http.hdr5;
unset req.http.hdr1;
unset req.http.hdr5;
}
} -start
......
......@@ -11,7 +11,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.http.bar = beresp.http.foo;
remove beresp.http.foo;
unset beresp.http.foo;
}
} -start
......
......@@ -8,7 +8,7 @@ server s1 {
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.http.X-Banned == "check") {
remove req.http.X-Banned;
unset req.http.X-Banned;
} elseif (req.restarts == 0) {
set req.http.X-Banned = "check";
if (req.http.x-pass) {
......
varnishtest "VCL/VRT: url/request/proto/response/status"
varnishtest "VCL/VRT: url/request/proto/reason/status"
server s1 {
......@@ -28,14 +28,14 @@ varnish v1 -vcl+backend {
}
sub vcl_backend_response {
set beresp.http.foobar =
beresp.proto + beresp.response + beresp.status;
beresp.proto + beresp.reason + beresp.status;
set beresp.proto = "HTTP/1.2";
set beresp.response = "For circular files";
set beresp.reason = "For circular files";
set beresp.status = 903;
}
sub vcl_deliver {
set resp.proto = "HTTP/1.2";
set resp.response = "Naah, lets fail it";
set resp.reason = "Naah, lets fail it";
set resp.status = 904;
# XXX should be moved to it's own test
set resp.http.x-served-by-hostname = server.hostname;
......
......@@ -662,9 +662,6 @@ server.identity
req.method
The request type (e.g. "GET", "HEAD").
req.request
For backward compatibility. Same as req.method.
req.url
The requested URL.
......@@ -714,9 +711,6 @@ request (either for a cache miss or for pass or pipe mode):
bereq.method
The request type (e.g. "GET", "HEAD").
bereq.request
For backward compatibility. Same as bereq.method.
bereq.url
The requested URL.
......@@ -759,9 +753,6 @@ beresp.status
beresp.reason
The HTTP status message returned by the server.
beresp.response
For backward compatibility. Same as beresp.reason.
beresp.http.header
The corresponding HTTP header.
......@@ -821,9 +812,6 @@ obj.status
obj.reason
The HTTP status message returned by the server.
obj.response
For backward compatibility. Same as obj.reason.
obj.http.header
The corresponding HTTP header.
......@@ -859,9 +847,6 @@ resp.status
resp.reason
The HTTP status message that will be returned.
resp.response
For backward compatibility. Same as resp.reason.
resp.http.header
The corresponding HTTP header.
......
......@@ -578,11 +578,6 @@ The client's IP address.
# Backwards compatibility:
aliases = [
('req.request', 'req.method'),
('bereq.request', 'bereq.method'),
('beresp.response', 'beresp.reason'),
('resp.response', 'resp.reason'),
('obj.response', 'obj.reason'),
]
stv_variables = (
......
......@@ -411,7 +411,6 @@ static struct action_table {
{ "hash_data", parse_hash_data, VCL_MET_HASH },
{ "new", parse_new, VCL_MET_INIT},
{ "purge", parse_purge, VCL_MET_MISS | VCL_MET_HIT },
{ "remove", parse_unset }, /* backward compatibility */
{ "return", parse_return },
{ "rollback", parse_rollback },
{ "set", parse_set },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment