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
96ba7a4a
Commit
96ba7a4a
authored
Mar 29, 2018
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add function to produce HAproxy backend confs
parent
3c4281b1
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
3 deletions
+37
-3
vtc.h
bin/varnishtest/vtc.h
+2
-1
vtc_server.c
bin/varnishtest/vtc_server.c
+34
-1
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+1
-1
No files found.
bin/varnishtest/vtc.h
View file @
96ba7a4a
...
...
@@ -91,7 +91,8 @@ int http_process(struct vtclog *vl, const char *spec, int sock, int *sfd,
char
*
synth_body
(
const
char
*
len
,
int
rnd
);
void
cmd_server_genvcl
(
struct
vsb
*
vsb
);
void
cmd_server_gen_vcl
(
struct
vsb
*
vsb
);
void
cmd_server_gen_haproxy_conf
(
struct
vsb
*
vsb
);
void
vtc_loginit
(
char
*
buf
,
unsigned
buflen
);
struct
vtclog
*
vtc_logopen
(
const
char
*
id
);
...
...
bin/varnishtest/vtc_server.c
View file @
96ba7a4a
...
...
@@ -386,7 +386,7 @@ server_wait(struct server *s)
*/
void
cmd_server_genvcl
(
struct
vsb
*
vsb
)
cmd_server_gen
_
vcl
(
struct
vsb
*
vsb
)
{
struct
server
*
s
;
...
...
@@ -406,6 +406,39 @@ cmd_server_genvcl(struct vsb *vsb)
}
/**********************************************************************
* Generate VCL backend decls for our servers
*/
void
cmd_server_gen_haproxy_conf
(
struct
vsb
*
vsb
)
{
struct
server
*
s
;
AZ
(
pthread_mutex_lock
(
&
server_mtx
));
VTAILQ_FOREACH
(
s
,
&
servers
,
list
)
{
if
(
*
s
->
listen
!=
'/'
)
VSB_printf
(
vsb
,
"
\n
backend be%s
\n
"
"
\t
server srv%s %s:%s
\n
"
,
s
->
name
+
1
,
s
->
name
+
1
,
s
->
aaddr
,
s
->
aport
);
else
INCOMPL
();
}
VTAILQ_FOREACH
(
s
,
&
servers
,
list
)
{
if
(
*
s
->
listen
!=
'/'
)
VSB_printf
(
vsb
,
"
\n
frontend http%s
\n
"
"
\t
use_backend be%s
\n
"
"
\t
bind
\"
fd@${fe%s}
\"\n
"
,
s
->
name
+
1
,
s
->
name
+
1
,
s
->
name
+
1
);
else
INCOMPL
();
}
AZ
(
pthread_mutex_unlock
(
&
server_mtx
));
}
/**********************************************************************
* Server command dispatch
*/
...
...
bin/varnishtest/vtc_varnish.c
View file @
96ba7a4a
...
...
@@ -754,7 +754,7 @@ varnish_vclbackend(struct varnish *v, const char *vcl)
VSB_printf
(
vsb2
,
"vcl %.1f;
\n
"
,
v
->
syntax
);
cmd_server_genvcl
(
vsb2
);
cmd_server_gen
_
vcl
(
vsb2
);
AZ
(
VSB_finish
(
vsb2
));
...
...
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