inline C-Code
Sascha Ottolski
ottolski at web.de
Tue Oct 21 15:03:22 CEST 2008
Hi,
in one or the other presentation slide is a small example about inline
C-Code; and there is a commit that only says "undocmented and
unsupported" (http://varnish.projects.linpro.no/changeset/1301).
Now I'm wondering, is there anyway at list ab bit of documentation
somewhere, or could someone post some examples to the list? (may be a
searchable archive of this list would reveal some?)
Basically, I want to do a bit of calculation with the help of a
(pseudo-)encrypted URL and the current time (which seems to be
available as the "new" keyword), to decide if the request should be
served, and if so, create the real URL that is to be send to the
backend, and a hashkey.
So probably I need something like the following seudo-code (my C
knowledge is kinda limited :-():
sub vcl_recv {
if (req.url ~ "/enc-prefix/") {
C{
timestamp, real_url = decrypt(req.url);
// valid for two hours
if not (now + 2h < timestamp < now) {
error XXX "page expired";
}
req.url = real_url;
}C
lookup;
}
}
So I guess the main questions are:
- how to access existing vcl names/variables
- how to set existing vcl names/variables
- what if I need access to external C libraries, i.e. to use a
custom "decrypt" function?
Any pointers greatly appreciated,
Sascha
More information about the varnish-misc
mailing list