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
e82877ea
Commit
e82877ea
authored
Apr 24, 2012
by
Ingvar Hagelund
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
ssh://git.varnish-cache.org/git/varnish-cache
parents
3dbab85b
ad9356a9
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
67 additions
and
52 deletions
+67
-52
cache_pool.c
bin/varnishd/cache/cache_pool.c
+4
-0
mgt_vcc.c
bin/varnishd/mgt/mgt_vcc.c
+6
-8
vtc.c
bin/varnishtest/vtc.c
+31
-12
vtc.h
bin/varnishtest/vtc.h
+1
-0
vtc_server.c
bin/varnishtest/vtc_server.c
+3
-3
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+3
-3
esi.rst
doc/sphinx/tutorial/esi.rst
+19
-26
No files found.
bin/varnishd/cache/cache_pool.c
View file @
e82877ea
...
...
@@ -194,6 +194,7 @@ pool_accept(struct worker *wrk, void *arg)
return
;
}
VTAILQ_REMOVE
(
&
pp
->
idle_queue
,
&
wrk2
->
task
,
list
);
AZ
(
wrk2
->
task
.
func
);
Lck_Unlock
(
&
pp
->
mtx
);
assert
(
sizeof
*
wa2
==
WS_Reserve
(
wrk2
->
aws
,
sizeof
*
wa2
));
wa2
=
(
void
*
)
wrk2
->
aws
->
f
;
...
...
@@ -227,6 +228,7 @@ Pool_Task(struct pool *pp, struct pool_task *task, enum pool_how how)
wrk
=
pool_getidleworker
(
pp
,
0
);
if
(
wrk
!=
NULL
)
{
VTAILQ_REMOVE
(
&
pp
->
idle_queue
,
&
wrk
->
task
,
list
);
AZ
(
wrk
->
task
.
func
);
Lck_Unlock
(
&
pp
->
mtx
);
wrk
->
task
.
func
=
task
->
func
;
wrk
->
task
.
priv
=
task
->
priv
;
...
...
@@ -298,6 +300,7 @@ Pool_Work_Thread(void *priv, struct worker *wrk)
wrk
->
lastused
=
VTIM_real
();
wrk
->
task
.
func
=
NULL
;
wrk
->
task
.
priv
=
wrk
;
AZ
(
wrk
->
task
.
func
);
VTAILQ_INSERT_HEAD
(
&
pp
->
idle_queue
,
&
wrk
->
task
,
list
);
if
(
!
stats_clean
)
WRK_SumStat
(
wrk
);
...
...
@@ -427,6 +430,7 @@ pool_herder(void *priv)
if
(
wrk
!=
NULL
&&
(
wrk
->
lastused
<
t_idle
||
pp
->
nthr
>
cache_param
->
wthread_max
))
{
VTAILQ_REMOVE
(
&
pp
->
idle_queue
,
&
wrk
->
task
,
list
);
AZ
(
wrk
->
task
.
func
);
}
else
wrk
=
NULL
;
Lck_Unlock
(
&
pp
->
mtx
);
...
...
bin/varnishd/mgt/mgt_vcc.c
View file @
e82877ea
...
...
@@ -394,18 +394,16 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, char *vcl, int C_flag)
if
(
VSB_len
(
sb
)
>
0
)
fprintf
(
stderr
,
"%s"
,
VSB_data
(
sb
));
VSB_delete
(
sb
);
if
(
C_flag
)
{
if
(
vf
!=
NULL
)
AZ
(
unlink
(
vf
));
return
(
0
);
}
if
(
C_flag
&&
vf
!=
NULL
)
AZ
(
unlink
(
vf
));
if
(
vf
==
NULL
)
{
fprintf
(
stderr
,
"
\n
VCL compilation failed
\n
"
);
return
(
1
);
}
else
{
vp
=
mgt_vcc_add
(
buf
,
vf
);
vp
->
active
=
1
;
return
(
0
);
}
vp
=
mgt_vcc_add
(
buf
,
vf
);
vp
->
active
=
1
;
return
(
0
);
}
/*--------------------------------------------------------------------*/
...
...
bin/varnishtest/vtc.c
View file @
e82877ea
...
...
@@ -87,6 +87,8 @@ macro_def(struct vtclog *vl, const char *instance, const char *name,
struct
macro
*
m
;
va_list
ap
;
AN
(
fmt
);
if
(
instance
!=
NULL
)
{
bprintf
(
buf1
,
"%s_%s"
,
instance
,
name
);
name
=
buf1
;
...
...
@@ -96,23 +98,40 @@ macro_def(struct vtclog *vl, const char *instance, const char *name,
VTAILQ_FOREACH
(
m
,
&
macro_list
,
list
)
if
(
!
strcmp
(
name
,
m
->
name
))
break
;
if
(
m
==
NULL
&&
fmt
!=
NULL
)
{
if
(
m
==
NULL
)
{
m
=
calloc
(
sizeof
*
m
,
1
);
AN
(
m
);
REPLACE
(
m
->
name
,
name
);
VTAILQ_INSERT_TAIL
(
&
macro_list
,
m
,
list
);
}
if
(
fmt
!=
NULL
)
{
AN
(
m
);
va_start
(
ap
,
fmt
);
free
(
m
->
val
);
m
->
val
=
NULL
;
vbprintf
(
buf2
,
fmt
,
ap
);
va_end
(
ap
);
m
->
val
=
strdup
(
buf2
);
AN
(
m
->
val
);
vtc_log
(
vl
,
4
,
"macro def %s=%s"
,
name
,
m
->
val
);
}
else
if
(
m
!=
NULL
)
{
AN
(
m
);
va_start
(
ap
,
fmt
);
free
(
m
->
val
);
m
->
val
=
NULL
;
vbprintf
(
buf2
,
fmt
,
ap
);
va_end
(
ap
);
m
->
val
=
strdup
(
buf2
);
AN
(
m
->
val
);
vtc_log
(
vl
,
4
,
"macro def %s=%s"
,
name
,
m
->
val
);
AZ
(
pthread_mutex_unlock
(
&
macro_mtx
));
}
void
macro_undef
(
struct
vtclog
*
vl
,
const
char
*
instance
,
const
char
*
name
)
{
char
buf1
[
256
];
struct
macro
*
m
;
if
(
instance
!=
NULL
)
{
bprintf
(
buf1
,
"%s_%s"
,
instance
,
name
);
name
=
buf1
;
}
AZ
(
pthread_mutex_lock
(
&
macro_mtx
));
VTAILQ_FOREACH
(
m
,
&
macro_list
,
list
)
if
(
!
strcmp
(
name
,
m
->
name
))
break
;
if
(
m
!=
NULL
)
{
vtc_log
(
vl
,
4
,
"macro undef %s"
,
name
);
VTAILQ_REMOVE
(
&
macro_list
,
m
,
list
);
free
(
m
->
name
);
...
...
bin/varnishtest/vtc.h
View file @
e82877ea
...
...
@@ -87,6 +87,7 @@ void vtc_hexdump(struct vtclog *vl, int lvl, const char *pfx,
int
exec_file
(
const
char
*
fn
,
const
char
*
script
,
const
char
*
tmpdir
,
char
*
logbuf
,
unsigned
loglen
);
void
macro_undef
(
struct
vtclog
*
vl
,
const
char
*
instance
,
const
char
*
name
);
void
macro_def
(
struct
vtclog
*
vl
,
const
char
*
instance
,
const
char
*
name
,
const
char
*
fmt
,
...)
__printflike
(
4
,
5
);
...
...
bin/varnishtest/vtc_server.c
View file @
e82877ea
...
...
@@ -143,9 +143,9 @@ server_delete(struct server *s)
{
CHECK_OBJ_NOTNULL
(
s
,
SERVER_MAGIC
);
macro_
def
(
s
->
vl
,
s
->
name
,
"addr"
,
NULL
);
macro_
def
(
s
->
vl
,
s
->
name
,
"port"
,
NULL
);
macro_
def
(
s
->
vl
,
s
->
name
,
"sock"
,
NULL
);
macro_
undef
(
s
->
vl
,
s
->
name
,
"addr"
);
macro_
undef
(
s
->
vl
,
s
->
name
,
"port"
);
macro_
undef
(
s
->
vl
,
s
->
name
,
"sock"
);
vtc_logclose
(
s
->
vl
);
free
(
s
->
name
);
/* XXX: MEMLEAK (?) (VSS ??) */
...
...
bin/varnishtest/vtc_varnish.c
View file @
e82877ea
...
...
@@ -522,9 +522,9 @@ varnish_stop(struct varnish *v)
varnish_launch
(
v
);
if
(
vtc_error
)
return
;
macro_
def
(
v
->
vl
,
v
->
name
,
"addr"
,
NULL
);
macro_
def
(
v
->
vl
,
v
->
name
,
"port"
,
NULL
);
macro_
def
(
v
->
vl
,
v
->
name
,
"sock"
,
NULL
);
macro_
undef
(
v
->
vl
,
v
->
name
,
"addr"
);
macro_
undef
(
v
->
vl
,
v
->
name
,
"port"
);
macro_
undef
(
v
->
vl
,
v
->
name
,
"sock"
);
vtc_log
(
v
->
vl
,
2
,
"Stop"
);
(
void
)
varnish_ask_cli
(
v
,
"stop"
,
NULL
);
while
(
1
)
{
...
...
doc/sphinx/tutorial/esi.rst
View file @
e82877ea
...
...
@@ -22,7 +22,9 @@ have three ESI statements:
Content substitution based on variables and cookies is not implemented
but is on the roadmap.
Example: esi include
Varnish will not process ESI instructions in HTML comments.
Example: esi:include
~~~~~~~~~~~~~~~~~~~~
Lets see an example how this could be used. This simple cgi script
...
...
@@ -55,32 +57,23 @@ For ESI to work you need to activate ESI processing in VCL, like this::
}
}
Example: esi remove
~~~~~~~~~~~~~~~~~~~
The *remove* keyword allows you to remove output. You can use this to make
a fall back of sorts, when ESI is not available, like this::
Example: esi:remove and <!--esi ... -->
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The <esi:remove> and <!--esi ... --> constructs can be used to present
appropriate content whether or not ESI is available, for example you can
include content when ESI is available or link to it when it is not.
ESI processors will remove the start ("<!--esi") and end ("-->") when
the page is processed, while still processing the contents. If the page
is not processed, it will remain, becoming an HTML/XML comment tag.
ESI processors will remove <esi:remove> tags and all content contained
in them, allowing you to only render the content when the page is not
being ESI-processed.
For example::
<esi:include src="http://www.example.com/ad.html"/>
<esi:remove>
<a href="http://www.example.com
">www.example.com
</a>
<a href="http://www.example.com
/LICENSE">The license
</a>
</esi:remove>
Example: <!--esi ... -->
~~~~~~~~~~~~~~~~~~~~~~~~
This is a special construct to allow HTML marked up with ESI to render
without processing. ESI Processors will remove the start ("<!--esi")
and end ("-->") when the page is processed, while still processing the
contents. If the page is not processed, it will remain, becoming an
HTML/XML comment tag. For example::
<!--esi
<p>Warning: ESI Disabled!</p>
</p> -->
This assures that the ESI markup will not interfere with the rendering
of the final HTML if not processed.
<p>The full text of the license:</p>
<esi:include src="http://example.com/LICENSE" />
-->
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