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 { ...@@ -9,7 +9,7 @@ varnish v1 -vcl+backend {
sub vcl_backend_response { sub vcl_backend_response {
set beresp.http.Foo = "bar"; set beresp.http.Foo = "bar";
set beresp.status = 523; set beresp.status = 523;
set beresp.response = "not ok"; set beresp.reason = "not ok";
set beresp.uncacheable = true; set beresp.uncacheable = true;
set beresp.ttl = 0s; set beresp.ttl = 0s;
return (deliver); return (deliver);
......
...@@ -28,13 +28,13 @@ varnish v1 -vcl+backend { ...@@ -28,13 +28,13 @@ varnish v1 -vcl+backend {
sub vcl_error { sub vcl_error {
if (req.restarts == 2) { if (req.restarts == 2) {
set obj.status = 200; set obj.status = 200;
set obj.response = "restart=2"; set obj.reason = "restart=2";
} elsif (req.restarts > 2) { } elsif (req.restarts > 2) {
set obj.status = 501; set obj.status = 501;
set obj.response = "restart>2"; set obj.reason = "restart>2";
} elsif (req.restarts < 2) { } elsif (req.restarts < 2) {
set obj.status = 500; set obj.status = 500;
set obj.response = "restart<2"; set obj.reason = "restart<2";
} }
} }
} -start } -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 { ...@@ -9,7 +9,7 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
sub vcl_recv { sub vcl_recv {
if (req.request == "PURGE") { if (req.method == "PURGE") {
return (purge); return (purge);
} }
} }
......
...@@ -18,8 +18,8 @@ server s1 { ...@@ -18,8 +18,8 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
sub vcl_recv { sub vcl_recv {
remove req.http.hdr1; unset req.http.hdr1;
remove req.http.hdr5; unset req.http.hdr5;
} }
} -start } -start
......
...@@ -11,7 +11,7 @@ server s1 { ...@@ -11,7 +11,7 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
sub vcl_backend_response { sub vcl_backend_response {
set beresp.http.bar = beresp.http.foo; set beresp.http.bar = beresp.http.foo;
remove beresp.http.foo; unset beresp.http.foo;
} }
} -start } -start
......
...@@ -8,7 +8,7 @@ server s1 { ...@@ -8,7 +8,7 @@ server s1 {
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
sub vcl_recv { sub vcl_recv {
if (req.http.X-Banned == "check") { if (req.http.X-Banned == "check") {
remove req.http.X-Banned; unset req.http.X-Banned;
} elseif (req.restarts == 0) { } elseif (req.restarts == 0) {
set req.http.X-Banned = "check"; set req.http.X-Banned = "check";
if (req.http.x-pass) { if (req.http.x-pass) {
......
varnishtest "VCL/VRT: url/request/proto/response/status" varnishtest "VCL/VRT: url/request/proto/reason/status"
server s1 { server s1 {
...@@ -28,14 +28,14 @@ varnish v1 -vcl+backend { ...@@ -28,14 +28,14 @@ varnish v1 -vcl+backend {
} }
sub vcl_backend_response { sub vcl_backend_response {
set beresp.http.foobar = set beresp.http.foobar =
beresp.proto + beresp.response + beresp.status; beresp.proto + beresp.reason + beresp.status;
set beresp.proto = "HTTP/1.2"; set beresp.proto = "HTTP/1.2";
set beresp.response = "For circular files"; set beresp.reason = "For circular files";
set beresp.status = 903; set beresp.status = 903;
} }
sub vcl_deliver { sub vcl_deliver {
set resp.proto = "HTTP/1.2"; set resp.proto = "HTTP/1.2";
set resp.response = "Naah, lets fail it"; set resp.reason = "Naah, lets fail it";
set resp.status = 904; set resp.status = 904;
# XXX should be moved to it's own test # XXX should be moved to it's own test
set resp.http.x-served-by-hostname = server.hostname; set resp.http.x-served-by-hostname = server.hostname;
......
...@@ -662,9 +662,6 @@ server.identity ...@@ -662,9 +662,6 @@ server.identity
req.method req.method
The request type (e.g. "GET", "HEAD"). The request type (e.g. "GET", "HEAD").
req.request
For backward compatibility. Same as req.method.
req.url req.url
The requested URL. The requested URL.
...@@ -714,9 +711,6 @@ request (either for a cache miss or for pass or pipe mode): ...@@ -714,9 +711,6 @@ request (either for a cache miss or for pass or pipe mode):
bereq.method bereq.method
The request type (e.g. "GET", "HEAD"). The request type (e.g. "GET", "HEAD").
bereq.request
For backward compatibility. Same as bereq.method.
bereq.url bereq.url
The requested URL. The requested URL.
...@@ -759,9 +753,6 @@ beresp.status ...@@ -759,9 +753,6 @@ beresp.status
beresp.reason beresp.reason
The HTTP status message returned by the server. The HTTP status message returned by the server.
beresp.response
For backward compatibility. Same as beresp.reason.
beresp.http.header beresp.http.header
The corresponding HTTP header. The corresponding HTTP header.
...@@ -821,9 +812,6 @@ obj.status ...@@ -821,9 +812,6 @@ obj.status
obj.reason obj.reason
The HTTP status message returned by the server. The HTTP status message returned by the server.
obj.response
For backward compatibility. Same as obj.reason.
obj.http.header obj.http.header
The corresponding HTTP header. The corresponding HTTP header.
...@@ -859,9 +847,6 @@ resp.status ...@@ -859,9 +847,6 @@ resp.status
resp.reason resp.reason
The HTTP status message that will be returned. The HTTP status message that will be returned.
resp.response
For backward compatibility. Same as resp.reason.
resp.http.header resp.http.header
The corresponding HTTP header. The corresponding HTTP header.
......
...@@ -578,11 +578,6 @@ The client's IP address. ...@@ -578,11 +578,6 @@ The client's IP address.
# Backwards compatibility: # Backwards compatibility:
aliases = [ aliases = [
('req.request', 'req.method'),
('bereq.request', 'bereq.method'),
('beresp.response', 'beresp.reason'),
('resp.response', 'resp.reason'),
('obj.response', 'obj.reason'),
] ]
stv_variables = ( stv_variables = (
......
...@@ -411,7 +411,6 @@ static struct action_table { ...@@ -411,7 +411,6 @@ static struct action_table {
{ "hash_data", parse_hash_data, VCL_MET_HASH }, { "hash_data", parse_hash_data, VCL_MET_HASH },
{ "new", parse_new, VCL_MET_INIT}, { "new", parse_new, VCL_MET_INIT},
{ "purge", parse_purge, VCL_MET_MISS | VCL_MET_HIT }, { "purge", parse_purge, VCL_MET_MISS | VCL_MET_HIT },
{ "remove", parse_unset }, /* backward compatibility */
{ "return", parse_return }, { "return", parse_return },
{ "rollback", parse_rollback }, { "rollback", parse_rollback },
{ "set", parse_set }, { "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