Commit 7d5e588f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make varnishd -L mode work with or without -b arguments



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@4779 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 58324619
......@@ -335,7 +335,16 @@ mgt_vcc_default(const char *b_arg, const char *f_arg, char *vcl, int C_flag)
/* XXX: annotate vcl with -b/-f arg so people know where it came from */
(void)f_arg;
if (b_arg != NULL) {
if (L_arg && b_arg == NULL) {
bprintf(buf,
"backend default {\n"
" .host = \"127.0.0.1\";\n"
" .port = %s;\n"
"}\n", "Learn(0)");
vcl = strdup(buf);
AN(vcl);
} else if (b_arg != NULL) {
AZ(vcl);
/*
* XXX: should do a "HEAD /" on the -b argument to see that
......
......@@ -675,7 +675,7 @@ main(int argc, char * const *argv)
exit(1);
}
if (b_arg != NULL || f_arg != NULL)
if (b_arg != NULL || f_arg != NULL || L_arg > 0)
if (mgt_vcc_default(b_arg, f_arg, vcl, C_flag))
exit (2);
......
......@@ -551,7 +551,6 @@ vcc_ParseHostDef(struct tokenlist *tl, int serial, const char *vgcname)
/* Check that the portname makes sense */
if (Learn_mode && t_port != NULL && t_port->tok == CNUM) {
assert(tL_port);
bprintf(tmpbuf, "%u", Learn_mode + 10 + tL_port);
Emit_Sockaddr(tl, t_host, tmpbuf);
} else if (t_port != NULL) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment