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
15cc069b
Commit
15cc069b
authored
Mar 05, 2018
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bring back beresp.storage_hint for vcl 4.0
see doc/changes.rst for details Closes #2509
parent
9305a2d4
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
4 deletions
+98
-4
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+47
-0
c00078.vtc
bin/varnishtest/tests/c00078.vtc
+23
-1
changes.rst
doc/changes.rst
+11
-1
vcl_var.rst
doc/sphinx/reference/vcl_var.rst
+15
-0
vrt.h
include/vrt.h
+2
-2
No files found.
bin/varnishd/cache/cache_vrt_var.c
View file @
15cc069b
...
...
@@ -365,6 +365,53 @@ VRT_l_beresp_storage(VRT_CTX, VCL_STEVEDORE stv)
ctx
->
bo
->
storage
=
stv
;
}
/*--------------------------------------------------------------------
* VCL <= 4.0 ONLY
*/
#include "storage/storage.h"
const
char
*
VRT_r_beresp_storage_hint
(
VRT_CTX
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
if
(
ctx
->
bo
->
storage
==
NULL
)
return
(
NULL
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
->
storage
,
STEVEDORE_MAGIC
);
return
(
ctx
->
bo
->
storage
->
vclname
);
}
void
VRT_l_beresp_storage_hint
(
VRT_CTX
,
const
char
*
str
,
...)
{
const
char
*
p
;
va_list
ap
;
uintptr_t
sn
;
VCL_STEVEDORE
stv
;
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
sn
=
WS_Snapshot
(
ctx
->
ws
);
va_start
(
ap
,
str
);
p
=
VRT_String
(
ctx
->
ws
,
NULL
,
str
,
ap
);
va_end
(
ap
);
if
(
p
==
NULL
)
{
VSLb
(
ctx
->
vsl
,
SLT_LostHeader
,
"storage_hint"
);
WS_MarkOverflow
(
ctx
->
ws
);
WS_Reset
(
ctx
->
ws
,
sn
);
return
;
}
stv
=
VRT_stevedore
(
p
);
if
(
stv
!=
NULL
)
ctx
->
bo
->
storage
=
stv
;
WS_Reset
(
ctx
->
ws
,
sn
);
}
/*--------------------------------------------------------------------*/
VCL_STEVEDORE
...
...
bin/varnishtest/tests/c00078.vtc
View file @
15cc069b
varnishtest "Stevedores RR, beresp.storage"
server s1 -repeat
6
{
server s1 -repeat
7
{
rxreq
txresp
} -start
...
...
@@ -17,8 +17,11 @@ varnish v1 \
set beresp.storage = storage.s1;
} else if (bereq.url == "/6") {
set beresp.storage = vtc.no_stevedore();
} else if (bereq.url == "/deprecated") {
set beresp.storage_hint = "s1";
}
set beresp.http.storage = beresp.storage;
set beresp.http.storage-hint = beresp.storage_hint;
}
} -start
...
...
@@ -26,19 +29,38 @@ client c1 {
txreq -url /1
rxresp
expect resp.http.storage == "storage.s1"
expect resp.http.storage == resp.http.storage-hint
txreq -url /2
rxresp
expect resp.http.storage == "storage.s1"
expect resp.http.storage == resp.http.storage-hint
txreq -url /3
rxresp
expect resp.http.storage == "storage.s0"
expect resp.http.storage == resp.http.storage-hint
txreq -url /4
rxresp
expect resp.http.storage == "storage.s1"
expect resp.http.storage == resp.http.storage-hint
txreq -url /5
rxresp
expect resp.http.storage == "storage.s2"
expect resp.http.storage == resp.http.storage-hint
txreq -url /6
rxresp
expect resp.http.storage == <undef>
expect resp.http.storage == resp.http.storage-hint
txreq -url /deprecated
rxresp
expect resp.http.storage == "storage.s1"
expect resp.http.storage == resp.http.storage-hint
} -run
varnish v1 \
-syntax 4.1 \
-errvcl "Only available when VCL syntax <= 4.0" {
import vtc;
sub vcl_backend_response {
set beresp.storage_hint = "foo";
}
}
doc/changes.rst
View file @
15cc069b
...
...
@@ -41,7 +41,17 @@ VCL and bundled VMODs
``req.hash_always_miss`` are now accessible from all of the client
side subs, not just ``vcl_recv{}``
* Removed ``beresp.storage_hint`` (was deprecated since Varnish 5.1)
* Removed ``beresp.storage_hint`` for VCL 4.1 (was deprecated since
Varnish 5.1)
For VCL 4.0, compatibility is preserved, but the implementation is
changed slightly: ``beresp.storage_hint`` is now referring to the
same internal data structure as ``beresp.storage``.
In particular, it was previously possible to set
``beresp.storage_hint`` to an invalid storage name and later
retrieve it back. Doing so will now yield the last successfully set
stevedore or the undefined (``NULL``) string.
* workspace overflows in ``std.log()`` now trigger a VCL failure
...
...
doc/sphinx/reference/vcl_var.rst
View file @
15cc069b
...
...
@@ -868,6 +868,21 @@ beresp.storage
The storage backend to use to save this object.
beresp.storage_hint ``VCL <= 4.0``
Type: STRING
Readable from: vcl_backend_response, vcl_backend_error
Writable from: vcl_backend_response, vcl_backend_error
Deprecated since varnish 5.1 and discontinued since VCL
4.1 (varnish 6.0). Use beresp.storage instead.
Hint to Varnish that you want to save this object to a
particular storage backend.
obj
~~~
...
...
include/vrt.h
View file @
15cc069b
...
...
@@ -61,8 +61,8 @@
* VRT_VSC_Overhead() added
* struct director.event added
* struct director.destroy added
* VRT_r_beresp_storage_hint()
removed - under discussion
#2509
* VRT_l_beresp_storage_hint()
removed - under discussion
#2509
* VRT_r_beresp_storage_hint()
VCL <= 4.0
#2509
* VRT_l_beresp_storage_hint()
VCL <= 4.0
#2509
* VRT_blob() added
* VCL_STRANDS added
* 6.1 (2017-09-15 aka 5.2)
...
...
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