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
ee9e8034
Commit
ee9e8034
authored
Mar 14, 2011
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for passing a HTTP header-identity to a VMOD function.
parent
384d6732
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
2 deletions
+29
-2
vcc_expr.c
lib/libvcl/vcc_expr.c
+26
-0
vmod.py
lib/libvmod_std/vmod.py
+2
-2
vmod_std_conversions.c
lib/libvmod_std/vmod_std_conversions.c
+1
-0
No files found.
lib/libvcl/vcc_expr.c
View file @
ee9e8034
...
...
@@ -576,6 +576,32 @@ vcc_Eval_Func(struct vcc *tl, struct expr **e, const struct symbol *sym)
SkipToken
(
tl
,
ID
);
if
(
*
p
!=
'\0'
)
SkipToken
(
tl
,
','
);
}
else
if
(
fmt
==
HEADER
)
{
const
struct
var
*
v
;
sym
=
VCC_FindSymbol
(
tl
,
tl
->
t
,
SYM_NONE
);
vcc_AddUses
(
tl
,
tl
->
t
,
sym
->
r_methods
,
"Not available"
);
ERRCHK
(
tl
);
SkipToken
(
tl
,
ID
);
if
(
sym
==
NULL
)
{
vsb_printf
(
tl
->
sb
,
"Symbol not found.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
if
(
sym
->
kind
!=
SYM_VAR
)
{
vsb_printf
(
tl
->
sb
,
"Wrong kind of symbol.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
AN
(
sym
->
var
);
v
=
sym
->
var
;
if
(
v
->
http
==
NULL
)
{
vsb_printf
(
tl
->
sb
,
"Variable not an HTTP header.
\n
"
);
vcc_ErrWhere
(
tl
,
tl
->
t
);
return
;
}
e1
=
vcc_mk_expr
(
VOID
,
"%s,
\"
%s
\"
"
,
v
->
http
,
v
->
hdr
);
p
+=
strlen
(
p
)
+
1
;
}
else
{
vcc_expr0
(
tl
,
&
e1
,
fmt
);
ERRCHK
(
tl
);
...
...
lib/libvmod_std/vmod.py
View file @
ee9e8034
...
...
@@ -58,7 +58,7 @@ ctypes = {
'REAL'
:
"double"
,
'DURATION'
:
"double"
,
'INT'
:
"int"
,
'HEADER'
:
"const char *"
,
'HEADER'
:
"
enum gethdr_e,
const char *"
,
'PRIV_VCL'
:
"struct vmod_priv *"
,
'PRIV_CALL'
:
"struct vmod_priv *"
,
'VOID'
:
"void"
,
...
...
@@ -281,8 +281,8 @@ fh.write("\n");
fh
.
write
(
plist
)
fc
.
write
(
'#include "vcc_if.h"
\n
'
)
fc
.
write
(
'#include "vrt.h"
\n
'
)
fc
.
write
(
'#include "vcc_if.h"
\n
'
)
fc
.
write
(
"
\n
"
);
fc
.
write
(
"
\n
"
);
...
...
lib/libvmod_std/vmod_std_conversions.c
View file @
ee9e8034
...
...
@@ -33,6 +33,7 @@
#include "../../bin/varnishd/cache.h"
#include "vrt.h"
#include "vcc_if.h"
double
__match_proto__
()
...
...
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