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
b57c329a
Commit
b57c329a
authored
Dec 10, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add the blob wrapper to vrt
it is genereally useful also for vmods
parent
ddd9d4da
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
cache_vrt.c
bin/varnishd/cache/cache_vrt.c
+18
-0
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+2
-22
vrt.h
include/vrt.h
+2
-0
No files found.
bin/varnishd/cache/cache_vrt.c
View file @
b57c329a
...
...
@@ -590,3 +590,21 @@ VRT_ipcmp(const struct suckaddr *sua1, const struct suckaddr *sua2)
return
(
1
);
return
(
VSA_Compare_IP
(
sua1
,
sua2
));
}
struct
vmod_priv
*
VRT_blob
(
VRT_CTX
,
const
char
*
err
,
const
uint8_t
*
src
,
size_t
len
)
{
struct
vmod_priv
*
p
;
void
*
d
;
p
=
(
void
*
)
WS_Alloc
(
ctx
->
ws
,
sizeof
*
p
);
d
=
WS_Copy
(
ctx
->
ws
,
src
,
len
);
if
(
p
==
NULL
||
d
==
NULL
)
{
VRT_fail
(
ctx
,
"Workspace overflow (%s)"
,
err
);
return
(
NULL
);
}
memset
(
p
,
0
,
sizeof
*
p
);
p
->
len
=
len
;
p
->
priv
=
d
;
return
(
p
);
}
bin/varnishd/cache/cache_vrt_var.c
View file @
b57c329a
...
...
@@ -730,31 +730,12 @@ VRT_BODY_L(resp)
/*--------------------------------------------------------------------*/
static
struct
vmod_priv
*
vrt_do_blob
(
VRT_CTX
,
const
char
*
err
,
const
uint8_t
*
src
,
size_t
len
)
{
struct
vmod_priv
*
p
;
void
*
d
;
p
=
(
void
*
)
WS_Alloc
(
ctx
->
ws
,
sizeof
*
p
);
d
=
WS_Copy
(
ctx
->
ws
,
src
,
len
);
if
(
p
==
NULL
||
d
==
NULL
)
{
VRT_fail
(
ctx
,
"Workspace overflow (%s)"
,
err
);
return
(
NULL
);
}
memset
(
p
,
0
,
sizeof
*
p
);
p
->
len
=
len
;
p
->
priv
=
d
;
return
(
p
);
}
VCL_BLOB
VRT_r_req_hash
(
VRT_CTX
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
,
REQ_MAGIC
);
return
(
vrt_do_blob
(
ctx
,
"req.hash"
,
ctx
->
req
->
digest
,
DIGEST_LEN
));
return
(
VRT_blob
(
ctx
,
"req.hash"
,
ctx
->
req
->
digest
,
DIGEST_LEN
));
}
VCL_BLOB
...
...
@@ -762,8 +743,7 @@ VRT_r_bereq_hash(VRT_CTX)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
bo
,
BUSYOBJ_MAGIC
);
return
(
vrt_do_blob
(
ctx
,
"bereq.hash"
,
ctx
->
bo
->
digest
,
DIGEST_LEN
));
return
(
VRT_blob
(
ctx
,
"bereq.hash"
,
ctx
->
bo
->
digest
,
DIGEST_LEN
));
}
/*--------------------------------------------------------------------*/
...
...
include/vrt.h
View file @
b57c329a
...
...
@@ -60,6 +60,7 @@
* struct director.destroy added
* VRT_r_beresp_storage_hint() removed - under discussion #2509
* VRT_l_beresp_storage_hint() removed - under discussion #2509
* VRT_blob() added
* 6.1 (2017-09-15 aka 5.2)
* http_CollectHdrSep added
* VRT_purge modified (may fail a transaction, signature changed)
...
...
@@ -368,6 +369,7 @@ void VRT_hashdata(VRT_CTX, const char *str, ...);
int
VRT_strcmp
(
const
char
*
s1
,
const
char
*
s2
);
void
VRT_memmove
(
void
*
dst
,
const
void
*
src
,
unsigned
len
);
int
VRT_ipcmp
(
const
struct
suckaddr
*
sua1
,
const
struct
suckaddr
*
sua2
);
struct
vmod_priv
*
VRT_blob
(
VRT_CTX
,
const
char
*
,
const
uint8_t
*
,
size_t
);
void
VRT_Rollback
(
VRT_CTX
,
const
struct
http
*
);
...
...
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