From phk at projects.linpro.no Wed Oct 1 08:28:00 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 1 Oct 2008 10:28:00 +0200 (CEST) Subject: r3242 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081001082800.B9B611EC0D3@projects.linpro.no> Author: phk Date: 2008-10-01 10:27:59 +0200 (Wed, 01 Oct 2008) New Revision: 3242 Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c Log: Add a pidfile for varnishd Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-09-30 06:24:13 UTC (rev 3241) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-01 08:27:59 UTC (rev 3242) @@ -193,6 +193,7 @@ vsb_printf(vsb, "cd ../varnishd &&"); vsb_printf(vsb, " ./varnishd -d -d -n /tmp/__%s", v->name); vsb_printf(vsb, " -a '%s' -T %s", v->accept, v->telnet); + vsb_printf(vsb, " -P /tmp/__%s/varnishd.pid", v->name); vsb_printf(vsb, " %s", v->args); vsb_finish(vsb); AZ(vsb_overflowed(vsb)); From phk at projects.linpro.no Sun Oct 5 10:22:21 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:22:21 +0200 (CEST) Subject: r3243 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081005102221.98ADC1ECC4B@projects.linpro.no> Author: phk Date: 2008-10-05 12:22:21 +0200 (Sun, 05 Oct 2008) New Revision: 3243 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c Log: Emit a message when we sleep, so people know why nothing happens. Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-01 08:27:59 UTC (rev 3242) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-05 10:22:21 UTC (rev 3243) @@ -253,6 +253,7 @@ AN(av[1]); AZ(av[2]); f = strtod(av[1], NULL); + vtc_log(vl, 3, "delaying %g second(s)", f); if (f > 100.) { (void)sleep((int)f); } else { From phk at projects.linpro.no Sun Oct 5 10:22:54 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:22:54 +0200 (CEST) Subject: r3244 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081005102254.2B9FE1EC9A2@projects.linpro.no> Author: phk Date: 2008-10-05 12:22:53 +0200 (Sun, 05 Oct 2008) New Revision: 3244 Modified: trunk/varnish-cache/bin/varnishtest/vtc.h Log: Unused prototype, stats are under varnish branch of command tree. Modified: trunk/varnish-cache/bin/varnishtest/vtc.h =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-05 10:22:21 UTC (rev 3243) +++ trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-05 10:22:53 UTC (rev 3244) @@ -44,7 +44,6 @@ cmd_f cmd_delay; cmd_f cmd_server; cmd_f cmd_client; -cmd_f cmd_stats; cmd_f cmd_varnish; cmd_f cmd_sema; From phk at projects.linpro.no Sun Oct 5 10:23:13 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:23:13 +0200 (CEST) Subject: r3245 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005102313.2D3531EC7CA@projects.linpro.no> Author: phk Date: 2008-10-05 12:23:12 +0200 (Sun, 05 Oct 2008) New Revision: 3245 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc Log: Use built in delay function Modified: trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc 2008-10-05 10:22:53 UTC (rev 3244) +++ trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc 2008-10-05 10:23:12 UTC (rev 3245) @@ -38,7 +38,7 @@ expect resp.status == 500 } -run -shell "sleep 1" +delay 1 client c2 { txreq From phk at projects.linpro.no Sun Oct 5 10:31:23 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:31:23 +0200 (CEST) Subject: r3246 - trunk/varnish-cache/lib/libvcl Message-ID: <20081005103123.A0F151EC204@projects.linpro.no> Author: phk Date: 2008-10-05 12:31:23 +0200 (Sun, 05 Oct 2008) New Revision: 3246 Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Make it possible to say: if (req.backend == b1) in VCL. Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-05 10:23:12 UTC (rev 3245) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-05 10:31:23 UTC (rev 3246) @@ -322,10 +322,29 @@ } static void -Cond_Backend(const struct var *vp, const struct tokenlist *tl) +Cond_Backend(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); + if (tl->t->tok == T_EQ) { + Fb(tl, 1, " ==\n"); + } else if (tl->t->tok == T_NEQ) { + Fb(tl, 1, " !=\n"); + } else { + vsb_printf(tl->sb, "Invalid condition "); + vcc_ErrToken(tl, tl->t); + vsb_printf(tl->sb, " on backend variable\n"); + vsb_printf(tl->sb, + " only '==' and '!=' are legal\n"); + vcc_ErrWhere(tl, tl->t); + return; + } + vcc_NextToken(tl); + vcc_ExpectCid(tl); + ERRCHK(tl); + vcc_AddRef(tl, tl->t, R_BACKEND); + Fb(tl, 1, "VGC_backend_%.*s\n", PF(tl->t)); + vcc_NextToken(tl); } static void From phk at projects.linpro.no Sun Oct 5 10:31:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:31:51 +0200 (CEST) Subject: r3247 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005103151.670E81EC9A2@projects.linpro.no> Author: phk Date: 2008-10-05 12:31:50 +0200 (Sun, 05 Oct 2008) New Revision: 3247 Added: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc Log: VCC coverage case Added: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-05 10:31:50 UTC (rev 3247) @@ -0,0 +1,39 @@ +# $Id$ + +test "Various VCL compiler coverage tests" + +varnish v1 -vcl { + + backend b { .host = "127.0.0.1"; } + + /* Test string regexp matching and "else if" */ + sub vcl_recv { + if ((req.url ~ "foobar")) { + pass; + } else if (req.url ~ "snafu") { + pipe; + } else { + pass; + } + } +} + + +varnish v1 -vcl { + + backend b { .host = "127.0.0.1"; } + + /* test time and backend comparison */ + sub vcl_fetch { + if (obj.ttl > 1d) { + set obj.ttl = 1d; + } + if (req.backend == b) { + set obj.ttl = 1d; + } else if (req.backend != b) { + set obj.ttl = 1h; + } + } + +} + From phk at projects.linpro.no Sun Oct 5 10:40:47 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 12:40:47 +0200 (CEST) Subject: r3248 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081005104047.326571EC204@projects.linpro.no> Author: phk Date: 2008-10-05 12:40:46 +0200 (Sun, 05 Oct 2008) New Revision: 3248 Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c Log: Clear buffers before we start. Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-05 10:31:50 UTC (rev 3247) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-05 10:40:46 UTC (rev 3248) @@ -80,6 +80,7 @@ assert(lvl < NLEAD); if (lvl > vtc_verbosity) return; + vsb_clear(vl->vsb); vsb_printf(vl->vsb, "%s %-4s ", lead[lvl], vl->id); va_list ap; va_start(ap, fmt); @@ -107,6 +108,7 @@ assert(lvl < NLEAD); if (lvl > vtc_verbosity) return; + vsb_clear(vl->vsb); if (pfx == NULL) pfx = ""; if (str == NULL) From phk at projects.linpro.no Sun Oct 5 20:09:40 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 22:09:40 +0200 (CEST) Subject: r3249 - trunk/varnish-cache/lib/libvcl Message-ID: <20081005200940.603311EC6CB@projects.linpro.no> Author: phk Date: 2008-10-05 22:09:40 +0200 (Sun, 05 Oct 2008) New Revision: 3249 Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Make an error message slightly less confusing. Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-05 10:40:46 UTC (rev 3248) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-05 20:09:40 UTC (rev 3249) @@ -306,7 +306,7 @@ default: vsb_printf(tl->sb, "Invalid condition "); vcc_ErrToken(tl, tl->t); - vsb_printf(tl->sb, " on integer variable\n"); + vsb_printf(tl->sb, " on numeric variable\n"); vsb_printf(tl->sb, " only '==', '!=', '<', '>', '<=' and '>=' are legal\n"); vcc_ErrWhere(tl, tl->t); From phk at projects.linpro.no Sun Oct 5 20:13:32 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 22:13:32 +0200 (CEST) Subject: r3250 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005201332.E336E1EC213@projects.linpro.no> Author: phk Date: 2008-10-05 22:13:32 +0200 (Sun, 05 Oct 2008) New Revision: 3250 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc Log: More coverage testing for vcc_parse.c Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-05 20:09:40 UTC (rev 3249) +++ trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-05 20:13:32 UTC (rev 3250) @@ -37,3 +37,27 @@ } +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.ttl = 1. k; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { if (obj.ttl *= 2) { } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { if (req.backend > b) { } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_hash { if (req.hash != "foo") { } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_hash { if (2 == 3) { } } +} From phk at projects.linpro.no Sun Oct 5 20:37:15 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 22:37:15 +0200 (CEST) Subject: r3251 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005203715.E9FFA1EC6CB@projects.linpro.no> Author: phk Date: 2008-10-05 22:37:15 +0200 (Sun, 05 Oct 2008) New Revision: 3251 Added: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc Log: Coverage test for vcc_acl Added: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 20:37:15 UTC (rev 3251) @@ -0,0 +1,67 @@ +# $Id$ + +test "VCL compiler coverage test: vcc_acl.c" + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { "10.1.2.3"/33; } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { "1::2"/129; } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + acl a { + "1.2.3.4"; + "1.2.3.4"; + } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { + "1.2.3.4"; + !"1.2.3.4"; + } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { "en.lille.nisse.rejste"; } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { "10.1.2."; } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { ( "10.1.2"; } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + acl a { "10.1.2" ); } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + acl a { + "10.1.3"; + ("en.lille.nisse.rejste"); + } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + From phk at projects.linpro.no Sun Oct 5 20:51:01 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 22:51:01 +0200 (CEST) Subject: r3252 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005205101.AB95E1EC9A2@projects.linpro.no> Author: phk Date: 2008-10-05 22:51:01 +0200 (Sun, 05 Oct 2008) New Revision: 3252 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc Log: More vcc_acl.c coverage testing Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 20:37:15 UTC (rev 3251) +++ trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 20:51:01 UTC (rev 3252) @@ -17,8 +17,8 @@ varnish v1 -vcl { backend b { .host = "127.0.0.1"; } acl a { - "1.2.3.4"; - "1.2.3.4"; + "1.2.3.4"/31; + "1.2.3.4"/31; } sub vcl_recv { if (client.ip ~ a) { pass; } } } @@ -59,9 +59,33 @@ varnish v1 -vcl { backend b { .host = "127.0.0.1"; } acl a { - "10.1.3"; + ! "10.1.3"; ("en.lille.nisse.rejste"); } sub vcl_recv { if (client.ip ~ a) { pass; } } } +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { if (client.ip == "127.0.0.1") { pass; } } + sub vcl_miss { if (client.ip != "127.0.0.1") { pass; } } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { if (client.ip > "127.0.0.1") { pass; } } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + acl a { + "10.1.1"/25; + "10.1.3"/26; + "10.1.3"/25; + "10.1.2"/25; + "10.1.2"/26; + "10.1.4"/25; + } + sub vcl_recv { if (client.ip ~ a) { pass; } } +} + From phk at projects.linpro.no Sun Oct 5 21:02:48 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 23:02:48 +0200 (CEST) Subject: r3253 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005210248.B4DB21EC6CB@projects.linpro.no> Author: phk Date: 2008-10-05 23:02:48 +0200 (Sun, 05 Oct 2008) New Revision: 3253 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc Log: Try to hit a couple of lines more in vcc_acl.c Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 20:51:01 UTC (rev 3252) +++ trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 21:02:48 UTC (rev 3253) @@ -61,6 +61,7 @@ acl a { ! "10.1.3"; ("en.lille.nisse.rejste"); + (!"en.lille.nisse.rejste"); } sub vcl_recv { if (client.ip ~ a) { pass; } } } @@ -85,6 +86,8 @@ "10.1.2"/25; "10.1.2"/26; "10.1.4"/25; + "10.2.66"/23; + ! "10.2.64"/23; } sub vcl_recv { if (client.ip ~ a) { pass; } } } From phk at projects.linpro.no Sun Oct 5 21:34:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 23:34:51 +0200 (CEST) Subject: r3254 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005213451.351AE1EC6CB@projects.linpro.no> Author: phk Date: 2008-10-05 23:34:51 +0200 (Sun, 05 Oct 2008) New Revision: 3254 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc Log: Try to get two more lines in vcc_acl.c Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 21:02:48 UTC (rev 3253) +++ trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-05 21:34:51 UTC (rev 3254) @@ -60,7 +60,7 @@ backend b { .host = "127.0.0.1"; } acl a { ! "10.1.3"; - ("en.lille.nisse.rejste"); + ("en.lille.nisse.rejste" / 22); (!"en.lille.nisse.rejste"); } sub vcl_recv { if (client.ip ~ a) { pass; } } @@ -88,6 +88,7 @@ "10.1.4"/25; "10.2.66"/23; ! "10.2.64"/23; + "10.2.68"/23; } sub vcl_recv { if (client.ip ~ a) { pass; } } } From phk at projects.linpro.no Sun Oct 5 21:55:35 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sun, 5 Oct 2008 23:55:35 +0200 (CEST) Subject: r3255 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005215535.5FE321EC213@projects.linpro.no> Author: phk Date: 2008-10-05 23:55:35 +0200 (Sun, 05 Oct 2008) New Revision: 3255 Added: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc Log: Coverage testcase for vcc_action.c Added: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc 2008-10-05 21:55:35 UTC (rev 3255) @@ -0,0 +1,103 @@ +# $Id$ + +test "VCL compiler coverage test: vcc_action.c" + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_hit { restart ; } + sub vcl_miss { restart rollback; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { error obj.status ; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_miss { error req.url ; } + sub vcl_pass { error "the butter please" ; } + sub vcl_fetch { error obj.status req.url; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_miss { set server.port = 1000; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.ttl /= 2; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.ttl >>= 2; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.backend += b; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url += server.port; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + /* XXX: This should not really be an error */ + sub vcl_recv { set req.url = "foo" 2 "bar"; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.cacheable += 1; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.cacheable = true; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.cacheable = false; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { set obj.cacheable = mu; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { unset obj.cacheable; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { purge_url (3); } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { purge_hash (3); } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { purge_hash ("foo"); } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { panic 3; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { kluf ; } +} + From phk at projects.linpro.no Sun Oct 5 22:10:15 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 6 Oct 2008 00:10:15 +0200 (CEST) Subject: r3256 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005221015.1B3031EC6CB@projects.linpro.no> Author: phk Date: 2008-10-06 00:10:14 +0200 (Mon, 06 Oct 2008) New Revision: 3256 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc Log: A bit more vcc_action.c coverage Modified: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc 2008-10-05 21:55:35 UTC (rev 3255) +++ trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc 2008-10-05 22:10:14 UTC (rev 3256) @@ -8,6 +8,11 @@ sub vcl_miss { restart rollback; } } +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_hit { restart 2 ; } +} + varnish v1 -vcl { backend b { .host = "127.0.0.1"; } sub vcl_fetch { error obj.status ; } @@ -22,6 +27,11 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } + sub vcl_fetch { error 404 req.grace; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } sub vcl_miss { set server.port = 1000; } } @@ -48,11 +58,21 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } /* XXX: This should not really be an error */ - sub vcl_recv { set req.url = "foo" 2 "bar"; } + sub vcl_recv { set req.url = "foo" if "bar"; } } varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } + sub vcl_hash { set req.hash += 1; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url = 1; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } sub vcl_fetch { set obj.cacheable += 1; } } @@ -78,12 +98,12 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } - sub vcl_recv { purge_url (3); } + sub vcl_recv { purge_url (if); } } varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } - sub vcl_recv { purge_hash (3); } + sub vcl_recv { purge_hash (if); } } varnish v1 -vcl { @@ -93,7 +113,7 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } - sub vcl_recv { panic 3; } + sub vcl_recv { panic if; } } varnish v1 -badvcl { @@ -101,3 +121,9 @@ sub vcl_recv { kluf ; } } + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_error { synthetic if "foo"; } +} + From phk at projects.linpro.no Sun Oct 5 22:28:13 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 6 Oct 2008 00:28:13 +0200 (CEST) Subject: r3257 - trunk/varnish-cache/lib/libvcl Message-ID: <20081005222813.DB9851EC6CB@projects.linpro.no> Author: phk Date: 2008-10-06 00:28:13 +0200 (Mon, 06 Oct 2008) New Revision: 3257 Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Fix a truly obscure bug in compiler message error reporting: If the error references the first token and there is no preceding newline we would core dump. Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-05 22:10:14 UTC (rev 3256) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-05 22:28:13 UTC (rev 3257) @@ -79,6 +79,8 @@ pos = 0; sp = t->src; b = sp->b; + if (ll != NULL) + *ll = b; for (p = b; p < t->b; p++) { if (*p == '\n') { lin++; @@ -379,12 +381,13 @@ for (q = p + 2; q < sp->e; q++) { if (*q == '}' && q[1] == 'C') { vcc_AddToken(tl, CSRC, p, q + 2); - p = q + 2; break; } } - if (q < sp->e) + if (q < sp->e) { + p = q + 2; continue; + } vcc_AddToken(tl, EOI, p, p + 2); vsb_printf(tl->sb, "Unterminated inline C source, starting at\n"); From phk at projects.linpro.no Sun Oct 5 22:40:17 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 6 Oct 2008 00:40:17 +0200 (CEST) Subject: r3258 - trunk/varnish-cache/lib/libvcl Message-ID: <20081005224017.338AD1EC213@projects.linpro.no> Author: phk Date: 2008-10-06 00:40:16 +0200 (Mon, 06 Oct 2008) New Revision: 3258 Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c Log: Fix error handling of unterminated long-strings. Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-05 22:28:13 UTC (rev 3257) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-05 22:40:16 UTC (rev 3258) @@ -400,18 +400,19 @@ for (q = p + 2; q < sp->e; q++) { if (*q == '"' && q[1] == '}') { vcc_AddToken(tl, CSTR, p, q + 2); - p = q + 2; break; } } - u = tl->t->e - tl->t->b; - u -= 4; /* {" ... "} */ - tl->t->dec = TlAlloc(tl, u + 1 ); - AN(tl->t->dec); - memcpy(tl->t->dec, tl->t->b + 2, u); - tl->t->dec[u] = '\0'; - if (q < sp->e) + if (q < sp->e) { + p = q + 2; + u = tl->t->e - tl->t->b; + u -= 4; /* {" ... "} */ + tl->t->dec = TlAlloc(tl, u + 1 ); + AN(tl->t->dec); + memcpy(tl->t->dec, tl->t->b + 2, u); + tl->t->dec[u] = '\0'; continue; + } vcc_AddToken(tl, EOI, p, p + 2); vsb_printf(tl->sb, "Unterminated long-string, starting at\n"); From phk at projects.linpro.no Sun Oct 5 22:45:42 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 6 Oct 2008 00:45:42 +0200 (CEST) Subject: r3259 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081005224542.1D42C1EC7C4@projects.linpro.no> Author: phk Date: 2008-10-06 00:45:41 +0200 (Mon, 06 Oct 2008) New Revision: 3259 Added: trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc Log: Test coverage for vcc_token.c Added: trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc 2008-10-05 22:45:41 UTC (rev 3259) @@ -0,0 +1,57 @@ +# $Id$ + +test "VCL compiler coverage test: vcc_token.c" + +varnish v1 -badvcl " C{ " + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url = "%/"; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url = "%a/"; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url = "%4a"; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set req.url = "%0a"; } +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + # comment + sub vcl_recv { set req.url = "x"; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + /* +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + {" } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + " +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { C{ int i; (void)i; }C } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + ? +} + From tfheen at projects.linpro.no Tue Oct 7 09:46:22 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 7 Oct 2008 11:46:22 +0200 (CEST) Subject: r3260 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish Message-ID: <20081007094622.2DD051EC6CB@projects.linpro.no> Author: tfheen Date: 2008-10-07 11:46:21 +0200 (Tue, 07 Oct 2008) New Revision: 3260 Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/time.c Log: Move dsleep to libvarnish/time.c and rename it to TIM_sleep Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-05 22:45:41 UTC (rev 3259) +++ trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-07 09:46:21 UTC (rev 3260) @@ -91,15 +91,6 @@ "Connection: close\r\n" "\r\n"; -static void -dsleep(double t) -{ - if (t > 100.0) - (void)sleep((int)round(t)); - else - (void)usleep((int)round(t * 1e6)); -} - /*-------------------------------------------------------------------- * Poke one backend, once, but possibly at both IPv4 and IPv6 addresses. * @@ -330,7 +321,7 @@ vt->last, vt->avg, vt->resp_buf); if (!vt->stop) - dsleep(vt->probe.interval); + TIM_sleep(vt->probe.interval); } return (NULL); } Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2008-10-05 22:45:41 UTC (rev 3259) +++ trunk/varnish-cache/include/libvarnish.h 2008-10-07 09:46:21 UTC (rev 3260) @@ -70,6 +70,7 @@ time_t TIM_parse(const char *p); double TIM_mono(void); double TIM_real(void); +void TIM_sleep(double t); /* from libvarnish/version.c */ void varnish_version(const char *); Modified: trunk/varnish-cache/lib/libvarnish/time.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/time.c 2008-10-05 22:45:41 UTC (rev 3259) +++ trunk/varnish-cache/lib/libvarnish/time.c 2008-10-07 09:46:21 UTC (rev 3260) @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include "config.h" #include "libvarnish.h" @@ -148,6 +150,16 @@ return (0); } +void +TIM_sleep(double t) +{ + if (t > 100.0) + (void)sleep((int)round(t)); + else + (void)usleep((int)round(t * 1e6)); +} + + #ifdef TEST_DRIVER #include From tfheen at projects.linpro.no Tue Oct 7 09:46:24 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 7 Oct 2008 11:46:24 +0200 (CEST) Subject: r3261 - trunk/varnish-cache/bin/varnishd Message-ID: <20081007094624.639031EC405@projects.linpro.no> Author: tfheen Date: 2008-10-07 11:46:24 +0200 (Tue, 07 Oct 2008) New Revision: 3261 Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Sleep for a bit if accept(2) returns EMFILE Hopefully, this will mitigate pile-ups somewhat and prevent us from running out of file descriptors, at least as quickly. See #330. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-10-07 09:46:21 UTC (rev 3260) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-10-07 09:46:24 UTC (rev 3261) @@ -221,10 +221,20 @@ addr = (void*)&addr_s; i = accept(ls->sock, addr, &l); if (i < 0) { - if (errno != EAGAIN && errno != ECONNABORTED) { + switch (errno) { + case EAGAIN: + case ECONNABORTED: + break; + case EMFILE: VSL(SLT_Debug, ls->sock, - "Accept failed errno=%d", errno); + "Too many open files when accept(2)ing. Sleeping."); + TIM_sleep(params->accept_fd_holdoff * 1000.0); + break; + default: + VSL(SLT_Debug, ls->sock, + "Accept failed: %s", strerror(errno)); /* XXX: stats ? */ + break; } continue; } Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-07 09:46:21 UTC (rev 3260) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-07 09:46:24 UTC (rev 3261) @@ -179,6 +179,10 @@ /* Acceptable clockskew with backends */ unsigned clock_skew; + + /* Amount of time to sleep when running out of file + descriptors. In msecs */ + unsigned accept_fd_holdoff; }; extern volatile struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-07 09:46:21 UTC (rev 3260) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-07 09:46:24 UTC (rev 3261) @@ -747,6 +747,12 @@ "VCL can override this default value for each backend.", 0, "400", "ms" }, + { "accept_fd_holdoff", tweak_timeout, + &master.accept_fd_holdoff, 0, 3600*1000, + "If we run out of file descriptors, the accept thread will " + "sleep. This parameter control for how long it will sleep.", + EXPERIMENTAL, + "50", "ms" }, { "clock_skew", tweak_uint, &master.clock_skew, 0, UINT_MAX, "How much clockskew we are willing to accept between the " "backend and our own clock.", From phk at projects.linpro.no Tue Oct 7 10:57:35 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 7 Oct 2008 12:57:35 +0200 (CEST) Subject: r3262 - trunk/varnish-cache/bin/varnishd Message-ID: <20081007105735.A5B0F1EC6CB@projects.linpro.no> Author: phk Date: 2008-10-07 12:57:35 +0200 (Tue, 07 Oct 2008) New Revision: 3262 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: Make sure ESI includes don't trip the director NULL check in vcl_recv. Fixes #339 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-07 09:46:24 UTC (rev 3261) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-07 10:57:35 UTC (rev 3262) @@ -828,6 +828,12 @@ http_Unset(sp->http, H_If_Modified_Since); http_SetHeader(sp->wrk, sp->fd, sp->http, eb->host.b); } + /* + * XXX: We should decide if we should cache the director + * XXX: or not (for session/backend coupling). Until then + * XXX: make sure we don't trip up the check in vcl_recv. + */ + sp->director = NULL; sp->step = STP_RECV; http_ForceGet(sp->http); http_Unset(sp->http, H_Content_Length); From tfheen at projects.linpro.no Tue Oct 7 11:00:38 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 7 Oct 2008 13:00:38 +0200 (CEST) Subject: r3263 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081007110038.CBAB91EC204@projects.linpro.no> Author: tfheen Date: 2008-10-07 13:00:38 +0200 (Tue, 07 Oct 2008) New Revision: 3263 Added: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Make sure error works in vcl_fetch error was unimplemented in vcl_fetch. Implement it and add a test case. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-07 10:57:35 UTC (rev 3262) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-07 11:00:38 UTC (rev 3263) @@ -426,6 +426,14 @@ break; case VCL_RET_DELIVER: break; + case VCL_RET_ERROR: + sp->step = STP_ERROR; + sp->obj->ttl = 0; + sp->obj->cacheable = 0; + HSH_Unbusy(sp); + HSH_Deref(sp->obj); + sp->obj = NULL; + return (0); default: WRONG("Illegal action in vcl_fetch{}"); } Added: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc 2008-10-07 11:00:38 UTC (rev 3263) @@ -0,0 +1,21 @@ +# $Id$ + +test "Check that error in vcl_fetch works" + +server s1 { + rxreq + txresp -body "012345\n" +} -start + +varnish v1 -vcl+backend { + sub vcl_fetch { + set obj.http.Foo = "bar"; + error 523 "not ok"; + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 523 +} -run From tfheen at projects.linpro.no Tue Oct 7 11:00:43 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 7 Oct 2008 13:00:43 +0200 (CEST) Subject: r3264 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081007110043.6AA361EC6CB@projects.linpro.no> Author: tfheen Date: 2008-10-07 13:00:42 +0200 (Tue, 07 Oct 2008) New Revision: 3264 Modified: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc Log: Check that error in vcl_fetch doesn't generate a cached object Modified: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc 2008-10-07 11:00:38 UTC (rev 3263) +++ trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc 2008-10-07 11:00:42 UTC (rev 3264) @@ -19,3 +19,5 @@ rxresp expect resp.status == 523 } -run + +varnish v1 -expect n_object == 0 From tfheen at projects.linpro.no Tue Oct 7 11:08:43 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 7 Oct 2008 13:08:43 +0200 (CEST) Subject: r3265 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081007110843.B52201EC204@projects.linpro.no> Author: tfheen Date: 2008-10-07 13:08:43 +0200 (Tue, 07 Oct 2008) New Revision: 3265 Added: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_center.c Log: Error out when reaching max_restarts Partially addresses #280 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-07 11:00:42 UTC (rev 3264) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-07 11:08:43 UTC (rev 3265) @@ -855,6 +855,12 @@ AN(sp->director); VCL_recv_method(sp); + if (sp->restarts >= params->max_restarts) { + if (sp->err_code == 0) + sp->err_code = 503; + sp->step = STP_ERROR; + return (0); + } sp->wantbody = (strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD") != 0); sp->sendbody = 0; Added: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc 2008-10-07 11:08:43 UTC (rev 3265) @@ -0,0 +1,48 @@ +# $Id$ + +test "Check that max_restarts works and that we don't fall over" + +server s1 -repeat 6 { + rxreq + txresp -body "012345\n" +} -start + +varnish v1 -vcl+backend { + sub vcl_fetch { + restart; + } + + sub vcl_error { + if (req.restarts == 2) { + set obj.status = 200; + } elsif (req.restarts > 2) { + set obj.status = 501; + } elsif (req.restarts < 2) { + set obj.status = 500; + } + } +} -start + +varnish v1 -cliok "param.set max_restarts 2" + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 200 +} -run + +varnish v1 -cliok "param.set max_restarts 3" + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 501 +} -run + +varnish v1 -cliok "param.set max_restarts 1" + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 500 +} -run From tfheen at projects.linpro.no Wed Oct 8 11:36:35 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 8 Oct 2008 13:36:35 +0200 (CEST) Subject: r3266 - trunk/varnish-cache Message-ID: <20081008113635.38B1F1EC0B5@projects.linpro.no> Author: tfheen Date: 2008-10-08 13:36:34 +0200 (Wed, 08 Oct 2008) New Revision: 3266 Modified: trunk/varnish-cache/configure.ac Log: Release 2.0 RC 1 Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-10-07 11:08:43 UTC (rev 3265) +++ trunk/varnish-cache/configure.ac 2008-10-08 11:36:34 UTC (rev 3266) @@ -1,9 +1,9 @@ -B0;136;0c# $Id$ +# $Id$ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [2.0-rc1], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at projects.linpro.no Wed Oct 8 11:38:27 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 8 Oct 2008 13:38:27 +0200 (CEST) Subject: r3267 - tags Message-ID: <20081008113827.ADACC1EC6CB@projects.linpro.no> Author: tfheen Date: 2008-10-08 13:38:27 +0200 (Wed, 08 Oct 2008) New Revision: 3267 Added: tags/varnish-2.0-rc1/ Log: Tag 2.0 RC 1 Copied: tags/varnish-2.0-rc1 (from rev 3266, trunk) From tfheen at projects.linpro.no Wed Oct 8 11:38:46 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 8 Oct 2008 13:38:46 +0200 (CEST) Subject: r3268 - trunk/varnish-cache Message-ID: <20081008113846.ADF001EC0B5@projects.linpro.no> Author: tfheen Date: 2008-10-08 13:38:46 +0200 (Wed, 08 Oct 2008) New Revision: 3268 Modified: trunk/varnish-cache/configure.ac Log: Set release back to trunk Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-10-08 11:38:27 UTC (rev 3267) +++ trunk/varnish-cache/configure.ac 2008-10-08 11:38:46 UTC (rev 3268) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [2.0-rc1], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From phk at projects.linpro.no Wed Oct 8 20:45:29 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 8 Oct 2008 22:45:29 +0200 (CEST) Subject: r3269 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081008204529.81ACB1EC815@projects.linpro.no> Author: phk Date: 2008-10-08 22:45:29 +0200 (Wed, 08 Oct 2008) New Revision: 3269 Modified: trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc Log: Use two differnet semaphores for now. Modified: trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc 2008-10-08 11:38:46 UTC (rev 3268) +++ trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc 2008-10-08 20:45:29 UTC (rev 3269) @@ -27,25 +27,25 @@ delay .2 txreq rxresp - sema r1 sync 4 + sema r2 sync 4 } -start client c2 -connect 127.0.0.1:9081 { delay .6 txreq rxresp - sema r1 sync 4 + sema r2 sync 4 } -start client c3 -connect 127.0.0.1:9082 { delay .9 txreq rxresp - sema r1 sync 4 + sema r2 sync 4 } -start # Wait for all servers to have received requests sema r1 sync 4 # Wait for all clients to have received responses -sema r1 sync 4 +sema r2 sync 4 From ssm at projects.linpro.no Thu Oct 9 09:05:17 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Thu, 9 Oct 2008 11:05:17 +0200 (CEST) Subject: r3270 - trunk/varnish-cache/bin/varnishadm Message-ID: <20081009090517.7D1EE1EC405@projects.linpro.no> Author: ssm Date: 2008-10-09 11:05:17 +0200 (Thu, 09 Oct 2008) New Revision: 3270 Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.1 Log: Add a description to varnishadm man page for whatis Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.1 =================================================================== --- trunk/varnish-cache/bin/varnishadm/varnishadm.1 2008-10-08 20:45:29 UTC (rev 3269) +++ trunk/varnish-cache/bin/varnishadm/varnishadm.1 2008-10-09 09:05:17 UTC (rev 3270) @@ -33,6 +33,7 @@ .Os .Sh NAME .Nm varnishadm +.Nd Control a running varnish instance .Sh SYNOPSIS .Nm .Fl T Ar address Ns : Ns Ar port From ssm at projects.linpro.no Thu Oct 9 09:05:21 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Thu, 9 Oct 2008 11:05:21 +0200 (CEST) Subject: r3271 - trunk/varnish-cache/man Message-ID: <20081009090521.146481EC0D3@projects.linpro.no> Author: ssm Date: 2008-10-09 11:05:20 +0200 (Thu, 09 Oct 2008) New Revision: 3271 Modified: trunk/varnish-cache/man/vcl.7so Log: Fix markup in vcl.7 man page after linting Modified: trunk/varnish-cache/man/vcl.7so =================================================================== --- trunk/varnish-cache/man/vcl.7so 2008-10-09 09:05:17 UTC (rev 3270) +++ trunk/varnish-cache/man/vcl.7so 2008-10-09 09:05:20 UTC (rev 3271) @@ -96,7 +96,7 @@ Directors choose from different backends based on health status and a per-director algorithm. There currently exists a round-robin and a random director. - +.Pp Directors are defined using: .Bd -literal -offset 4n director b2 random { @@ -121,13 +121,11 @@ This specifies how many tries it will use to find a working backend. The default is the same as the number of backends defined for the director. - +.Pp There is also a per-backend option: weight which defines the portion of traffic to send to the particular backend. -.Ed .Ss The round-robin director The round-robin does not take any options. -.Ed .Ss Backend probes Backends can be probed to see whether they should be considered healthy or not. The return status can also be checked by using From phk at projects.linpro.no Thu Oct 9 11:39:25 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 9 Oct 2008 13:39:25 +0200 (CEST) Subject: r3272 - in trunk/varnish-cache/bin/varnishtest: . tests Message-ID: <20081009113925.3074F1EC7C1@projects.linpro.no> Author: phk Date: 2008-10-09 13:39:24 +0200 (Thu, 09 Oct 2008) New Revision: 3272 Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc trunk/varnish-cache/bin/varnishtest/vtc.c trunk/varnish-cache/bin/varnishtest/vtc.h trunk/varnish-cache/bin/varnishtest/vtc_client.c trunk/varnish-cache/bin/varnishtest/vtc_http.c trunk/varnish-cache/bin/varnishtest/vtc_log.c trunk/varnish-cache/bin/varnishtest/vtc_sema.c trunk/varnish-cache/bin/varnishtest/vtc_server.c trunk/varnish-cache/bin/varnishtest/vtc_varnish.c Log: Overhaul the varnishtest program to fix a race condition which might (or might not) be the root cause of #346: The delay function would access the toplevel log element from client/server contexts with no logging. Fix by passing the log element to the subcommands. This race would only affect testcases using delay or sema inside client or server threads. Revert test a00008.vtc to use only one sema, using two just moved the race condition. This also has the side effect of moving "sema" related messages to the tread that carries out the "sema" operation. Various other cleanups now that I had my fingers in the code anyway: memory leaks plugged, stylistic nits etc. Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishtest/flint.lnt 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/flint.lnt 2008-10-09 11:39:24 UTC (rev 3272) @@ -36,6 +36,9 @@ // -emacro((826), VTAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small) // -emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small) -emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean +-emacro(779, REPLACE) // string constant != +-emacro(774, REPLACE) // if(bool) always true +-emacro(506, REPLACE) // const bool // -esym(534, sprintf) // Ignoring return value of function // -esym(534, asprintf) // Ignoring return value of function Modified: trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/tests/a00008.vtc 2008-10-09 11:39:24 UTC (rev 3272) @@ -27,25 +27,25 @@ delay .2 txreq rxresp - sema r2 sync 4 + sema r1 sync 4 } -start client c2 -connect 127.0.0.1:9081 { delay .6 txreq rxresp - sema r2 sync 4 + sema r1 sync 4 } -start client c3 -connect 127.0.0.1:9082 { delay .9 txreq rxresp - sema r2 sync 4 + sema r1 sync 4 } -start # Wait for all servers to have received requests sema r1 sync 4 # Wait for all clients to have received responses -sema r2 sync 4 +sema r1 sync 4 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -41,7 +41,8 @@ #define MAX_FILESIZE (1024 * 1024) #define MAX_TOKENS 100 -static struct vtclog *vl; +const char *vtc_file; +char *vtc_desc; /********************************************************************** * Read a file into memory @@ -80,7 +81,7 @@ */ void -parse_string(char *buf, const struct cmds *cmd, void *priv) +parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl) { char *token_s[MAX_TOKENS], *token_e[MAX_TOKENS]; char *p, *q; @@ -183,7 +184,7 @@ } assert(cp->cmd != NULL); - cp->cmd(token_s, priv, cmd); + cp->cmd(token_s, priv, cmd, vl); } } @@ -196,7 +197,7 @@ { for (; cmd->name != NULL; cmd++) - cmd->cmd(NULL, NULL, NULL); + cmd->cmd(NULL, NULL, NULL, NULL); } /********************************************************************** @@ -209,6 +210,7 @@ (void)priv; (void)cmd; + (void)vl; if (av == NULL) return; @@ -216,6 +218,7 @@ printf("# TEST %s\n", av[1]); AZ(av[2]); + vtc_desc = strdup(av[1]); } /********************************************************************** @@ -270,6 +273,7 @@ { (void)cmd; + (void)vl; if (av == NULL) return; printf("cmd_dump(%p)\n", priv); @@ -293,16 +297,20 @@ }; static void -exec_file(const char *fn) +exec_file(const char *fn, struct vtclog *vl) { char *buf; - printf("# TEST %s starting\n", fn); + vtc_file = fn; + vtc_desc = NULL; + vtc_log(vl, 1, "TEST %s starting", fn); buf = read_file(fn); - parse_string(buf, cmds, NULL); - printf("# RESETTING after %s\n", fn); + parse_string(buf, cmds, NULL, vl); + vtc_log(vl, 1, "RESETTING after %s", fn); reset_cmds(cmds); - printf("# TEST %s completed\n", fn); + vtc_log(vl, 1, "TEST %s completed", fn); + vtc_file = NULL; + free(vtc_desc); } /********************************************************************** @@ -325,10 +333,11 @@ { int ch; FILE *fok; + static struct vtclog *vl; setbuf(stdout, NULL); setbuf(stderr, NULL); - vl = vtc_logopen(""); + vl = vtc_logopen("top"); AN(vl); while ((ch = getopt(argc, argv, "qv")) != -1) { switch (ch) { @@ -350,7 +359,7 @@ init_sema(); for (ch = 0; ch < argc; ch++) - exec_file(argv[ch]); + exec_file(argv[ch], vl); fok = fopen("_.ok", "w"); if (fok != NULL) fclose(fok); Modified: trunk/varnish-cache/bin/varnishtest/vtc.h =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-09 11:39:24 UTC (rev 3272) @@ -30,7 +30,7 @@ struct vtclog; struct cmds; -#define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd +#define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd, struct vtclog *vl typedef void cmd_f(CMD_ARGS); struct cmds { @@ -38,7 +38,7 @@ cmd_f *cmd; }; -void parse_string(char *buf, const struct cmds *cmd, void *priv); +void parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl); cmd_f cmd_dump; cmd_f cmd_delay; @@ -47,13 +47,17 @@ cmd_f cmd_varnish; cmd_f cmd_sema; +extern const char *vtc_file; +extern char *vtc_desc; +extern int vtc_verbosity; + void init_sema(void); void http_process(struct vtclog *vl, const char *spec, int sock, int client); void cmd_server_genvcl(struct vsb *vsb); -extern int vtc_verbosity; struct vtclog *vtc_logopen(const char *id); +void vtc_logclose(struct vtclog *vl); void vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...); void vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str); Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -51,7 +51,7 @@ char *spec; - const char *connect; + char *connect; pthread_t tp; }; @@ -98,26 +98,42 @@ */ static struct client * -client_new(char *name) +client_new(const char *name) { struct client *c; + AN(name); ALLOC_OBJ(c, CLIENT_MAGIC); AN(c); - c->name = name; + REPLACE(c->name, name); c->vl = vtc_logopen(name); AN(c->vl); - if (*name != 'c') { + if (*c->name != 'c') vtc_log(c->vl, 0, "Client name must start with 'c'"); - exit (1); - } - c->connect = "127.0.0.1:9081"; + REPLACE(c->connect, "127.0.0.1:9081"); VTAILQ_INSERT_TAIL(&clients, c, list); return (c); } /********************************************************************** + * Clean up client + */ + +static void +client_delete(struct client *c) +{ + + CHECK_OBJ_NOTNULL(c, CLIENT_MAGIC); + vtc_logclose(c->vl); + free(c->spec); + free(c->name); + free(c->connect); + /* XXX: MEMLEAK (?)*/ + FREE_OBJ(c); +} + +/********************************************************************** * Start the client thread */ @@ -173,6 +189,7 @@ (void)priv; (void)cmd; + (void)vl; if (av == NULL) { /* Reset and free */ @@ -180,8 +197,7 @@ VTAILQ_REMOVE(&clients, c, list); if (c->tp != 0) client_wait(c); - FREE_OBJ(c); - /* XXX: MEMLEAK */ + client_delete(c); } return; } @@ -198,7 +214,7 @@ for (; *av != NULL; av++) { if (!strcmp(*av, "-connect")) { - c->connect = av[1]; + REPLACE(c->connect, av[1]); av++; continue; } @@ -218,6 +234,6 @@ vtc_log(c->vl, 0, "Unknown client argument: %s", *av); exit (1); } - c->spec = *av; + REPLACE(c->spec, *av); } } Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -70,7 +70,7 @@ * Generate a synthetic body */ -static const char * +static char * synth_body(const char *len) { int i, j, k, l; @@ -185,6 +185,7 @@ char *rhs; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); assert(!strcmp(av[0], "expect")); av++; @@ -419,6 +420,7 @@ struct http *hp; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(hp->client); assert(!strcmp(av[0], "rxresp")); @@ -445,9 +447,10 @@ const char *proto = "HTTP/1.1"; const char *status = "200"; const char *msg = "Ok"; - const char *body = NULL; + char *body = NULL; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(hp->client); assert(!strcmp(av[0], "txresp")); @@ -482,7 +485,7 @@ for(; *av != NULL; av++) { if (!strcmp(*av, "-body")) { AZ(body); - body = av[1]; + REPLACE(body, av[1]); av++; } else if (!strcmp(*av, "-bodylen")) { AZ(body); @@ -515,6 +518,7 @@ struct http *hp; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AZ(hp->client); assert(!strcmp(av[0], "rxreq")); @@ -544,6 +548,7 @@ const char *body = NULL; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(hp->client); assert(!strcmp(av[0], "txreq")); @@ -609,6 +614,7 @@ int i; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); @@ -628,6 +634,7 @@ struct http *hp; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); @@ -646,6 +653,7 @@ struct http *hp; (void)cmd; + (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); @@ -692,7 +700,7 @@ q = strchr(s, '\0'); assert(q > s); AN(s); - parse_string(s, http_cmds, hp); + parse_string(s, http_cmds, hp, vl); vsb_delete(hp->vsb); free(hp->rxbuf); free(hp); Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -62,6 +62,15 @@ return (vl); } +void +vtc_logclose(struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); + vsb_delete(vl->vsb); + FREE_OBJ(vl); +} + static const char *lead[] = { "----", "# ", @@ -77,6 +86,7 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) { + CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); assert(lvl < NLEAD); if (lvl > vtc_verbosity) return; @@ -91,8 +101,11 @@ AZ(vsb_overflowed(vl->vsb)); (void)fputs(vsb_data(vl->vsb), stdout); vsb_clear(vl->vsb); - if (lvl == 0) + if (lvl == 0) { + printf("---- TEST FILE: %s\n", vtc_file); + printf("---- TEST DESCRIPTION: %s\n", vtc_desc); exit (1); + } } /********************************************************************** @@ -105,6 +118,7 @@ { int nl = 1; + CHECK_OBJ_NOTNULL(vl, VTCLOG_MAGIC); assert(lvl < NLEAD); if (lvl > vtc_verbosity) return; Modified: trunk/varnish-cache/bin/varnishtest/vtc_sema.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -42,7 +42,6 @@ unsigned magic; #define SEMA_MAGIC 0x29b64317 char *name; - struct vtclog *vl; VTAILQ_ENTRY(sema) list; pthread_mutex_t mtx; pthread_cond_t cond; @@ -59,17 +58,15 @@ */ static struct sema * -sema_new(char *name) +sema_new(char *name, struct vtclog *vl) { struct sema *r; ALLOC_OBJ(r, SEMA_MAGIC); AN(r); - r->vl = vtc_logopen(name); - AN(r->vl); r->name = name; if (*name != 'r') - vtc_log(r->vl, 0, "Sema name must start with 'r'"); + vtc_log(vl, 0, "Sema name must start with 'r' (%s)", *name); AZ(pthread_mutex_init(&r->mtx, NULL)); AZ(pthread_cond_init(&r->cond, NULL)); @@ -84,24 +81,31 @@ */ static void -sema_sync(struct sema *r, const char *av) +sema_sync(struct sema *r, const char *av, struct vtclog *vl) { unsigned u; + CHECK_OBJ_NOTNULL(r, SEMA_MAGIC); u = strtoul(av, NULL, 0); AZ(pthread_mutex_lock(&r->mtx)); if (r->expected == 0) r->expected = u; - assert(r->expected == u); + if (r->expected != u) + vtc_log(vl, 0, + "Sema(%s) use error: different expectations (%u vs %u)", + r->name, r->expected, u); if (++r->waiters == r->expected) { - vtc_log(r->vl, 4, "Wake %u", r->expected); + vtc_log(vl, 4, "Sema(%s) wake %u", r->name, r->expected); AZ(pthread_cond_broadcast(&r->cond)); r->waiters = 0; r->expected = 0; - } else + } else { + vtc_log(vl, 4, "Sema(%s) wait %u of %u", + r->name, r->waiters, r->expected); AZ(pthread_cond_wait(&r->cond, &r->mtx)); + } AZ(pthread_mutex_unlock(&r->mtx)); } @@ -121,9 +125,10 @@ AZ(pthread_mutex_lock(&sema_mtx)); /* Reset and free */ VTAILQ_FOREACH_SAFE(r, &semas, list, r2) { - VTAILQ_REMOVE(&semas, r, list); - FREE_OBJ(r); - /* XXX: MEMLEAK */ + AZ(pthread_mutex_lock(&r->mtx)); + AZ(r->waiters); + AZ(r->expected); + AZ(pthread_mutex_unlock(&r->mtx)); } AZ(pthread_mutex_unlock(&sema_mtx)); return; @@ -137,7 +142,7 @@ if (!strcmp(r->name, av[0])) break; if (r == NULL) - r = sema_new(av[0]); + r = sema_new(av[0], vl); AZ(pthread_mutex_unlock(&sema_mtx)); av++; @@ -145,10 +150,10 @@ if (!strcmp(*av, "sync")) { av++; AN(*av); - sema_sync(r, *av); + sema_sync(r, *av, vl); continue; } - vtc_log(r->vl, 0, "Unknown sema argument: %s", *av); + vtc_log(vl, 0, "Unknown sema argument: %s", *av); } } Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -57,7 +57,7 @@ int depth; int sock; - const char *listen; + char *listen; struct vss_addr **vss_addr; char *addr; char *port; @@ -109,20 +109,20 @@ */ static struct server * -server_new(char *name) +server_new(const char *name) { struct server *s; + AN(name); ALLOC_OBJ(s, SERVER_MAGIC); AN(s); - s->name = name; + REPLACE(s->name, name); s->vl = vtc_logopen(name); AN(s->vl); - if (*name != 's') { + if (*s->name != 's') vtc_log(s->vl, 0, "Server name must start with 's'"); - exit (1); - } - s->listen = "127.0.0.1:9080"; + + REPLACE(s->listen, "127.0.0.1:9080"); AZ(VSS_parse(s->listen, &s->addr, &s->port)); s->repeat = 1; s->depth = 1; @@ -132,6 +132,22 @@ } /********************************************************************** + * Clean up a server + */ + +static void +server_delete(struct server *s) +{ + + CHECK_OBJ_NOTNULL(s, SERVER_MAGIC); + vtc_logclose(s->vl); + free(s->listen); + free(s->name); + /* XXX: MEMLEAK (?) (VSS ??) */ + FREE_OBJ(s); +} + +/********************************************************************** * Start the server thread */ @@ -211,6 +227,7 @@ (void)priv; (void)cmd; + (void)vl; if (av == NULL) { /* Reset and free */ @@ -218,8 +235,7 @@ VTAILQ_REMOVE(&servers, s, list); if (s->sock >= 0) server_wait(s); - FREE_OBJ(s); - /* XXX: MEMLEAK */ + server_delete(s); } return; } @@ -241,7 +257,7 @@ continue; } if (!strcmp(*av, "-listen")) { - s->listen = av[1]; + REPLACE(s->listen, av[1]); AZ(VSS_parse(s->listen, &s->addr, &s->port)); av++; continue; Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-09 09:05:20 UTC (rev 3271) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-09 11:39:24 UTC (rev 3272) @@ -131,21 +131,20 @@ */ static struct varnish * -varnish_new(char *name) +varnish_new(const char *name) { struct varnish *v; + AN(name); ALLOC_OBJ(v, VARNISH_MAGIC); AN(v); - v->name = name; + REPLACE(v->name, name); v->vl = vtc_logopen(name); AN(v->vl); v->vl1 = vtc_logopen(name); AN(v->vl1); - if (*name != 'v') { + if (*v->name != 'v') vtc_log(v->vl, 0, "Varnish name must start with 'v'"); - exit (1); - } v->args = ""; v->telnet = "127.0.0.1:9001"; @@ -156,6 +155,21 @@ } /********************************************************************** + * Delete a varnish instance + */ + +static void +varnish_delete(struct varnish *v) +{ + + CHECK_OBJ_NOTNULL(v, VARNISH_MAGIC); + vtc_logclose(v->vl); + free(v->name); + /* XXX: MEMLEAK */ + FREE_OBJ(v); +} + +/********************************************************************** * Varnish listener */ @@ -418,8 +432,8 @@ */ static void -varnish_expect(struct varnish *v, char * const *av) { - uint64_t val, ref; +varnish_expect(const struct varnish *v, char * const *av) { + uint64_t val, ref; int good; char *p; int i; @@ -428,6 +442,7 @@ for (i = 0; i < 10; i++, usleep(100000)) { + #define MAC_STAT(n, t, f, d) \ if (!strcmp(av[0], #n)) { \ val = v->stats->n; \ @@ -435,6 +450,7 @@ #include "stat_field.h" #undef MAC_STAT { + val = 0; vtc_log(v->vl, 0, "stats field %s unknown", av[0]); } @@ -472,6 +488,7 @@ (void)priv; (void)cmd; + (void)vl; if (av == NULL) { /* Reset and free */ @@ -479,8 +496,7 @@ if (v->cli_fd >= 0) varnish_wait(v); VTAILQ_REMOVE(&varnishes, v, list); - FREE_OBJ(v); - /* XXX: MEMLEAK */ + varnish_delete(v); } return; } From ingvar at projects.linpro.no Thu Oct 9 12:56:05 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Thu, 9 Oct 2008 14:56:05 +0200 (CEST) Subject: r3273 - trunk/varnish-cache/redhat Message-ID: <20081009125605.397CE1EC0B5@projects.linpro.no> Author: ingvar Date: 2008-10-09 14:56:05 +0200 (Thu, 09 Oct 2008) New Revision: 3273 Modified: trunk/varnish-cache/redhat/varnish.spec Log: Specfile changes scheduled for fedora 10. Now also in trunk. * Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 - 2.0-rc1 released. New upstream sources - Added a patch for test a00008, from r3269 - Removed condrestart in postscript at upgrade. We don't want that. Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-09 11:39:24 UTC (rev 3272) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-09 12:56:05 UTC (rev 3273) @@ -1,13 +1,13 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 0.10.beta2%{?dist} +Release: 0.11.rc1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ #Source0: http://varnish.projects.linpro.no/static/varnish-cache.tar.gz #Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz -Source0: http://downloads.sourceforge.net/varnish/varnish-2.0-beta2.tar.gz +Source0: http://downloads.sourceforge.net/varnish/varnish-2.0-rc1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -63,7 +63,7 @@ %prep #%setup -q -%setup -q -n varnish-2.0-beta2 +%setup -q -n varnish-2.0-rc1 # The svn sources needs to generate a suitable configure script # Release tarballs would not need this @@ -211,18 +211,16 @@ /sbin/chkconfig --del varnishncsa fi -%postun -if [ $1 -ge 1 ]; then - /sbin/service varnish condrestart > /dev/null 2>&1 - /sbin/service varnishlog condrestart > /dev/null 2>&1 - /sbin/service varnishncsa condrestart > /dev/null 2>&1 -fi - %post libs -p /sbin/ldconfig %postun libs -p /sbin/ldconfig %changelog +* Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 +- 2.0-rc1 released. New upstream sources +- Added a patch for test a00008, from r3269 +- Removed condrestart in postscript at upgrade. We don't want that. + * Fri Sep 26 2008 Ingvar Hagelund - 2.0-0.10.beta2 - 2.0-beta2 released. New upstream sources - Whitespace changes to make rpmlint more happy From ingvar at projects.linpro.no Thu Oct 9 20:31:32 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Thu, 9 Oct 2008 22:31:32 +0200 (CEST) Subject: r3274 - trunk/varnish-cache/redhat Message-ID: <20081009203132.430E81EC46B@projects.linpro.no> Author: ingvar Date: 2008-10-09 22:31:32 +0200 (Thu, 09 Oct 2008) New Revision: 3274 Modified: trunk/varnish-cache/redhat/varnish.spec Log: - Added 'varnishd -C' to %check, to check if varnishd generates readable code - Synced rpm changelog from fedora. There was some strange items that had to be sorted Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-09 12:56:05 UTC (rev 3273) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-09 20:31:32 UTC (rev 3274) @@ -119,6 +119,7 @@ %endif %check +LD_LIBRARY_PATH="lib/libvarnish/.libs:lib/libvarnishcompat/.libs:lib/libvarnishapi/.libs:lib/libvcl/.libs" bin/varnishd/varnishd -b 127.0.0.1:80 -C -n /tmp/foo %{__make} check LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcl/.libs" %install @@ -218,6 +219,7 @@ %changelog * Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 - 2.0-rc1 released. New upstream sources +- Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes - Added a patch for test a00008, from r3269 - Removed condrestart in postscript at upgrade. We don't want that. @@ -225,13 +227,17 @@ - 2.0-beta2 released. New upstream sources - Whitespace changes to make rpmlint more happy -* Fri Sep 12 2008 Ingvar Hagelund - 2.0-0.8.20080912svn3184 +* Fri Sep 12 2008 Ingvar Hagelund - 2.0-0.9.20080912svn3184 - Added varnisnsca init script (Colin Hill) - Corrected varnishlog init script (Colin Hill) +* Tue Sep 09 2008 Ingvar Hagelund - 2.0-0.8.beta1 +- Added a patch from r3171 that fixes an endian bug on ppc and ppc64 +- Added a hack that changes the varnishtest ports for 64bits builds, + so they can run in parallell with 32bits build on same build host + * Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.7.beta1 -- Added a hack that changes the ports for 64bits builds, so they can run - in parallell with 32bits build on same build host. +- Added a patch from r3156 and r3157, hiding a legit errno in make check * Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.6.beta1 - Added a commented option for max coresize in the sysconfig script From phk at projects.linpro.no Fri Oct 10 08:32:24 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 10:32:24 +0200 (CEST) Subject: r3275 - trunk/varnish-cache/lib/libvcl Message-ID: <20081010083224.6A63C1EC204@projects.linpro.no> Author: phk Date: 2008-10-10 10:32:24 +0200 (Fri, 10 Oct 2008) New Revision: 3275 Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Add 'w' suffix for "week" in time units. Suggested by: "chen xiaoyong" Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-09 20:31:32 UTC (rev 3274) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-10 08:32:24 UTC (rev 3275) @@ -79,6 +79,8 @@ sc = 60.0 * 60.0; else if (vcc_IdIs(tl->t, "d")) sc = 60.0 * 60.0 * 24.0; + else if (vcc_IdIs(tl->t, "w")) + sc = 60.0 * 60.0 * 24.0 * 7.0; else { vsb_printf(tl->sb, "Unknown time unit "); vcc_ErrToken(tl, tl->t); From phk at projects.linpro.no Fri Oct 10 10:16:24 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 12:16:24 +0200 (CEST) Subject: r3276 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081010101624.076881EC7CA@projects.linpro.no> Author: phk Date: 2008-10-10 12:16:23 +0200 (Fri, 10 Oct 2008) New Revision: 3276 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c Log: Add "-n iter" argument so that it is possible to run a certain set of tests a given number of times: varnishtest -n 100 tests/b*.vtc Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-10 08:32:24 UTC (rev 3275) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-10 10:16:23 UTC (rev 3276) @@ -320,7 +320,7 @@ static void usage(void) { - fprintf(stderr, "usage: varnishtest [-qv] file ...\n"); + fprintf(stderr, "usage: varnishtest [-n iter] [-qv] file ...\n"); exit(1); } @@ -331,7 +331,7 @@ int main(int argc, char * const *argv) { - int ch; + int ch, i, ntest; FILE *fok; static struct vtclog *vl; @@ -339,8 +339,11 @@ setbuf(stderr, NULL); vl = vtc_logopen("top"); AN(vl); - while ((ch = getopt(argc, argv, "qv")) != -1) { + while ((ch = getopt(argc, argv, "n:qv")) != -1) { switch (ch) { + case 'n': + ntest = strtoul(optarg, NULL, 0); + break; case 'q': vtc_verbosity--; break; @@ -358,8 +361,10 @@ usage(); init_sema(); - for (ch = 0; ch < argc; ch++) - exec_file(argv[ch], vl); + for (i = 0; i < ntest; i++) { + for (ch = 0; ch < argc; ch++) + exec_file(argv[ch], vl); + } fok = fopen("_.ok", "w"); if (fok != NULL) fclose(fok); From tfheen at projects.linpro.no Fri Oct 10 11:00:04 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 10 Oct 2008 13:00:04 +0200 (CEST) Subject: r3277 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081010110004.5D41B1EC7C1@projects.linpro.no> Author: tfheen Date: 2008-10-10 13:00:02 +0200 (Fri, 10 Oct 2008) New Revision: 3277 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c Log: default to one iteration in varnishtest Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-10 10:16:23 UTC (rev 3276) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-10 11:00:02 UTC (rev 3277) @@ -331,7 +331,7 @@ int main(int argc, char * const *argv) { - int ch, i, ntest; + int ch, i, ntest = 1; FILE *fok; static struct vtclog *vl; From phk at projects.linpro.no Fri Oct 10 13:08:38 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 15:08:38 +0200 (CEST) Subject: r3278 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010130838.0EF111EC204@projects.linpro.no> Author: phk Date: 2008-10-10 15:08:37 +0200 (Fri, 10 Oct 2008) New Revision: 3278 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc trunk/varnish-cache/bin/varnishtest/tests/v00005.vtc trunk/varnish-cache/bin/varnishtest/tests/v00006.vtc Log: Eliminate "localhost" from backends, some computers have both an IPv4 & IPv6 address in /etc/hosts' localhost entry. Use "127.0.0.1" intead. Send me a telegram when IPv6 matters. Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 11:00:02 UTC (rev 3277) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 13:08:37 UTC (rev 3278) @@ -9,7 +9,7 @@ # Reference to non-existent backend varnish v1 -badvcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; } sub vcl_recv { set req.backend = b2; @@ -52,7 +52,7 @@ # unknown field varnish v1 -badvcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .foobar = 123; } } @@ -89,7 +89,7 @@ # Old backend syntax varnish v1 -badvcl { backend b1 { - set host = "localhost"; + set host = "127.0.0.1"; } } Modified: trunk/varnish-cache/bin/varnishtest/tests/v00005.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00005.vtc 2008-10-10 11:00:02 UTC (rev 3277) +++ trunk/varnish-cache/bin/varnishtest/tests/v00005.vtc 2008-10-10 13:08:37 UTC (rev 3278) @@ -5,7 +5,7 @@ # Check url definition varnish v1 -vcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .probe = { .url = "/"; } @@ -15,7 +15,7 @@ # Check request definition varnish v1 -vcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .probe = { .request = "GET / HTTP/1.1" @@ -27,7 +27,7 @@ # Check redefinition varnish v1 -badvcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .probe = { .url = "/"; .request = @@ -40,7 +40,7 @@ # Check redefinition the other way varnish v1 -badvcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .probe = { .request = "GET / HTTP/1.1" Modified: trunk/varnish-cache/bin/varnishtest/tests/v00006.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00006.vtc 2008-10-10 11:00:02 UTC (rev 3277) +++ trunk/varnish-cache/bin/varnishtest/tests/v00006.vtc 2008-10-10 13:08:37 UTC (rev 3278) @@ -12,7 +12,7 @@ # Only one pool, to avoid getting more than one work thread varnish v1 -arg "-p thread_pools=1 -w1,1,300" -vcl { backend b1 { - .host = "localhost"; + .host = "127.0.0.1"; .port = "9080"; } } -start @@ -38,7 +38,7 @@ varnish v1 -vcl { backend b2 { - .host = "localhost"; + .host = "127.0.0.1"; .port = "9180"; } } From phk at projects.linpro.no Fri Oct 10 19:40:31 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 21:40:31 +0200 (CEST) Subject: r3279 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010194031.004281EC0D3@projects.linpro.no> Author: phk Date: 2008-10-10 21:40:30 +0200 (Fri, 10 Oct 2008) New Revision: 3279 Added: trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc Log: Add a couple of test-case for vcc_parse.c Added: trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc 2008-10-10 19:40:30 UTC (rev 3279) @@ -0,0 +1,14 @@ +# $Id$ + +test "VCL compiler coverage test: vcc_parse.c" + +varnish v1 -vcl { +backend b { .host = "127.0.0.1"; } +C{ +#include +}C +} + +varnish v1 -badvcl { 0; } + +varnish v1 -badvcl " sub vcl_recv { { } { " From phk at projects.linpro.no Fri Oct 10 19:55:12 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 21:55:12 +0200 (CEST) Subject: r3280 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010195512.CAE461EC3EC@projects.linpro.no> Author: phk Date: 2008-10-10 21:55:12 +0200 (Fri, 10 Oct 2008) New Revision: 3280 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc Log: More coverage for vcc_backend.c Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 19:40:30 UTC (rev 3279) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 19:55:12 UTC (rev 3280) @@ -1,6 +1,6 @@ # $Id$ -test "VCL: test syntax/semantic checks on backend decls." +test "VCL: test syntax/semantic checks on backend decls. (vcc_backend.c)" # Missing backend varnish v1 -badvcl { @@ -111,3 +111,77 @@ varnish v1 -badvcl { director r1 anarchy { .host = "127.0.0.1"; } } + +varnish v1 -badvcl { + /* too many IP numbers */ + backend b1 { .host = "cnn.com"; } +} + +varnish v1 -vcl { + backend b1 { .host = "////"; } +} + +varnish v1 -vcl { + backend b1 { .host = "127.0.0.1"; .port = "70000"; } +} + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .foobar = "foo"; + } +} + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { + .ice = "vanilla"; + } + } +} + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .window = 8; } + } +} + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .threshold = 65; } + } +} + +varnish v1 -vcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .threshold = 64; } + } +} + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .threshold = 32; .window = 65; } + } +} + + +varnish v1 -vcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .threshold = 32; .window = 64; } + } +} + + +varnish v1 -badvcl { + backend b1 { + .host = "127.0.0.1"; + .probe = { .threshold = 32; .window = 31; } + } +} + From phk at projects.linpro.no Fri Oct 10 20:08:14 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 22:08:14 +0200 (CEST) Subject: r3281 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010200814.DEF951EC204@projects.linpro.no> Author: phk Date: 2008-10-10 22:08:14 +0200 (Fri, 10 Oct 2008) New Revision: 3281 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc Log: sign error Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 19:55:12 UTC (rev 3280) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 20:08:14 UTC (rev 3281) @@ -117,7 +117,7 @@ backend b1 { .host = "cnn.com"; } } -varnish v1 -vcl { +varnish v1 -badvcl { backend b1 { .host = "////"; } } From phk at projects.linpro.no Fri Oct 10 20:39:38 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 22:39:38 +0200 (CEST) Subject: r3282 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010203938.D8BA51EC0D3@projects.linpro.no> Author: phk Date: 2008-10-10 22:39:38 +0200 (Fri, 10 Oct 2008) New Revision: 3282 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc Log: Another sign error. Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 20:08:14 UTC (rev 3281) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-10 20:39:38 UTC (rev 3282) @@ -121,7 +121,7 @@ backend b1 { .host = "////"; } } -varnish v1 -vcl { +varnish v1 -badvcl { backend b1 { .host = "127.0.0.1"; .port = "70000"; } } From phk at projects.linpro.no Fri Oct 10 20:44:14 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 22:44:14 +0200 (CEST) Subject: r3283 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081010204414.79BCE1EC204@projects.linpro.no> Author: phk Date: 2008-10-10 22:44:14 +0200 (Fri, 10 Oct 2008) New Revision: 3283 Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c Log: Instead of assert, issue a error message on VCL compilation returning unexpected result codes. Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-10 20:39:38 UTC (rev 3282) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-10 20:44:14 UTC (rev 3283) @@ -368,7 +368,10 @@ AZ(vsb_overflowed(vsb)); u = varnish_ask_cli(v, vsb_data(vsb), NULL); - assert(u == expect); + if (u != expect) + vtc_log(v->vl, 0, + "VCL compilation got %u expected %u", + u, expect); if (u == CLIS_OK) { vsb_clear(vsb); vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); From phk at projects.linpro.no Fri Oct 10 20:56:06 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 22:56:06 +0200 (CEST) Subject: r3284 - trunk/varnish-cache/lib/libvcl Message-ID: <20081010205606.B65DF1EC0D3@projects.linpro.no> Author: phk Date: 2008-10-10 22:56:06 +0200 (Fri, 10 Oct 2008) New Revision: 3284 Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c Log: Remove redundant error checks. Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-10 20:44:14 UTC (rev 3283) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-10 20:56:06 UTC (rev 3284) @@ -358,8 +358,6 @@ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); - if (tl->err) - break; if (vcc_IdIs(t_field, "url")) { vcc_ProbeRedef(tl, &t_did, t_field); ERRCHK(tl); @@ -519,8 +517,6 @@ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); - if (tl->err) - break; if (vcc_IdIs(t_field, "host")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); From phk at projects.linpro.no Fri Oct 10 20:57:52 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 22:57:52 +0200 (CEST) Subject: r3285 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010205752.1184C1EC3EC@projects.linpro.no> Author: phk Date: 2008-10-10 22:57:51 +0200 (Fri, 10 Oct 2008) New Revision: 3285 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc Log: Test the "week" time unit. Modified: trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc 2008-10-10 20:56:06 UTC (rev 3284) +++ trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc 2008-10-10 20:57:51 UTC (rev 3285) @@ -3,12 +3,20 @@ test "VCL compiler coverage test: vcc_parse.c" varnish v1 -vcl { -backend b { .host = "127.0.0.1"; } -C{ -#include -}C + backend b { .host = "127.0.0.1"; } + C{ + #include + }C } varnish v1 -badvcl { 0; } varnish v1 -badvcl " sub vcl_recv { { } { " + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_fetch { + set obj.ttl = 1w; + } +} + From phk at projects.linpro.no Fri Oct 10 21:13:32 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 23:13:32 +0200 (CEST) Subject: r3286 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010211332.535891EC0D3@projects.linpro.no> Author: phk Date: 2008-10-10 23:13:32 +0200 (Fri, 10 Oct 2008) New Revision: 3286 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc Log: More VCL compiler coverage tests Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-10 20:57:51 UTC (rev 3285) +++ trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-10 21:13:32 UTC (rev 3286) @@ -3,9 +3,42 @@ test "Various VCL compiler coverage tests" varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + include "/dev/null" ; +} +varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } + include "/dev/null" | +} +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + include << +} + +varnish v1 -vcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { + if (req.url == "foo") { + } elsif (req.url == "bar") { + } elseif (req.url == "baz") { + } + } +} + +varnish v1 -badvcl { + /* token test */ + error lookup hash pipe pass fetch deliver discard keep restart + include + if else elseif elsif + ++ -- && || <= == != >= >> << += -= *= /= +} + +varnish v1 -vcl { + + backend b { .host = "127.0.0.1"; } + /* Test string regexp matching and "else if" */ sub vcl_recv { if ((req.url ~ "foobar")) { Modified: trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc 2008-10-10 20:57:51 UTC (rev 3285) +++ trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc 2008-10-10 21:13:32 UTC (rev 3286) @@ -54,4 +54,3 @@ backend b { .host = "127.0.0.1"; } ? } - From phk at projects.linpro.no Fri Oct 10 21:24:53 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 23:24:53 +0200 (CEST) Subject: r3287 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010212453.2D1C61EC204@projects.linpro.no> Author: phk Date: 2008-10-10 23:24:52 +0200 (Fri, 10 Oct 2008) New Revision: 3287 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc Log: More tokens to test Modified: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-10 21:13:32 UTC (rev 3286) +++ trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc 2008-10-10 21:24:52 UTC (rev 3287) @@ -33,6 +33,7 @@ include if else elseif elsif ++ -- && || <= == != >= >> << += -= *= /= + { } ( ) * + - / % > < = ; ! & . | ~ , } varnish v1 -vcl { From phk at projects.linpro.no Fri Oct 10 21:43:02 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 23:43:02 +0200 (CEST) Subject: r3288 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010214302.F40011EC0D3@projects.linpro.no> Author: phk Date: 2008-10-10 23:43:02 +0200 (Fri, 10 Oct 2008) New Revision: 3288 Added: trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc Log: More VCL compiler coverage tests Added: trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc 2008-10-10 21:43:02 UTC (rev 3288) @@ -0,0 +1,52 @@ +# $Id$ + +test "VCL compiler coverage test: vcc_xref.c" + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + sub vcl_recv { set obj.ttl = 1 w; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub foo { set obj.ttl = 1 w; } + sub vcl_recv { call foo ; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub vcl_recv { discard; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub foo { discard; } + sub vcl_recv { call foo; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub foo { call foo; } + sub vcl_recv { call foo; } +} + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub bar { call foo; } + sub foo { call bar; } + sub vcl_recv { call foo; } +} + + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + acl foo { "localhost"; } + +} + From phk at projects.linpro.no Fri Oct 10 21:57:34 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 10 Oct 2008 23:57:34 +0200 (CEST) Subject: r3289 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081010215734.B2BDB1EC3EC@projects.linpro.no> Author: phk Date: 2008-10-10 23:57:34 +0200 (Fri, 10 Oct 2008) New Revision: 3289 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00003.vtc Log: More coverage of vcc_dir_random.c Modified: trunk/varnish-cache/bin/varnishtest/tests/v00003.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00003.vtc 2008-10-10 21:43:02 UTC (rev 3288) +++ trunk/varnish-cache/bin/varnishtest/tests/v00003.vtc 2008-10-10 21:57:34 UTC (rev 3289) @@ -29,3 +29,33 @@ { .backend = {.host = "127.0.0.1";} .weight = k; } } } + +# invalid weight +varnish v1 -badvcl { + director r1 random { + { .backend = {.host = "127.0.0.1";} .weight = 0; } + } +} + +# retries spec +varnish v1 -vcl { + director r1 random { + .retries = 3; + { .backend = {.host = "127.0.0.1";} .weight = 1; } + } +} + +varnish v1 -badvcl { + director r1 random { + .foobar = 3; + { .backend = {.host = "127.0.0.1";} .weight = 1; } + } +} + +varnish v1 -badvcl { + director r1 random { + .retries = x; + { .backend = {.host = "127.0.0.1";} .weight = 1; } + } +} + From phk at projects.linpro.no Sat Oct 11 10:42:05 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 11 Oct 2008 12:42:05 +0200 (CEST) Subject: r3290 - trunk/varnish-cache/bin/varnishd Message-ID: <20081011104205.C1E461EC204@projects.linpro.no> Author: phk Date: 2008-10-11 12:42:05 +0200 (Sat, 11 Oct 2008) New Revision: 3290 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_http.c Log: Decode the HTTP protocol version into a convenient struct http field. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-10-10 21:57:34 UTC (rev 3289) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-10-11 10:42:05 UTC (rev 3290) @@ -137,6 +137,7 @@ unsigned char conds; /* If-* headers present */ enum httpwhence logtag; int status; + double protover; txt hd[HTTP_HDR_MAX]; unsigned char hdf[HTTP_HDR_MAX]; Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-10 21:57:34 UTC (rev 3289) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-11 10:42:05 UTC (rev 3290) @@ -496,6 +496,13 @@ i = http_splitline(sp->wrk, sp->fd, hp, htc, HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO); + hp->protover = 0.9; + if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0")) + hp->protover = 1.0; + else if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) + hp->protover = 1.1; + else + hp->protover = 0.9; if (i != 0) WSPR(sp, SLT_HttpGarbage, htc->rxbuf); From phk at projects.linpro.no Sat Oct 11 11:27:56 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 11 Oct 2008 13:27:56 +0200 (CEST) Subject: r3291 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081011112756.A0AF31EC405@projects.linpro.no> Author: phk Date: 2008-10-11 13:27:56 +0200 (Sat, 11 Oct 2008) New Revision: 3291 Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c Log: Handle HTTP1.0 style "until EOF" data transmissions for 200 responses. Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-11 10:42:05 UTC (rev 3290) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-11 11:27:56 UTC (rev 3291) @@ -305,8 +305,8 @@ * Receive another character */ -static void -http_rxchar(struct http *hp, int n) +static int +http_rxchar_eof(struct http *hp, int n) { int i; struct pollfd pfd[1]; @@ -319,19 +319,31 @@ assert(i > 0); assert(hp->prxbuf < hp->nrxbuf); i = read(hp->fd, hp->rxbuf + hp->prxbuf, n); + if (i == 0) + return (i); assert(i > 0); hp->prxbuf += i; hp->rxbuf[hp->prxbuf] = '\0'; n -= i; } + return (1); } +static void +http_rxchar(struct http *hp, int n) +{ + int i; + + i = http_rxchar_eof(hp, n); + assert(i > 0); +} + /********************************************************************** * Swallow a HTTP message body */ static void -http_swallow_body(struct http *hp, char * const *hh) +http_swallow_body(struct http *hp, char * const *hh, int body) { char *p, *q; int i, l, ll; @@ -344,7 +356,8 @@ hp->body = q = hp->rxbuf + hp->prxbuf; http_rxchar(hp, l); vtc_dump(hp->vl, 4, "body", hp->body); - ll = l; + sprintf(hp->bodylen, "%d", l); + return; } p = http_find_header(hh, "transfer-encoding"); if (p != NULL && !strcmp(p, "chunked")) { @@ -374,7 +387,17 @@ break; } vtc_dump(hp->vl, 4, "body", hp->body); + sprintf(hp->bodylen, "%d", ll); + return; } + if (body) { + hp->body = q = hp->rxbuf + hp->prxbuf; + do { + i = http_rxchar_eof(hp, 1); + ll += i; + } while (i > 0); + vtc_dump(hp->vl, 4, "rxeof", hp->body); + } sprintf(hp->bodylen, "%d", ll); } @@ -433,7 +456,11 @@ vtc_log(hp->vl, 3, "rxresp"); http_rxhdr(hp); http_splitheader(hp, 0); - http_swallow_body(hp, hp->resp); + if (!strcmp(hp->resp[1], "200")) + http_swallow_body(hp, hp->resp, 1); + else + http_swallow_body(hp, hp->resp, 0); + vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } /********************************************************************** @@ -531,7 +558,8 @@ vtc_log(hp->vl, 3, "rxreq"); http_rxhdr(hp); http_splitheader(hp, 1); - http_swallow_body(hp, hp->req); + http_swallow_body(hp, hp->req, 0); + vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); } /********************************************************************** From phk at projects.linpro.no Sat Oct 11 11:28:53 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 11 Oct 2008 13:28:53 +0200 (CEST) Subject: r3292 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081011112853.0B6C11EC405@projects.linpro.no> Author: phk Date: 2008-10-11 13:28:52 +0200 (Sat, 11 Oct 2008) New Revision: 3292 Added: trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: For ESI responses we can only use Chunked encoding for HTTP/1.1 and later. Use EOF-encoding for sessions where the request is lower HTTP protocol versions. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2008-10-11 11:27:56 UTC (rev 3291) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2008-10-11 11:28:52 UTC (rev 3292) @@ -105,6 +105,10 @@ http_FilterFields(sp->wrk, sp->fd, sp->http, sp->obj->http, HTTPH_A_DELIVER); + /* Only HTTP 1.1 can do Chunked encoding */ + if (sp->http->protover < 1.1 && !VTAILQ_EMPTY(&sp->obj->esibits)) + http_Unset(sp->http, H_Transfer_Encoding); + TIM_format(TIM_real(), time_str); http_PrintfHeader(sp->wrk, sp->fd, sp->http, "Date: %s", time_str); @@ -140,7 +144,7 @@ if (sp->wantbody && !VTAILQ_EMPTY(&sp->obj->esibits)) { ESI_Deliver(sp); } else if (sp->wantbody) { - if (sp->esis > 0) { + if (sp->esis > 0 && sp->http->protover >= 1.1) { sprintf(lenbuf, "%x\r\n", sp->obj->len); sp->wrk->acct.hdrbytes += WRK_Write(sp->wrk, lenbuf, -1); @@ -170,7 +174,7 @@ WRK_Write(sp->wrk, st->ptr, st->len); } assert(u == sp->obj->len); - if (sp->esis > 0) + if (sp->esis > 0 && sp->http->protover >= 1.1) WRK_Write(sp->wrk, "\r\n", -1); } if (WRK_Flush(sp->wrk)) Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-11 11:27:56 UTC (rev 3291) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-11 11:28:52 UTC (rev 3292) @@ -802,9 +802,11 @@ VTAILQ_FOREACH(eb, &sp->obj->esibits, list) { if (Tlen(eb->verbatim)) { - WRK_Write(sp->wrk, eb->chunk_length, -1); + if (sp->http->protover >= 1.1) + WRK_Write(sp->wrk, eb->chunk_length, -1); WRK_Write(sp->wrk, eb->verbatim.b, Tlen(eb->verbatim)); - WRK_Write(sp->wrk, "\r\n", -1); + if (sp->http->protover >= 1.1) + WRK_Write(sp->wrk, "\r\n", -1); } if (eb->include.b == NULL || sp->esis >= params->max_esi_includes) @@ -842,7 +844,7 @@ sp->obj = obj; } - if (sp->esis == 0) + if (sp->esis == 0 && sp->http->protover >= 1.1) WRK_Write(sp->wrk, "0\r\n\r\n", -1); } Added: trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc 2008-10-11 11:28:52 UTC (rev 3292) @@ -0,0 +1,46 @@ +# $Id$ + +test "ESI includes for pre HTTP/1.1 cannot used chunked encoding" + +server s1 { + rxreq + expect req.url == "/foo/bar" + txresp -body { + + Before include + + After include + } + rxreq + expect req.url == "/foo/body" + txresp -body { + Included file + } +} -start + +varnish v1 -vcl+backend { + sub vcl_fetch { + esi; + } +} -start + +client c1 { + txreq -url /foo/bar -proto HTTP/1.1 + rxresp + expect resp.status == 200 + expect resp.bodylen == 151 +} -run + +client c1 { + txreq -url /foo/bar -proto HTTP/1.0 + rxresp + expect resp.status == 200 + expect resp.bodylen == 151 +} -run + +client c1 { + txreq -url /foo/bar -proto "" + rxresp + expect resp.status == 200 + expect resp.bodylen == 151 +} -run From tfheen at projects.linpro.no Mon Oct 13 09:21:06 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 13 Oct 2008 11:21:06 +0200 (CEST) Subject: r3293 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081013092106.99BF81EC0D3@projects.linpro.no> Author: tfheen Date: 2008-10-13 11:21:06 +0200 (Mon, 13 Oct 2008) New Revision: 3293 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc Log: Fix up port test It seems like glibc's getaddrinfo is entirely happy to accept 70000 as a valid port, so use something that's not a valid service name so make check still works. Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-11 11:28:52 UTC (rev 3292) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2008-10-13 09:21:06 UTC (rev 3293) @@ -122,7 +122,7 @@ } varnish v1 -badvcl { - backend b1 { .host = "127.0.0.1"; .port = "70000"; } + backend b1 { .host = "127.0.0.1"; .port = "////"; } } varnish v1 -badvcl { From phk at projects.linpro.no Tue Oct 14 09:15:51 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 14 Oct 2008 11:15:51 +0200 (CEST) Subject: r3294 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081014091551.2E9A91EC7D1@projects.linpro.no> Author: phk Date: 2008-10-14 11:15:50 +0200 (Tue, 14 Oct 2008) New Revision: 3294 Modified: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc Log: Expand the -repeat 6 in the server clause, this seems to make the test work reliably on my machine. Also set the reponse text to a recognizable text for improved logreading should it fail again. Modified: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc 2008-10-13 09:21:06 UTC (rev 3293) +++ trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc 2008-10-14 09:15:50 UTC (rev 3294) @@ -2,9 +2,19 @@ test "Check that max_restarts works and that we don't fall over" -server s1 -repeat 6 { +server s1 { rxreq txresp -body "012345\n" + rxreq + txresp -body "012345\n" + rxreq + txresp -body "012345\n" + rxreq + txresp -body "012345\n" + rxreq + txresp -body "012345\n" + rxreq + txresp -body "012345\n" } -start varnish v1 -vcl+backend { @@ -15,10 +25,13 @@ sub vcl_error { if (req.restarts == 2) { set obj.status = 200; + set obj.response = "restart=2"; } elsif (req.restarts > 2) { set obj.status = 501; + set obj.response = "restart>2"; } elsif (req.restarts < 2) { set obj.status = 500; + set obj.response = "restart<2"; } } } -start From phk at projects.linpro.no Tue Oct 14 09:16:33 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 14 Oct 2008 11:16:33 +0200 (CEST) Subject: r3295 - trunk/varnish-cache/bin/varnishd Message-ID: <20081014091633.2DE601EC6CB@projects.linpro.no> Author: phk Date: 2008-10-14 11:16:33 +0200 (Tue, 14 Oct 2008) New Revision: 3295 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_vcl.c Log: nitpicking: Remove two spurious newlines in shmlog messages. Assert that restarts is zero when we begin. Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-14 09:15:50 UTC (rev 3294) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-14 09:16:33 UTC (rev 3295) @@ -465,6 +465,7 @@ */ assert(sp->xid == 0); + assert(sp->restarts == 0); VCA_Prep(sp); /* Record the session watermark */ @@ -1059,7 +1060,7 @@ (void)priv; if (av[2] != NULL) xids = strtoul(av[2], NULL, 0); - cli_out(cli, "XID is %u\n", xids); + cli_out(cli, "XID is %u", xids); } static struct cli_proto debug_cmds[] = { Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-10-14 09:15:50 UTC (rev 3294) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-10-14 09:16:33 UTC (rev 3295) @@ -171,7 +171,7 @@ if (vcl_active == NULL) vcl_active = vcl; UNLOCK(&vcl_mtx); - cli_out(cli, "Loaded \"%s\" as \"%s\"\n", fn , name); + cli_out(cli, "Loaded \"%s\" as \"%s\"", fn , name); vcl->conf->init_func(cli); VSL_stats->n_vcl++; VSL_stats->n_vcl_avail++; From phk at projects.linpro.no Tue Oct 14 20:28:27 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 14 Oct 2008 22:28:27 +0200 (CEST) Subject: r3296 - trunk/varnish-cache/bin/varnishd Message-ID: <20081014202827.1D3AA1EC0D3@projects.linpro.no> Author: phk Date: 2008-10-14 22:28:26 +0200 (Tue, 14 Oct 2008) New Revision: 3296 Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c Log: Checkpoint the shmlog before we wait for a reply from the backend. Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-10-14 09:16:33 UTC (rev 3295) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-10-14 20:28:26 UTC (rev 3296) @@ -362,6 +362,9 @@ return (__LINE__); } + /* Checkpoint the shmlog here */ + WSL_Flush(w, 0); + /* XXX is this the right place? */ VSL_stats->backend_req++; From ingvar at projects.linpro.no Tue Oct 14 23:29:49 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Wed, 15 Oct 2008 01:29:49 +0200 (CEST) Subject: r3297 - trunk/varnish-cache/redhat Message-ID: <20081014232949.F338D1EC0B5@projects.linpro.no> Author: ingvar Date: 2008-10-15 01:29:49 +0200 (Wed, 15 Oct 2008) New Revision: 3297 Modified: trunk/varnish-cache/redhat/README.redhat Log: A note on jemalloc and ppc for the rpm package Modified: trunk/varnish-cache/redhat/README.redhat =================================================================== --- trunk/varnish-cache/redhat/README.redhat 2008-10-14 20:28:26 UTC (rev 3296) +++ trunk/varnish-cache/redhat/README.redhat 2008-10-14 23:29:49 UTC (rev 3297) @@ -40,9 +40,24 @@ To gain actual value from varnish, you may want to move the listening port to port 80, and your webserver to 8080 or similar. +Running with jemalloc on ppc or ppc64 on fedora: Edit and recompile +=================================================================== +To get a package through to Fedora, it has to build in Red Hat's Koji +build environment. Their ppc and ppc64 builders run mock on a RHEL +ppc64 kernel. Our use of jemalloc does not work on this kernel, and +the build stays unsuccessful. As ppc64 is not the primary target of +varnish development, it may take some time to get this bug fixed. +To get the package through to Fedora, jemalloc is disabled in the ppc +and ppc64 builds. +Now, varnish with jemalloc enabled is known to work at least on the +ppc (32bit) kernel in Fedora 9. If you run on ppc, and have a workload +that suits jemalloc better, you might want to change the specfile and +recompile. We would very much like feedback from anyone running +varnish on Fedora's own ppc64 kernel. + Building a RPM package from SVN -============================== +=============================== You may build the package from a svn checkout. Follow the instructions at http://varnish.projects.linpro.no/wiki/Repository to get the source. Then enter the trunk directory and edit From ingvar at projects.linpro.no Tue Oct 14 23:32:15 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Wed, 15 Oct 2008 01:32:15 +0200 (CEST) Subject: r3298 - trunk/varnish-cache/redhat Message-ID: <20081014233215.35CB71EC0D3@projects.linpro.no> Author: ingvar Date: 2008-10-15 01:32:15 +0200 (Wed, 15 Oct 2008) New Revision: 3298 Modified: trunk/varnish-cache/redhat/varnish.spec Log: the infamous jemalloc on ppc/ppc64 workaround Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-14 23:29:49 UTC (rev 3297) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-14 23:32:15 UTC (rev 3298) @@ -1,13 +1,12 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 0.11.rc1%{?dist} +Release: 0.12.20081014svn3295%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ -#Source0: http://varnish.projects.linpro.no/static/varnish-cache.tar.gz +Source0: http://varnish.projects.linpro.no/static/varnish-cache.tar.gz #Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz -Source0: http://downloads.sourceforge.net/varnish/varnish-2.0-rc1.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -63,7 +62,7 @@ %prep #%setup -q -%setup -q -n varnish-2.0-rc1 +%setup -q -n varnish-cache # The svn sources needs to generate a suitable configure script # Release tarballs would not need this @@ -90,7 +89,12 @@ %build # Remove "--disable static" if you want to build static libraries +# jemalloc is not compatible with Red Hat's ppc64 RHEL5 kernel koji server :-( +%ifarch ppc64 ppc +%configure --disable-static --localstatedir=/var/lib --disable-jemalloc +%else %configure --disable-static --localstatedir=/var/lib +%endif # We have to remove rpath - not allowed in Fedora # (This problem only visible on 64 bit arches) @@ -217,6 +221,10 @@ %postun libs -p /sbin/ldconfig %changelog +* Wed Oct 15 2008 Ingvar Hagelund - 2.0-0.12.20081014svn3295 +- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat. +- Synced to upstream again. No more patches needed. + * Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 - 2.0-rc1 released. New upstream sources - Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes From tfheen at projects.linpro.no Wed Oct 15 08:41:38 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 10:41:38 +0200 (CEST) Subject: r3299 - trunk/varnish-cache Message-ID: <20081015084138.A408E1EC7C4@projects.linpro.no> Author: tfheen Date: 2008-10-15 10:41:38 +0200 (Wed, 15 Oct 2008) New Revision: 3299 Modified: trunk/varnish-cache/ChangeLog Log: Add note to changelog saying it's no longer updated. also, add pointer to doc/ directory. Fixes: #353 Modified: trunk/varnish-cache/ChangeLog =================================================================== --- trunk/varnish-cache/ChangeLog 2008-10-14 23:32:15 UTC (rev 3298) +++ trunk/varnish-cache/ChangeLog 2008-10-15 08:41:38 UTC (rev 3299) @@ -1,3 +1,7 @@ + +Please note that this file is no longer maintained. Please refer to the +changes files in doc/ + Change log for Varnish 1.0.4 Changes between 1.0.3 and 1.0.4 From tfheen at projects.linpro.no Wed Oct 15 09:52:15 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 11:52:15 +0200 (CEST) Subject: r3300 - in trunk/varnish-cache: . bin/varnishd bin/varnishncsa bin/varnishtest/tests etc lib/libjemalloc lib/libvarnish lib/libvcl redhat Message-ID: <20081015095215.B20901EC45F@projects.linpro.no> Author: tfheen Date: 2008-10-15 11:52:15 +0200 (Wed, 15 Oct 2008) New Revision: 3300 Modified: trunk/varnish-cache/ChangeLog trunk/varnish-cache/INSTALL trunk/varnish-cache/LICENSE trunk/varnish-cache/README trunk/varnish-cache/bin/varnishd/c.sh trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c trunk/varnish-cache/bin/varnishd/cache_backend_poll.c trunk/varnish-cache/bin/varnishd/cache_backend_poll.h trunk/varnish-cache/bin/varnishd/flint.lnt trunk/varnish-cache/bin/varnishd/flint.sh trunk/varnish-cache/bin/varnishd/s.sh trunk/varnish-cache/bin/varnishd/storage_synth.c trunk/varnish-cache/bin/varnishd/storage_umem.c trunk/varnish-cache/bin/varnishd/vclflint.lnt trunk/varnish-cache/bin/varnishd/vclflint.sh trunk/varnish-cache/bin/varnishncsa/flint.lnt trunk/varnish-cache/bin/varnishncsa/flint.sh trunk/varnish-cache/bin/varnishtest/tests/a00009.vtc trunk/varnish-cache/bin/varnishtest/tests/b00016.vtc trunk/varnish-cache/bin/varnishtest/tests/b00017.vtc trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc trunk/varnish-cache/bin/varnishtest/tests/c00018.vtc trunk/varnish-cache/bin/varnishtest/tests/e00009.vtc trunk/varnish-cache/bin/varnishtest/tests/e00010.vtc trunk/varnish-cache/bin/varnishtest/tests/e00011.vtc trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc trunk/varnish-cache/bin/varnishtest/tests/r00292.vtc trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc trunk/varnish-cache/bin/varnishtest/tests/r00318.vtc trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc trunk/varnish-cache/bin/varnishtest/tests/v00012.vtc trunk/varnish-cache/bin/varnishtest/tests/v00013.vtc trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc trunk/varnish-cache/bin/varnishtest/tests/v00015.vtc trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc trunk/varnish-cache/etc/zope-plone.vcl trunk/varnish-cache/lib/libjemalloc/Makefile.am trunk/varnish-cache/lib/libjemalloc/README trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c trunk/varnish-cache/lib/libjemalloc/malloc.3 trunk/varnish-cache/lib/libjemalloc/malloc.c trunk/varnish-cache/lib/libjemalloc/rb.h trunk/varnish-cache/lib/libvarnish/flint.lnt trunk/varnish-cache/lib/libvarnish/flint.sh trunk/varnish-cache/lib/libvcl/flint.lnt trunk/varnish-cache/lib/libvcl/flint.sh trunk/varnish-cache/redhat/README.redhat trunk/varnish-cache/redhat/TODO trunk/varnish-cache/redhat/varnish.initrc trunk/varnish-cache/redhat/varnish.logrotate trunk/varnish-cache/redhat/varnish.spec trunk/varnish-cache/redhat/varnish.sysconfig trunk/varnish-cache/redhat/varnishlog.initrc trunk/varnish-cache/redhat/varnishncsa.initrc trunk/varnish-cache/varnishapi.pc.in Log: Set svn:keywords for all files Property changes on: trunk/varnish-cache/ChangeLog ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/INSTALL ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/LICENSE ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/README ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/c.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-15 09:52:15 UTC (rev 3300) @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cache_backend_cfg.c 2905 2008-07-08 10:09:03Z phk $ + * $Id$ * * Poll backends for collection of health statistics * Property changes on: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/cache_backend_poll.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/flint.lnt ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/flint.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/s.sh ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/storage_synth.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_synth.c 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishd/storage_synth.c 2008-10-15 09:52:15 UTC (rev 3300) @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: storage_malloc.c 2955 2008-07-19 09:24:07Z phk $ + * $Id$ * * Storage method for synthetic content, based on vsb. */ Property changes on: trunk/varnish-cache/bin/varnishd/storage_synth.c ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishd/storage_umem.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-15 09:52:15 UTC (rev 3300) @@ -26,7 +26,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: storage_umem.c 3036 2008-07-31 09:24:25Z phk $ + * $Id$ * * Storage method based on umem_alloc(3MALLOC) */ Property changes on: trunk/varnish-cache/bin/varnishd/storage_umem.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/vclflint.lnt ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishd/vclflint.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishncsa/flint.lnt ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishncsa/flint.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/a00009.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/b00016.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/b00017.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/b00018.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: c00016.vtc 3012 2008-07-24 12:22:35Z des $ +# $Id$ test "Test Backend Polling" Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00017.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00018.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/e00009.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/e00009.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/e00009.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: e00008.vtc 3012 2008-07-24 12:22:35Z des $ +# $Id$ test "ESI binary detector" Property changes on: trunk/varnish-cache/bin/varnishtest/tests/e00009.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/e00010.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/e00010.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/e00010.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: e00008.vtc 3012 2008-07-24 12:22:35Z des $ +# $Id$ test "Ignoring non esi elements" Property changes on: trunk/varnish-cache/bin/varnishtest/tests/e00010.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/e00011.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/e00012.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00292.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: v00007.vtc 3060 2008-08-01 12:44:53Z phk $ +# $Id$ test "Regression test for ticket #306, random director ignoring good backend" Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00306.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00318.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: e00008.vtc 3012 2008-07-24 12:22:35Z des $ +# $Id$ test "No zerolength verbatim before " Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00326.vtc ___________________________________________________________________ Name: svn:keywords + Id Modified: trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc 2008-10-15 08:41:38 UTC (rev 3299) +++ trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc 2008-10-15 09:52:15 UTC (rev 3300) @@ -1,4 +1,4 @@ -# $Id: c00016.vtc 3012 2008-07-24 12:22:35Z des $ +# $Id$ test "Test vcl purging" Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00012.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00013.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00014.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00015.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00016.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00019.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00020.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/etc/zope-plone.vcl ___________________________________________________________________ Name: svn:keywords - id + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/Makefile.am ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/README ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/malloc.3 ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/malloc.c ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libjemalloc/rb.h ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/flint.lnt ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvarnish/flint.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvcl/flint.lnt ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/lib/libvcl/flint.sh ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/README.redhat ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/TODO ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnish.initrc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnish.logrotate ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnish.spec ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnish.sysconfig ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnishlog.initrc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/redhat/varnishncsa.initrc ___________________________________________________________________ Name: svn:keywords + Id Property changes on: trunk/varnish-cache/varnishapi.pc.in ___________________________________________________________________ Name: svn:keywords + Id From tfheen at projects.linpro.no Wed Oct 15 11:29:25 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 13:29:25 +0200 (CEST) Subject: r3301 - trunk/varnish-cache/doc Message-ID: <20081015112925.6BB831EC45F@projects.linpro.no> Author: tfheen Date: 2008-10-15 13:29:25 +0200 (Wed, 15 Oct 2008) New Revision: 3301 Added: trunk/varnish-cache/doc/changes-2.0.xml Modified: trunk/varnish-cache/doc/Makefile.am Log: Changelog for 2.0 Write up changelog for 2.0 Modified: trunk/varnish-cache/doc/Makefile.am =================================================================== --- trunk/varnish-cache/doc/Makefile.am 2008-10-15 09:52:15 UTC (rev 3300) +++ trunk/varnish-cache/doc/Makefile.am 2008-10-15 11:29:25 UTC (rev 3301) @@ -1,12 +1,14 @@ # $Id$ CHANGELOGS = \ + changes-2.0.html \ changes-1.1.2.html \ changes-1.1.1.html \ changes-1.1.html \ changes-1.0.4.html XML = \ + changes-1.1.2-2.0.xml \ changes-1.1.1-1.1.2.xml \ changes-1.1-1.1.1.xml \ changes-1.0.4-1.1.xml \ Added: trunk/varnish-cache/doc/changes-2.0.xml =================================================================== --- trunk/varnish-cache/doc/changes-2.0.xml (rev 0) +++ trunk/varnish-cache/doc/changes-2.0.xml 2008-10-15 11:29:25 UTC (rev 3301) @@ -0,0 +1,12 @@ + + + +]> + + + Varnish + 2.0 + + + From ingvar at projects.linpro.no Wed Oct 15 15:38:09 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Wed, 15 Oct 2008 17:38:09 +0200 (CEST) Subject: r3302 - trunk/varnish-cache/redhat Message-ID: <20081015153809.3C8E01EC0B5@projects.linpro.no> Author: ingvar Date: 2008-10-15 17:38:09 +0200 (Wed, 15 Oct 2008) New Revision: 3302 Modified: trunk/varnish-cache/redhat/varnish.spec Log: final specfile changes for 2.0 Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-15 11:29:25 UTC (rev 3301) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-15 15:38:09 UTC (rev 3302) @@ -1,12 +1,11 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 0.12.20081014svn3295%{?dist} +Release: 1{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ -Source0: http://varnish.projects.linpro.no/static/varnish-cache.tar.gz -#Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz +Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -61,8 +60,8 @@ #Varnish is a high-performance HTTP accelerator %prep -#%setup -q -%setup -q -n varnish-cache +%setup -q +#%setup -q -n varnish-cache # The svn sources needs to generate a suitable configure script # Release tarballs would not need this @@ -221,7 +220,8 @@ %postun libs -p /sbin/ldconfig %changelog -* Wed Oct 15 2008 Ingvar Hagelund - 2.0-0.12.20081014svn3295 +* Wed Oct 15 2008 Ingvar Hagelund - 2.0-1 +- 2.0 released. New upstream sources - Disabled jemalloc on ppc and ppc64. Added a note in README.redhat. - Synced to upstream again. No more patches needed. From tfheen at projects.linpro.no Wed Oct 15 18:36:29 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 20:36:29 +0200 (CEST) Subject: r3303 - trunk/varnish-cache/doc Message-ID: <20081015183629.D5AEE1EC5D4@projects.linpro.no> Author: tfheen Date: 2008-10-15 20:36:29 +0200 (Wed, 15 Oct 2008) New Revision: 3303 Added: trunk/varnish-cache/doc/changes-1.1.2-2.0.xml Log: Add missing changelog file Added: trunk/varnish-cache/doc/changes-1.1.2-2.0.xml =================================================================== --- trunk/varnish-cache/doc/changes-1.1.2-2.0.xml (rev 0) +++ trunk/varnish-cache/doc/changes-1.1.2-2.0.xml 2008-10-15 18:36:29 UTC (rev 3303) @@ -0,0 +1,199 @@ + + +]> + + + + varnishd + + + Only look for sendfile on platforms where we know how to + use it, which is FreeBSD for now. + + + + Make it possible to adjust the shared memory log size and + bump the size from 8MB to 80MB. + + + + Fix up the handling of request bodies to better match + what RFC2616 mandates. This makes PUT, DELETE, OPTIONS and + TRACE work in addition to POST. + + + + Change how backends are defined, to a constant structural + defintion style. See + http://varnish.projects.linpro.no/wiki/VclSyntaxChanges for the + details. + + + + Add directors, which wrap backends. Currently, there's a + random director and a round-robin director. + + + + Add "grace", which is for how long and object will be + served, even after it has expired. To use this, both the + object's and the request's grace parameter need + to be set. + + + + Manual pages have been updated for new VCL syntax and + varnishd options. + + + + Man pages and other docs have been updated. + + + + The shared memory log file is now locked in memory, so it + should not be paged out to disk. + + + + We now handle Vary correctly, as well as Expect. + + + + ESI include support is implemented. + + + + Make it possible to limit how much memory the malloc uses. + + + + Solaris is now supported. + + + + There is now a regsuball function, which + works like regsub except it replaces all + occurences of the regex, not just the first. + + + + Backend and director declarations can have + a .connect_timeout parameter, which tells us how + long to wait for a successful connection. + + + + It is now possible to select the acceptor to use by + changing the acceptor parameter. + + + + Backends can have probes associated with them, which can + be checked with req.backend.health in VCL as well as + being handled by directors which do load-balancing. + + + + Support larger-than-2GB files also on 32 bit hosts. + Please note that this does not mean we can support caches + bigger than 2GB, it just means logfiles and similar can be + bigger. + + + + In some cases, we would remove the wrong header when we + were stripping Content-Transfer-Encoding headers from a + request. This has been fixed. + + + + Backends can have a .max_connections + associated with them. + + + + On Linux, we need to set the dumpable bit on the child if + we want core dumps. Make sure it's set. + + + + Doing purge.hash() with an empty string + would cause us to dump core. Fixed so we don't do that any + more. + + + + We ran into a problem with glibc's malloc on Linux where + it seemed like it failed to ever give memory back to the OS, + causing the system to swap. We have now switched to jemalloc + which appears not to have this problem. + + + + max_restarts was never checked, so we always + ended up running out of workspace. Now, vcl_error + is called when we reach max_restarts. + + + + varnishtest + + + varnishtest is a tool to do correctness tests + of varnishd. The test suite is run by using make + check. + + + + + varnishtop + + + We now set the field widths dynamically based on the size + of the terminal and the name of the longest field. + + + + + varnishstat + + + varnishstat -1 now displays the uptime too. + + + + + varnishncsa + + + varnishncsa now does fflush after each + write. This makes tail -f work correctly, as well + as avoiding broken lines in the log file. + + + + It is possible to get varnishncsa to output + the X-Forwarded-For instead of the client IP by + passing -f to it. + + + + + Build system + + + Various sanity checks have been added + to configure, it now complains about no ncurses or + if SO_RCVTIMEO or SO_SNDTIMEO are non-functional. It also + aborts if there's no working acceptor mechanism + + + + The C compiler invocation is decided by the configure + script and can now be overridden by passing VCC_CC + when running configure. + + + From tfheen at projects.linpro.no Wed Oct 15 18:36:33 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 20:36:33 +0200 (CEST) Subject: r3304 - trunk/varnish-cache/doc Message-ID: <20081015183633.31D3B1EC7CC@projects.linpro.no> Author: tfheen Date: 2008-10-15 20:36:33 +0200 (Wed, 15 Oct 2008) New Revision: 3304 Added: trunk/varnish-cache/doc/getting-started.html Modified: trunk/varnish-cache/doc/Makefile.am Log: Add HTML version of getting started guide Thanks to cby for fixing this up and HTMLising it. Modified: trunk/varnish-cache/doc/Makefile.am =================================================================== --- trunk/varnish-cache/doc/Makefile.am 2008-10-15 18:36:29 UTC (rev 3303) +++ trunk/varnish-cache/doc/Makefile.am 2008-10-15 18:36:33 UTC (rev 3304) @@ -18,7 +18,8 @@ all: ${CHANGELOGS} EXTRA_DIST = ${CHANGELOGS} ${XML} \ - changes.css changes-html.xsl + changes.css changes-html.xsl \ + getting-started.html CLEANFILES = ${CHANGELOGS} Added: trunk/varnish-cache/doc/getting-started.html =================================================================== --- trunk/varnish-cache/doc/getting-started.html (rev 0) +++ trunk/varnish-cache/doc/getting-started.html 2008-10-15 18:36:33 UTC (rev 3304) @@ -0,0 +1,509 @@ +

Getting started with Varnish 2.0

+ +

Welcome!

+ +

Welcome to the wonders of Varnish 2.0. Hopefully you will be up and +running in no-time after a quick walkthrough of this document.

+ +

Installing Varnish

+ +

You can download Varnish packages for the major Linux +distributions, such as Redhat, Suse and Debian from the Varnish +website. For other Linux distributions, FreeBSD and other supported +platforms, Varnish must be compiled and installed +from Sourceforge.. + +

The sample installation in this walkthrough is based on a FreeBSD +installation from source.

+ +

For installation instructions on other operating systems, please +visit the website, where we currently have the following +available:

+ + + +

Prerequisites

+ +

Make sure you have the following accessible when you are installing +your copy of Varnish.

+ +
    +
  • A working command-line knowledge of your chosen OS
  • +
  • A recent version of GCC (3.3.x or newer should be fine, 4.2.1 or newer recommended)
  • +
  • A POSIX-compatible make (GNU make is fine)
  • +
  • A release tarball from Sourceforge
  • +
+ +

Installing Varnish from source on FreeBSD

+ +

First , run configure. In most cases, the defaults are correct and you do not need to specify any command-line options, except perhaps?prefix. If you plan on hacking the Varnish sources, however, you will most likely want to turn on stricter error checks and dependency tracking: +

+$ ./configure --enable-debugging-symbols --enable-developer-warnings --enable-dependency-tracking + +
    + +
  • If you have gcc 4.2.0 or newer, + add --enable-extra-warnings to get additional + compile-time warnings
  • +
  • If you have a version of gcc with stack protection, + add --enable-stack-protector to enable run-time stack + smashing detection
  • +
  • If you?re trying to track down an elusive bug or a race + condition, --enable-diagnostics may help, but it will + reduce performance and increase the amount of log data + generated
  • +
  • If configure completes without any errors, simply + run make to compile Varnish and make + install to install it.
  • +
  • Start Varnish by typing: varnishd -f + /etc/varnish/default.vcl
  • +
+ +

Configuring your Varnish installation

+ +

The Varnish daemon is configured by using command line options and +the powerful Varnish Configuration Language (VCL). The location of the +default VCL configuration file and the command line options varies, +depending on which platform you have installed Varnish.

+ +

Command line options

+ +

The command line options configure the basics of the Varnish +daemon, like the listen address and port, which VCL script to use and +the working directory. The following options can be set:

+ + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
CommandFunctionComment
-a address:port HTTP listen address and port?
-b address:port backend address and port?
?? -b <hostname_or_ip>
?? -b '<hostname_or_ip>:<port_or_service>'
+-d debug?
-f file VCL scriptThe -f option points to the VCL script to use. If it is omitted, the -b option must be used to define a backend to use with the default configuration.
-F Run in foreground?
-h kind[,hashoptions] Hash specification?
?? -h simple_list. Do not use ? for debug only
?? -h classic [default]
?? -h classic,<buckets>
-l bytesize Size of shared memory log?
-n dir varnishd working directory?
-P file PID file?
-p param=value set parameter?
-s kind[,storageoptions] Backend storage specification?
?? -s malloc
?? -s file [default: use /tmp]
?? -s file,<dir_or_file>
?? -s file,<dir_or_file>,<size>
?? -s file,<dir_or_file>,%lt;size>,<granularity>
-t Default TTL?
-T address:port Telnet listen address and portTo +enable the command-line management interface, the -T option must be +used. This will enable telneting to the defined port to pass commands +to the running Varnish daemon either using varnishadm or use telnet +directly to the port to access the command-line interface.
-V version?
-w int[,int[,int]] Number of worker threads?
?? -w <fixed_count>
?? -w min,max
?? -w min,max,timeout [default: -w2,500,300]
-u user Priviledge separation user id?
+ +

VCL

+ +

VCL is a small, domain-specific language used to define request + handling and document caching policies for the Varnish HTTP + accelerator. Some of its features are:

+
    +
  • Simple syntax, similar to that of Perl and C
  • +
  • Access to request-manipulation
  • +
  • Regular expressions for matching
  • +
  • User defined sub-routines
  • +
  • Access control lists
  • +
+ + +

The VCL configuration mainly consists of the backend and ACL + definitions, in addition to a number of special sub-routines which + hook into the Varnish workflow. These sub-routines may inspect and + manipulate HTTP headers and various other aspects of each request, + and to a certain extent decide how the request should be handled. + +

The direction in the workflow is determined in each sub-routine by + a given keyword.

+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FunctionDescriptionPossible keywords
vcl_recvCalled after receiving a request. Decides how to serve the request error, pass, pipe
vcl_pipeCalled after entering pipe mode.Creates a direct connection between the client and the backend, bypassing Varnish all together. error, pipe
vcl_passCalled +after entering pass mode. Unlike pipe mode, only the current request +bypasses Varnish. Subsequent requests for the same connection are +handled normally. error, pass
vcl_hashCalled when computing the hash key for an object.hash
vcl_hitCalled after a cache hit.error, pass, deliver
vcl_missCalled after a cache miss.error, pass, fetch
vcl_fetchCalled +after a successful retrieval from the backend. An ?insert? will add the +retrieved object in the cache and then continue to vcl_delivererror, pass, insert
vcl_deliverCalled before the cached object is delivered to the client.error, deliver
vcl_timeoutCalled +by the reaper thread shortly before an object expires in the cache +?discard? will discard the object and ?fetch? will retrieve a fresh copydiscard, fetch
vcl_discardCalled by the reaper thread when a cached object is about to be discarded due to expiration or space is running lowdiscard, keep
+ + +

Varnish ships with a default configuration +( default.vcl in /etc/varnish ), so you won?t have to +define all the subroutines yourself. This default file is set up to +work straight out of the box after you have defined a backend. Please +note that default subroutines will be invoked should the custom +configuration not terminate with a keyword + +

Defining a backend and the use of directors

+ +

A backend can either be set by using the -b command line option, or +by defining it in the VCL configuration file. A backend declaration in +VCL is defined like this:

+ +
+backend www {
+	.host = "www.example.com";
+	.port = "http";
+}
+
+ +

The backend object can later be used to select a backend at request time:

+ +
+if (req.http.host ~ "^example.com$") {
+	set req.backend = www;
+}
+
+ +

If there are several backends delivering the same content, they can +be grouped together using a director declaration:

+ +
+director www-director round-robin {
+	{ .backend = www; }
+	{ .backend = { .host = "www2.example.com"; .port = "http"; } }
+}
+
+ +

A director will choose one of the defined backend depending on its +policy. A ?random? director will choose a random backend, biased by a +weight for each backend, and a ?round-robin? backend will choose a +backend in a round robin fashion. The director object can be used in +the same way as the backend object for selecting a backend:

+ +
+if (req.http.host ~ "^(www.)\.example\.com$") {
+	set req.backend = www-director;
+}
+
+ +

Access Control Lists

+ +

An Access Control List (ACL) declaration creates and initializes a +named access control list which can later be used to match client +addresses:

+ +
+acl local 
+	{ 
+		"localhost"; /* myself */ 
+		"192.0.2.0"/24; /* and everyone on the local network */
+		! "192.0.2.23"; /* except for the dialin router */ 
+	} 
+
+ +

To match an IP address against an ACL, use the match operator:

+
+if (client.ip ~ local) { pipe; }
+
+ +

Examples

+ +As mentioned, Varnish ships ships with a default set of subroutines +which hook themselves up to what you define.These subroutines will be +processed subsequently, provided they are not explicitly terminated in +the custom VCL. Tuning is an important part of implementing a +cache-solution, and a custom configuration will probably be +needed. Here are some examples to get you going - also note that +irc.linpro.no #varnish is a great place to get help and to discuss all +things Varnish: + +

Selecting a backend based on the type of document

+

- this can be done with the regular expression matching operator.

+ +
+sub vcl_recv {
+	if (req.url ~ "\.(gif|jpg|swf|css|j)$")	{
+		unset req.http.cookie;
+		unset req.http.authenticate;
+		set req.backend = b1;
+	} else {
+		set req.backend = b2;
+	}
+}
+
+ +

h3. Retrying with another backend if one backend reports a non-200 response.

+
+sub vcl_recv {
+	if (req.restarts == 0) {
+		set req.backend = b1;
+	} else {
+		set req.backend = b2;
+	}
+}
+
+sub vcl_fetch {
+	if (obj.status != 200) {
+		restart;
+	}
+}
+
+ +

Preventing search engines from populating the cache with old documents

- +

This can be done by checking the user-agent header in the HTTP request.

+ +
+sub vcl_miss {
+	if (req.http.user-agent ~ "spider") {
+		error 503 "Not presently in cache";
+	}
+}
+
+ +

For more examples, please visit our wiki at http://www.varnish-cache.org.

+ +

Varnish tools

+

Varnish has a set of command line tools and utilities to monitor and administer Varnish. These are:

+
    +
  • varnishncsa: Displays the varnishd shared memory logs in Apache / NCSA combined log format
  • +
  • varnishlog: Reads and presents varnishd shared memory logs.
  • +
  • varnishstat: Displays statistics from a running varnishd instance.
  • +
  • varnishadm: Sends a command to the running varnishd instance.
  • +
  • varnishhist: Reads varnishd shared memory logs and presents a continuously updated histogram showing the distribution of the last N requests by their processing.
  • +
  • varnishtop: Reads varnishd shared memory logs and presents a continuously updated list of the most commonly occurring log entries.
  • +
  • varnishreplay: Parses varnish logs and attempts to reproduce the traffic.
  • +
+ +

For further information and example of usage, please refer to the man-pages.

+ +

Further documentation

+ +

The project web site is a good source for information about +Varnish, with updated news, mailings lists, how-to's, troubleshooting +tips, and more. The web site is located +at http://www.varnish-cache.org. For +on-line reference manual, man-pages exists for both the VCL language +as well as all the Varnish command line tools.

From tfheen at projects.linpro.no Wed Oct 15 18:45:48 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 20:45:48 +0200 (CEST) Subject: r3305 - branches Message-ID: <20081015184548.01B001EC7CC@projects.linpro.no> Author: tfheen Date: 2008-10-15 20:45:47 +0200 (Wed, 15 Oct 2008) New Revision: 3305 Added: branches/2.0/ Log: Branch 2.0 Copied: branches/2.0 (from rev 3304, trunk) From tfheen at projects.linpro.no Wed Oct 15 18:49:11 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 20:49:11 +0200 (CEST) Subject: r3306 - branches/2.0/varnish-cache Message-ID: <20081015184911.7D7F81EC5D4@projects.linpro.no> Author: tfheen Date: 2008-10-15 20:49:11 +0200 (Wed, 15 Oct 2008) New Revision: 3306 Modified: branches/2.0/varnish-cache/configure.ac Log: Change configure.ac for 2.0 release Modified: branches/2.0/varnish-cache/configure.ac =================================================================== --- branches/2.0/varnish-cache/configure.ac 2008-10-15 18:45:47 UTC (rev 3305) +++ branches/2.0/varnish-cache/configure.ac 2008-10-15 18:49:11 UTC (rev 3306) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [2.0], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at projects.linpro.no Wed Oct 15 18:54:22 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 15 Oct 2008 20:54:22 +0200 (CEST) Subject: r3307 - tags Message-ID: <20081015185422.566BA1EC0B5@projects.linpro.no> Author: tfheen Date: 2008-10-15 20:54:22 +0200 (Wed, 15 Oct 2008) New Revision: 3307 Added: tags/varnish-2.0/ Log: Release Varnish 2.0 Copied: tags/varnish-2.0 (from rev 3306, branches/2.0) From phk at projects.linpro.no Wed Oct 15 21:28:15 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Wed, 15 Oct 2008 23:28:15 +0200 (CEST) Subject: r3308 - trunk/varnish-cache/lib/libvcl Message-ID: <20081015212815.603CB1EC45F@projects.linpro.no> Author: phk Date: 2008-10-15 23:28:15 +0200 (Wed, 15 Oct 2008) New Revision: 3308 Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c Log: Fix an off-by one error in ACL compilation. Should be merged into 2.0 Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-15 18:54:22 UTC (rev 3307) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-15 21:28:15 UTC (rev 3308) @@ -397,7 +397,7 @@ Fh(tl, 0, "\t%*s%sif ((a[%d] & 0x%x) == %d) {\n", -i, "", oc, - i, (0xff00 >> m) & 0xff, + i - 1, (0xff00 >> m) & 0xff, ae->data[i] & ((0xff00 >> m) & 0xff)); at[i] = 256; depth = i; From ingvar at projects.linpro.no Thu Oct 16 08:51:16 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Thu, 16 Oct 2008 10:51:16 +0200 (CEST) Subject: r3309 - trunk/varnish-cache/redhat Message-ID: <20081016085116.130C91EC0B5@projects.linpro.no> Author: ingvar Date: 2008-10-16 10:51:15 +0200 (Thu, 16 Oct 2008) New Revision: 3309 Modified: trunk/varnish-cache/redhat/varnish.spec Log: st00pid typo Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-15 21:28:15 UTC (rev 3308) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-16 08:51:15 UTC (rev 3309) @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 1{?dist} +Release: 1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ From tfheen at projects.linpro.no Thu Oct 16 09:08:58 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Thu, 16 Oct 2008 11:08:58 +0200 (CEST) Subject: r3310 - branches/2.0/varnish-cache/lib/libvcl Message-ID: <20081016090858.194991EC815@projects.linpro.no> Author: tfheen Date: 2008-10-16 11:08:57 +0200 (Thu, 16 Oct 2008) New Revision: 3310 Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_acl.c Log: Merge 3308 from trunk Modified: branches/2.0/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- branches/2.0/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-16 08:51:15 UTC (rev 3309) +++ branches/2.0/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-16 09:08:57 UTC (rev 3310) @@ -397,7 +397,7 @@ Fh(tl, 0, "\t%*s%sif ((a[%d] & 0x%x) == %d) {\n", -i, "", oc, - i, (0xff00 >> m) & 0xff, + i - 1, (0xff00 >> m) & 0xff, ae->data[i] & ((0xff00 >> m) & 0xff)); at[i] = 256; depth = i; From tfheen at projects.linpro.no Thu Oct 16 09:09:17 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Thu, 16 Oct 2008 11:09:17 +0200 (CEST) Subject: r3311 - branches/2.0/varnish-cache/redhat Message-ID: <20081016090917.895F51EC0B5@projects.linpro.no> Author: tfheen Date: 2008-10-16 11:09:16 +0200 (Thu, 16 Oct 2008) New Revision: 3311 Modified: branches/2.0/varnish-cache/redhat/varnish.spec Log: Merge 3309 from trunk Modified: branches/2.0/varnish-cache/redhat/varnish.spec =================================================================== --- branches/2.0/varnish-cache/redhat/varnish.spec 2008-10-16 09:08:57 UTC (rev 3310) +++ branches/2.0/varnish-cache/redhat/varnish.spec 2008-10-16 09:09:16 UTC (rev 3311) @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 1{?dist} +Release: 1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ From phk at projects.linpro.no Thu Oct 16 10:32:48 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 16 Oct 2008 12:32:48 +0200 (CEST) Subject: r3312 - trunk/varnish-cache/bin/varnishd Message-ID: <20081016103248.9EC621EC5D4@projects.linpro.no> Author: phk Date: 2008-10-16 12:32:47 +0200 (Thu, 16 Oct 2008) New Revision: 3312 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Allow "true" and "false" as settings for booleans Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-16 09:09:16 UTC (rev 3311) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-16 10:32:47 UTC (rev 3312) @@ -122,12 +122,16 @@ *dest = 0; else if (!strcasecmp(arg, "no")) *dest = 0; + else if (!strcasecmp(arg, "false")) + *dest = 0; else if (!strcasecmp(arg, "on")) *dest = 1; else if (!strcasecmp(arg, "enable")) *dest = 1; else if (!strcasecmp(arg, "yes")) *dest = 1; + else if (!strcasecmp(arg, "true")) + *dest = 1; else { cli_out(cli, "use \"on\" or \"off\"\n"); cli_result(cli, CLIS_PARAM); From ingvar at projects.linpro.no Thu Oct 16 13:36:47 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Thu, 16 Oct 2008 15:36:47 +0200 (CEST) Subject: r3313 - trunk/varnish-cache/redhat Message-ID: <20081016133647.C2B501EC815@projects.linpro.no> Author: ingvar Date: 2008-10-16 15:36:47 +0200 (Thu, 16 Oct 2008) New Revision: 3313 Modified: trunk/varnish-cache/redhat/varnish.spec Log: * Thu Oct 16 2008 Ingvar Hagelund - 2.0-2 - Readded the debugflag patch. It's so practical - Added a strange workaround for make check on ppc64 Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-16 10:32:47 UTC (rev 3312) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-16 13:36:47 UTC (rev 3313) @@ -1,11 +1,12 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish Version: 2.0 -Release: 1%{?dist} +Release: 2%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz +Patch0: varnish.varnishtest_debugflag.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -63,6 +64,8 @@ %setup -q #%setup -q -n varnish-cache +%patch0 -p0 + # The svn sources needs to generate a suitable configure script # Release tarballs would not need this #./autogen.sh @@ -122,6 +125,13 @@ %endif %check +# rhel5 on ppc64 is just too strange +%ifarch ppc64 + %if 0%{?rhel} > 4 + cp bin/varnishd/.libs/varnishd bin/varnishd/lt-varnishd + %endif +%endif + LD_LIBRARY_PATH="lib/libvarnish/.libs:lib/libvarnishcompat/.libs:lib/libvarnishapi/.libs:lib/libvcl/.libs" bin/varnishd/varnishd -b 127.0.0.1:80 -C -n /tmp/foo %{__make} check LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcl/.libs" @@ -220,6 +230,10 @@ %postun libs -p /sbin/ldconfig %changelog +* Thu Oct 16 2008 Ingvar Hagelund - 2.0-2 +- Readded the debugflag patch. It's so practical +- Added a strange workaround for make check on ppc64 + * Wed Oct 15 2008 Ingvar Hagelund - 2.0-1 - 2.0 released. New upstream sources - Disabled jemalloc on ppc and ppc64. Added a note in README.redhat. From petter at projects.linpro.no Fri Oct 17 07:00:03 2008 From: petter at projects.linpro.no (petter at projects.linpro.no) Date: Fri, 17 Oct 2008 09:00:03 +0200 (CEST) Subject: r3314 - trunk/varnish-cache/bin/varnishreplay Message-ID: <20081017070003.601F51EC7C4@projects.linpro.no> Author: petter Date: 2008-10-17 09:00:02 +0200 (Fri, 17 Oct 2008) New Revision: 3314 Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Increased the stack size from 16K to 32K for the threads as it caused seg.fault. on Linux when writing formated to stderr (stdout worked). Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-16 13:36:47 UTC (rev 3313) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-17 07:00:02 UTC (rev 3314) @@ -743,7 +743,8 @@ signal(SIGPIPE, SIG_IGN); pthread_attr_init(&thread_attr); - pthread_attr_setstacksize(&thread_attr, 16384); + /* XXX: seting the stack size manually reduces the memory usasage and increases speed */ + pthread_attr_setstacksize(&thread_attr, 32768); while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) /* nothing */ ; From phk at projects.linpro.no Fri Oct 17 09:03:21 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 17 Oct 2008 11:03:21 +0200 (CEST) Subject: r3315 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081017090321.3C2CD1EC7D1@projects.linpro.no> Author: phk Date: 2008-10-17 11:03:21 +0200 (Fri, 17 Oct 2008) New Revision: 3315 Added: trunk/varnish-cache/bin/varnishtest/tests/r00354.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_http.c Log: Fix a segfault on certain garbed HTTP request headers. Fixes: #354 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-17 07:00:02 UTC (rev 3314) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-17 09:03:21 UTC (rev 3315) @@ -308,6 +308,7 @@ /* We always close when we take this path */ sp->doclose = "error"; + sp->wantbody = 1; w = sp->wrk; if (sp->obj == NULL) { Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-17 07:00:02 UTC (rev 3314) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-17 09:03:21 UTC (rev 3315) @@ -496,16 +496,17 @@ i = http_splitline(sp->wrk, sp->fd, hp, htc, HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO); - hp->protover = 0.9; + if (i != 0) { + WSPR(sp, SLT_HttpGarbage, htc->rxbuf); + return (i); + } + if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0")) hp->protover = 1.0; else if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) hp->protover = 1.1; else hp->protover = 0.9; - - if (i != 0) - WSPR(sp, SLT_HttpGarbage, htc->rxbuf); return (i); } Added: trunk/varnish-cache/bin/varnishtest/tests/r00354.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00354.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/r00354.vtc 2008-10-17 09:03:21 UTC (rev 3315) @@ -0,0 +1,16 @@ +# $Id$ + +test "#354 Segfault in strcmp in http_DissectRequest()" + +server s1 { + rxreq + txresp +} + +varnish v1 -vcl+backend {} -start + +client c1 { + send "FOO\r\n\r\n" + rxresp + expect resp.status == 400 +} -run From tfheen at projects.linpro.no Fri Oct 17 11:04:12 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 17 Oct 2008 13:04:12 +0200 (CEST) Subject: r3316 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081017110412.62A2A1EC45F@projects.linpro.no> Author: tfheen Date: 2008-10-17 13:04:12 +0200 (Fri, 17 Oct 2008) New Revision: 3316 Added: branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc Modified: branches/2.0/varnish-cache/bin/varnishd/cache_center.c branches/2.0/varnish-cache/bin/varnishd/cache_http.c Log: Merge r3315 from trunk Modified: branches/2.0/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/cache_center.c 2008-10-17 09:03:21 UTC (rev 3315) +++ branches/2.0/varnish-cache/bin/varnishd/cache_center.c 2008-10-17 11:04:12 UTC (rev 3316) @@ -308,6 +308,7 @@ /* We always close when we take this path */ sp->doclose = "error"; + sp->wantbody = 1; w = sp->wrk; if (sp->obj == NULL) { Modified: branches/2.0/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/cache_http.c 2008-10-17 09:03:21 UTC (rev 3315) +++ branches/2.0/varnish-cache/bin/varnishd/cache_http.c 2008-10-17 11:04:12 UTC (rev 3316) @@ -496,16 +496,17 @@ i = http_splitline(sp->wrk, sp->fd, hp, htc, HTTP_HDR_REQ, HTTP_HDR_URL, HTTP_HDR_PROTO); - hp->protover = 0.9; + if (i != 0) { + WSPR(sp, SLT_HttpGarbage, htc->rxbuf); + return (i); + } + if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.0")) hp->protover = 1.0; else if (!strcmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) hp->protover = 1.1; else hp->protover = 0.9; - - if (i != 0) - WSPR(sp, SLT_HttpGarbage, htc->rxbuf); return (i); } Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc (from rev 3315, trunk/varnish-cache/bin/varnishtest/tests/r00354.vtc) =================================================================== --- branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc (rev 0) +++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00354.vtc 2008-10-17 11:04:12 UTC (rev 3316) @@ -0,0 +1,16 @@ +# $Id$ + +test "#354 Segfault in strcmp in http_DissectRequest()" + +server s1 { + rxreq + txresp +} + +varnish v1 -vcl+backend {} -start + +client c1 { + send "FOO\r\n\r\n" + rxresp + expect resp.status == 400 +} -run From tfheen at projects.linpro.no Fri Oct 17 15:53:34 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 17 Oct 2008 17:53:34 +0200 (CEST) Subject: r3317 - branches/2.0/varnish-cache/doc Message-ID: <20081017155335.0166B1EC5D4@projects.linpro.no> Author: tfheen Date: 2008-10-17 17:53:34 +0200 (Fri, 17 Oct 2008) New Revision: 3317 Added: branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml branches/2.0/varnish-cache/doc/changes-2.0.1.xml Modified: branches/2.0/varnish-cache/doc/Makefile.am Log: Add changes for 2.0.1 Modified: branches/2.0/varnish-cache/doc/Makefile.am =================================================================== --- branches/2.0/varnish-cache/doc/Makefile.am 2008-10-17 11:04:12 UTC (rev 3316) +++ branches/2.0/varnish-cache/doc/Makefile.am 2008-10-17 15:53:34 UTC (rev 3317) @@ -1,6 +1,7 @@ # $Id$ CHANGELOGS = \ + changes-2.0.1.html \ changes-2.0.html \ changes-1.1.2.html \ changes-1.1.1.html \ @@ -8,6 +9,7 @@ changes-1.0.4.html XML = \ + changes-2.0-2.0.1.xml \ changes-1.1.2-2.0.xml \ changes-1.1.1-1.1.2.xml \ changes-1.1-1.1.1.xml \ Added: branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml =================================================================== --- branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml (rev 0) +++ branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml 2008-10-17 15:53:34 UTC (rev 3317) @@ -0,0 +1,28 @@ + + +]> + + + + varnishd + + + When receiving a garbled HTTP + request, varnishd would sometimes crash. This has + been fixed. + + + + There was an off-by-one error in the ACL compilation. + Now fixed. + + + + Red Hat spec file + + + A typo in the spec file made the .rpm file names wrong. + + + Added: branches/2.0/varnish-cache/doc/changes-2.0.1.xml =================================================================== --- branches/2.0/varnish-cache/doc/changes-2.0.1.xml (rev 0) +++ branches/2.0/varnish-cache/doc/changes-2.0.1.xml 2008-10-17 15:53:34 UTC (rev 3317) @@ -0,0 +1,12 @@ + + + +]> + + + Varnish + 2.0.1 + + + From phk at projects.linpro.no Fri Oct 17 18:54:08 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 17 Oct 2008 20:54:08 +0200 (CEST) Subject: r3318 - trunk/varnish-cache/lib/libvcl Message-ID: <20081017185408.065311EC45F@projects.linpro.no> Author: phk Date: 2008-10-17 20:54:07 +0200 (Fri, 17 Oct 2008) New Revision: 3318 Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Check that regexps are constant strings. Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-17 15:53:34 UTC (rev 3317) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-17 18:54:07 UTC (rev 3318) @@ -250,6 +250,7 @@ switch (tl->t->tok) { case '~': vcc_NextToken(tl); + ExpectErr(tl, CSTR); p = vcc_regexp(tl, 0); vcc_NextToken(tl); Fb(tl, 1, "VRT_re_match(%s, %s)\n", vp->rname, p); From tfheen at projects.linpro.no Fri Oct 17 18:57:53 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 17 Oct 2008 20:57:53 +0200 (CEST) Subject: r3319 - branches/2.0/varnish-cache Message-ID: <20081017185753.29E9E1EC5D4@projects.linpro.no> Author: tfheen Date: 2008-10-17 20:57:52 +0200 (Fri, 17 Oct 2008) New Revision: 3319 Modified: branches/2.0/varnish-cache/configure.ac Log: Mark 2.0.1 in configure.ac Modified: branches/2.0/varnish-cache/configure.ac =================================================================== --- branches/2.0/varnish-cache/configure.ac 2008-10-17 18:54:07 UTC (rev 3318) +++ branches/2.0/varnish-cache/configure.ac 2008-10-17 18:57:52 UTC (rev 3319) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [2.0], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [2.0.1], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at projects.linpro.no Fri Oct 17 18:58:10 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 17 Oct 2008 20:58:10 +0200 (CEST) Subject: r3320 - tags Message-ID: <20081017185810.9A0961EC5D4@projects.linpro.no> Author: tfheen Date: 2008-10-17 20:58:10 +0200 (Fri, 17 Oct 2008) New Revision: 3320 Added: tags/varnish-2.0.1/ Log: Release 2.0.1 Copied: tags/varnish-2.0.1 (from rev 3319, branches/2.0) From ssm at projects.linpro.no Fri Oct 17 19:55:12 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Fri, 17 Oct 2008 21:55:12 +0200 (CEST) Subject: r3321 - branches/2.0/varnish-cache/doc Message-ID: <20081017195512.0B12A1EC45F@projects.linpro.no> Author: ssm Date: 2008-10-17 21:55:11 +0200 (Fri, 17 Oct 2008) New Revision: 3321 Modified: branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml Log: Add closing tag Modified: branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml =================================================================== --- branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml 2008-10-17 18:58:10 UTC (rev 3320) +++ branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml 2008-10-17 19:55:11 UTC (rev 3321) @@ -17,6 +17,7 @@ There was an off-by-one error in the ACL compilation. Now fixed. + Red Hat spec file From phk at projects.linpro.no Fri Oct 17 21:29:49 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 17 Oct 2008 23:29:49 +0200 (CEST) Subject: r3322 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081017212949.599D51EC5D4@projects.linpro.no> Author: phk Date: 2008-10-17 23:29:49 +0200 (Fri, 17 Oct 2008) New Revision: 3322 Added: trunk/varnish-cache/bin/varnishtest/tests/r00345.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: ESI includes can hit the waiting list and since the state is stored on the worker thread stack, we cannot just let another thread pick up. This is not as much a fix as a workaround: simply sleep until the object we wait for is no longer busy. The issue may have to be revisited in the long run, but for 2.0.x this will have to do. Fixes #345 Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-10-17 19:55:11 UTC (rev 3321) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-10-17 21:29:49 UTC (rev 3322) @@ -266,7 +266,8 @@ if (busy_o != NULL) { /* There are one or more busy objects, wait for them */ - VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list); + if (sp->esis == 0) + VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list); sp->objhead = oh; UNLOCK(&oh->mtx); return (NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-17 19:55:11 UTC (rev 3321) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-17 21:29:49 UTC (rev 3322) @@ -796,7 +796,6 @@ void ESI_Deliver(struct sess *sp) { - struct esi_bit *eb; struct object *obj; @@ -839,7 +838,16 @@ sp->step = STP_RECV; http_ForceGet(sp->http); http_Unset(sp->http, H_Content_Length); - CNT_Session(sp); + while (1) { + CNT_Session(sp); + if (sp->step == STP_DONE) + break; + AN(sp->wrk); + WSL_Flush(sp->wrk, 0); + DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI"); + usleep(10000); + } + assert(sp->step == STP_DONE); sp->esis--; sp->obj = obj; Added: trunk/varnish-cache/bin/varnishtest/tests/r00345.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00345.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/r00345.vtc 2008-10-17 21:29:49 UTC (rev 3322) @@ -0,0 +1,40 @@ +# $Id$ + +test "#345, ESI waitinglist trouble" + +server s1 { + rxreq + txresp -body {} + rxreq + sema r1 sync 2 + delay 1 + txresp -body {DATA} +} -start + +varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend { + sub vcl_fetch { + if (req.url == "/") { + esi; + } + } +} -start + +client c1 { + txreq + rxresp + expect resp.bodylen == 4 +} -start + +client c2 { + txreq + sema r1 sync 2 + rxresp + expect resp.bodylen == 4 +} -run + +client c1 { + txreq + rxresp + expect resp.bodylen == 4 +} -run + From ingvar at projects.linpro.no Fri Oct 17 21:53:07 2008 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Fri, 17 Oct 2008 23:53:07 +0200 (CEST) Subject: r3323 - trunk/varnish-cache/redhat Message-ID: <20081017215307.2D8B51EC45F@projects.linpro.no> Author: ingvar Date: 2008-10-17 23:53:06 +0200 (Fri, 17 Oct 2008) New Revision: 3323 Modified: trunk/varnish-cache/redhat/varnish.spec Log: rpm specfile changes: * Fri Oct 17 2008 Ingvar Hagelund - 2.0.1-1 - 2.0.1 released, a bugfix release. New upstream sources - Package now also available in EPEL Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2008-10-17 21:29:49 UTC (rev 3322) +++ trunk/varnish-cache/redhat/varnish.spec 2008-10-17 21:53:06 UTC (rev 3323) @@ -1,7 +1,7 @@ Summary: Varnish is a high-performance HTTP accelerator Name: varnish -Version: 2.0 -Release: 2%{?dist} +Version: 2.0.1 +Release: 1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ @@ -230,20 +230,24 @@ %postun libs -p /sbin/ldconfig %changelog +* Fri Oct 17 2008 Ingvar Hagelund - 2.0.1-1 +- 2.0.1 released, a bugfix release. New upstream sources +- Package now also available in EPEL + * Thu Oct 16 2008 Ingvar Hagelund - 2.0-2 - Readded the debugflag patch. It's so practical - Added a strange workaround for make check on ppc64 * Wed Oct 15 2008 Ingvar Hagelund - 2.0-1 - 2.0 released. New upstream sources -- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat. -- Synced to upstream again. No more patches needed. +- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat +- Synced to upstream again. No more patches needed * Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 - 2.0-rc1 released. New upstream sources - Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes - Added a patch for test a00008, from r3269 -- Removed condrestart in postscript at upgrade. We don't want that. +- Removed condrestart in postscript at upgrade. We don't want that * Fri Sep 26 2008 Ingvar Hagelund - 2.0-0.10.beta2 - 2.0-beta2 released. New upstream sources From phk at projects.linpro.no Sat Oct 18 20:50:10 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Sat, 18 Oct 2008 22:50:10 +0200 (CEST) Subject: r3324 - in trunk/varnish-cache: bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtest bin/varnishtop include lib/libvarnish lib/libvarnishapi lib/libvcl Message-ID: <20081018205010.B7B3B1EC7D5@projects.linpro.no> Author: phk Date: 2008-10-18 22:50:10 +0200 (Sat, 18 Oct 2008) New Revision: 3324 Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.c trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_acceptor.h trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c trunk/varnish-cache/bin/varnishd/cache_backend.c trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c trunk/varnish-cache/bin/varnishd/cache_backend_poll.c trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_cli.c trunk/varnish-cache/bin/varnishd/cache_dir_random.c trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c trunk/varnish-cache/bin/varnishd/cache_dir_simple.c trunk/varnish-cache/bin/varnishd/cache_expire.c trunk/varnish-cache/bin/varnishd/cache_fetch.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_httpconn.c trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/cache_vcl.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c trunk/varnish-cache/bin/varnishd/cache_vrt_re.c trunk/varnish-cache/bin/varnishd/default.vcl trunk/varnish-cache/bin/varnishd/hash_classic.c trunk/varnish-cache/bin/varnishd/hash_simple_list.c trunk/varnish-cache/bin/varnishd/hash_slinger.h trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/stevedore.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishd/storage_malloc.c trunk/varnish-cache/bin/varnishd/storage_umem.c trunk/varnish-cache/bin/varnishd/varnishd.c trunk/varnish-cache/bin/varnishhist/varnishhist.c trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishreplay/varnishreplay.c trunk/varnish-cache/bin/varnishstat/varnishstat.c trunk/varnish-cache/bin/varnishtest/vtc.c trunk/varnish-cache/bin/varnishtest/vtc.h trunk/varnish-cache/bin/varnishtest/vtc_client.c trunk/varnish-cache/bin/varnishtest/vtc_http.c trunk/varnish-cache/bin/varnishtest/vtc_log.c trunk/varnish-cache/bin/varnishtest/vtc_sema.c trunk/varnish-cache/bin/varnishtest/vtc_server.c trunk/varnish-cache/bin/varnishtest/vtc_varnish.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/include/cli.h trunk/varnish-cache/include/http_headers.h trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/include/stat_field.h trunk/varnish-cache/include/varnishapi.h trunk/varnish-cache/include/vcl.h trunk/varnish-cache/include/vcl_returns.h trunk/varnish-cache/include/vct.h trunk/varnish-cache/include/vev.h trunk/varnish-cache/include/vqueue.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/include/vsb.h trunk/varnish-cache/lib/libvarnish/assert.c trunk/varnish-cache/lib/libvarnish/binary_heap.c trunk/varnish-cache/lib/libvarnish/cli_common.c trunk/varnish-cache/lib/libvarnish/num.c trunk/varnish-cache/lib/libvarnish/tcp.c trunk/varnish-cache/lib/libvarnish/vct.c trunk/varnish-cache/lib/libvarnish/version.c trunk/varnish-cache/lib/libvarnish/vlu.c trunk/varnish-cache/lib/libvarnish/vss.c trunk/varnish-cache/lib/libvarnishapi/instance.c trunk/varnish-cache/lib/libvarnishapi/shmlog.c trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_compile.h trunk/varnish-cache/lib/libvcl/vcc_dir_random.c trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl trunk/varnish-cache/lib/libvcl/vcc_obj.c trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_priv.h trunk/varnish-cache/lib/libvcl/vcc_string.c trunk/varnish-cache/lib/libvcl/vcc_token.c trunk/varnish-cache/lib/libvcl/vcc_xref.c Log: White-space commit from hell. I need a printout for a code-walkthrough and this commit wraps lines, removes trailing space, space before TAB and other iregularities. Some generated files have been compacted a bit. A few changes to comments along the way. Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.c =================================================================== --- trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -90,14 +90,16 @@ exit(1); } if (!(p = strchr(buf, ' '))) { - fprintf(stderr, "An error occured in parsing of status code.\n"); + fprintf(stderr, + "An error occured in parsing of status code.\n"); exit(1); } *p = '\0'; status = strtol(buf, &p, 10); pp = p+1; if (!(p = strchr(pp, '\n'))) { - fprintf(stderr, "An error occured in parsing of number of bytes returned.\n"); + fprintf(stderr, "An error occured " + "in parsing of number of bytes returned.\n"); exit(1); } *p = '\0'; Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2008-10-18 20:50:10 UTC (rev 3324) @@ -89,7 +89,7 @@ # Turn the default.vcl file into a C-string we can include in the program. # default_vcl.h: default.vcl Makefile - sed -e 's/"/\\"/g' -e 's/$$/\\n"/' -e 's/^/ "/' $(srcdir)/default.vcl > $@ + sed -e 's/"/\\"/g' -e 's/$$/\\n"/' -e 's/^/ "/' $(srcdir)/default.vcl > $@ # Explicitly record dependency mgt_vcc.c: default_vcl.h Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -135,11 +135,11 @@ struct ws *ws; unsigned char conds; /* If-* headers present */ - enum httpwhence logtag; + enum httpwhence logtag; int status; double protover; - txt hd[HTTP_HDR_MAX]; + txt hd[HTTP_HDR_MAX]; unsigned char hdf[HTTP_HDR_MAX]; #define HDF_FILTER (1 << 0) /* Filtered by Connection */ unsigned nhd; @@ -246,7 +246,7 @@ struct object { unsigned magic; #define OBJECT_MAGIC 0x32851d42 - unsigned refcnt; + unsigned refcnt; unsigned xid; struct objhead *objhead; struct storage *objstore; @@ -349,7 +349,7 @@ enum step step; unsigned cur_method; - unsigned handling; + unsigned handling; unsigned char sendbody; unsigned char wantbody; int err_code; @@ -465,25 +465,32 @@ void http_ClrHeader(struct http *to); unsigned http_Write(struct worker *w, const struct http *hp, int resp); void http_CopyResp(struct http *to, const struct http *fm); -void http_SetResp(struct http *to, const char *proto, const char *status, const char *response); -void http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how); +void http_SetResp(struct http *to, const char *proto, const char *status, + const char *response); +void http_FilterFields(struct worker *w, int fd, struct http *to, + const struct http *fm, unsigned how); void http_FilterHeader(struct sess *sp, unsigned how); -void http_PutProtocol(struct worker *w, int fd, struct http *to, const char *protocol); +void http_PutProtocol(struct worker *w, int fd, struct http *to, + const char *protocol); void http_PutStatus(struct worker *w, int fd, struct http *to, int status); -void http_PutResponse(struct worker *w, int fd, struct http *to, const char *response); -void http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...); +void http_PutResponse(struct worker *w, int fd, struct http *to, + const char *response); +void http_PrintfHeader(struct worker *w, int fd, struct http *to, + const char *fmt, ...); void http_SetHeader(struct worker *w, int fd, struct http *to, const char *hdr); void http_SetH(struct http *to, unsigned n, const char *fm); void http_ForceGet(struct http *to); void http_Setup(struct http *ht, struct ws *ws); int http_GetHdr(const struct http *hp, const char *hdr, char **ptr); -int http_GetHdrField(const struct http *hp, const char *hdr, const char *field, char **ptr); +int http_GetHdrField(const struct http *hp, const char *hdr, + const char *field, char **ptr); int http_GetStatus(const struct http *hp); const char *http_GetReq(const struct http *hp); const char *http_GetProto(const struct http *hp); int http_HdrIs(const struct http *hp, const char *hdr, const char *val); int http_DissectRequest(struct sess *sp); -int http_DissectResponse(struct worker *w, const struct http_conn *htc, struct http *sp); +int http_DissectResponse(struct worker *w, const struct http_conn *htc, + struct http *sp); const char *http_DoConnection(struct http *hp); void http_CopyHome(struct worker *w, int fd, struct http *hp); void http_Unset(struct http *hp, const char *hdr); @@ -538,21 +545,23 @@ void WSL(struct worker *w, enum shmlogtag tag, int id, const char *fmt, ...); void WSL_Flush(struct worker *w, int overflow); -#define DSL(flag, tag, id, ...) \ +#define DSL(flag, tag, id, ...) \ do { \ if (params->diag_bitmap & (flag)) \ VSL((tag), (id), __VA_ARGS__); \ } while (0) -#define WSP(sess, tag, ...) \ +#define WSP(sess, tag, ...) \ WSL((sess)->wrk, tag, (sess)->fd, __VA_ARGS__) -#define WSPR(sess, tag, txt) \ +#define WSPR(sess, tag, txt) \ WSLR((sess)->wrk, tag, (sess)->fd, txt) #define INCOMPL() do { \ VSL(SLT_Debug, 0, "INCOMPLETE AT: %s(%d)", __func__, __LINE__); \ - fprintf(stderr,"INCOMPLETE AT: %s(%d)\n", (const char *)__func__, __LINE__); \ + fprintf(stderr, \ + "INCOMPLETE AT: %s(%d)\n", \ + (const char *)__func__, __LINE__); \ abort(); \ } while (0) #endif @@ -616,10 +625,10 @@ __func__, __FILE__, __LINE__, (r)); \ } \ } while (0) -#define LOCK(foo) \ -do { \ +#define LOCK(foo) \ +do { \ if (!(params->diag_bitmap & 0x18)) { \ - AZ(pthread_mutex_lock(foo)); \ + AZ(pthread_mutex_lock(foo)); \ } else { \ int ixjd = pthread_mutex_trylock(foo); \ assert(ixjd == 0 || ixjd == EBUSY); \ @@ -627,11 +636,11 @@ VSL(SLT_Debug, 0, \ "MTX_CONTEST(%s,%s,%d," #foo ")", \ __func__, __FILE__, __LINE__); \ - AZ(pthread_mutex_lock(foo)); \ + AZ(pthread_mutex_lock(foo)); \ } else if (params->diag_bitmap & 0x8) { \ VSL(SLT_Debug, 0, \ "MTX_LOCK(%s,%s,%d," #foo ")", \ - __func__, __FILE__, __LINE__); \ + __func__, __FILE__, __LINE__); \ } \ } \ } while (0) Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -28,9 +28,6 @@ * * $Id$ * - * XXX: We need to pass sessions back into the event engine when they are - * reused. Not sure what the most efficient way is for that. For now - * write the session pointer to a pipe which the event engine monitors. */ #include "config.h" @@ -68,7 +65,7 @@ static struct acceptor *vca_act; -static pthread_t vca_thread_acct; +static pthread_t vca_thread_acct; static struct timeval tv_sndtimeo; static struct timeval tv_rcvtimeo; static struct linger linger; @@ -227,12 +224,15 @@ break; case EMFILE: VSL(SLT_Debug, ls->sock, - "Too many open files when accept(2)ing. Sleeping."); - TIM_sleep(params->accept_fd_holdoff * 1000.0); + "Too many open files " + "when accept(2)ing. Sleeping."); + TIM_sleep( + params->accept_fd_holdoff * 1000.0); break; default: VSL(SLT_Debug, ls->sock, - "Accept failed: %s", strerror(errno)); + "Accept failed: %s", + strerror(errno)); /* XXX: stats ? */ break; } @@ -320,7 +320,7 @@ (void)cli; (void)av; (void)priv; - + if (vca_act == NULL) vca_act = vca_acceptors[0]; @@ -356,7 +356,7 @@ cli_out(cli, "default"); else cli_out(cli, "%s", vca_act->name); - + cli_out(cli, " ("); for (i = 0; vca_acceptors[i] != NULL; i++) cli_out(cli, "%s%s", i == 0 ? "" : ", ", Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -35,7 +35,7 @@ typedef void acceptor_pass_f(struct sess *); struct acceptor { - const char *name; + const char *name; acceptor_init_f *init; acceptor_pass_f *pass; }; Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_kqueue.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -85,7 +85,7 @@ assert(sp->fd >= 0); DSL(0x04, SLT_Debug, sp->fd, "KQ: EV_SET sp %p arm %x", sp, arm); EV_SET(&ki[nki], sp->fd, EVFILT_READ, arm, 0, 0, sp); - if (++nki == NKEV) + if (++nki == NKEV) vca_kq_flush(); } Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor_ports.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -61,7 +61,8 @@ static void vca_add(int fd, void *data) { - AZ(port_associate(solaris_dport, PORT_SOURCE_FD, fd, POLLIN | POLLERR | POLLPRI, data)); + AZ(port_associate(solaris_dport, PORT_SOURCE_FD, fd, + POLLIN | POLLERR | POLLPRI, data)); } static void @@ -120,7 +121,8 @@ ts.tv_sec = 0L; ts.tv_nsec = 50L /*ms*/ * 1000L /*us*/ * 1000L /*ns*/; nevents = 1; - if (port_getn(solaris_dport, ev, MAX_EVENTS, &nevents, &ts) == 0) { + if (port_getn(solaris_dport, ev, MAX_EVENTS, &nevents, &ts) + == 0) { for (ei=0; eiconnect_timeout; @@ -257,7 +258,7 @@ if (s < 0) { LOCK(&bp->mtx); - bp->n_conn--; + bp->n_conn--; bp->refcount--; /* Only keep ref on success */ UNLOCK(&bp->mtx); } Modified: trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -227,9 +227,9 @@ /* * Copy over the sockaddrs */ - if (vb->ipv4_sockaddr != NULL) + if (vb->ipv4_sockaddr != NULL) copy_sockaddr(&b->ipv4, &b->ipv4len, vb->ipv4_sockaddr); - if (vb->ipv6_sockaddr != NULL) + if (vb->ipv6_sockaddr != NULL) copy_sockaddr(&b->ipv6, &b->ipv6len, vb->ipv6_sockaddr); assert(b->ipv4 != NULL || b->ipv6 != NULL); Modified: trunk/varnish-cache/bin/varnishd/cache_backend_poll.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_backend_poll.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -62,14 +62,14 @@ #define VBP_TARGET_MAGIC 0x6b7cb656 struct backend *backend; - struct vrt_backend_probe probe; + struct vrt_backend_probe probe; int stop; char *req; int req_len; char resp_buf[128]; unsigned good; - + /* Collected statistics */ #define BITMAP(n, c, t, b) uint64_t n; #include "cache_backend_poll.h" @@ -86,7 +86,7 @@ static VTAILQ_HEAD(, vbp_target) vbp_list = VTAILQ_HEAD_INITIALIZER(vbp_list); -static char default_request[] = +static char default_request[] = "GET / HTTP/1.1\r\n" "Connection: close\r\n" "\r\n"; @@ -319,7 +319,7 @@ vt->backend->vcl_name, logmsg, bits, vt->good, vt->probe.threshold, vt->probe.window, vt->last, vt->avg, vt->resp_buf); - + if (!vt->stop) TIM_sleep(vt->probe.interval); } @@ -358,15 +358,15 @@ cli_out(cli, "Current states good: %2u threshold: %2u window: %2u\n", vt->good, vt->probe.threshold, vt->probe.window); cli_out(cli, "Average responsetime of good probes: %.6f\n", vt->avg); - cli_out(cli, + cli_out(cli, "Oldest " " Newest\n"); - cli_out(cli, + cli_out(cli, "=============================" "===================================\n"); #define BITMAP(n, c, t, b) \ - if ((vt->n != 0) || (b)) \ + if ((vt->n != 0) || (b)) \ vbp_bitmap(cli, (c), vt->n, (t)); #include "cache_backend_poll.h" #undef BITMAP @@ -386,10 +386,10 @@ } static struct cli_proto debug_cmds[] = { - { "debug.health", "debug.health", - "\tDump backend health stuff\n", - 0, 0, vbp_health }, - { NULL } + { "debug.health", "debug.health", + "\tDump backend health stuff\n", + 0, 0, vbp_health }, + { NULL } }; /*-------------------------------------------------------------------- Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -217,10 +217,10 @@ (void)av; (void)priv; /* - * XXX: Strictly speaking, this loop traversal is not lock-safe + * XXX: Strictly speaking, this loop traversal is not lock-safe * XXX: because we might inspect the last ban while it gets * XXX: destroyed. To properly fix this, we would need to either - * XXX: hold the lock over the entire loop, or grab refcounts + * XXX: hold the lock over the entire loop, or grab refcounts * XXX: under lock for each element of the list. * XXX: We do neither, and hope for the best. */ Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -109,7 +109,6 @@ return (0); } - /*-------------------------------------------------------------------- * We have a refcounted object on the session, now deliver it. * @@ -175,7 +174,7 @@ sp->director = NULL; sp->restarts = 0; - + RES_WriteObj(sp); HSH_Deref(sp->obj); sp->obj = NULL; @@ -183,7 +182,6 @@ return (0); } - /*-------------------------------------------------------------------- * This is the final state, figure out if we should close or recycle * the client connection @@ -209,7 +207,7 @@ AZ(sp->bereq); sp->director = NULL; sp->restarts = 0; - + if (sp->vcl != NULL && sp->esis == 0) { if (sp->wrk->vcl != NULL) VCL_Rel(&sp->wrk->vcl); @@ -282,7 +280,6 @@ return (1); } - /*-------------------------------------------------------------------- * Emit an error * @@ -327,9 +324,9 @@ http_PutStatus(w, sp->fd, h, sp->err_code); now = TIM_real(); TIM_format(now, date); - http_PrintfHeader(w, sp->fd, h, "Date: %s", date); - http_PrintfHeader(w, sp->fd, h, "Server: Varnish"); - http_PrintfHeader(w, sp->fd, h, "Retry-After: %d", params->err_ttl); + http_PrintfHeader(w, sp->fd, h, "Date: %s", date); + http_PrintfHeader(w, sp->fd, h, "Server: Varnish"); + http_PrintfHeader(w, sp->fd, h, "Retry-After: %d", params->err_ttl); if (sp->err_reason != NULL) http_PutResponse(w, sp->fd, h, sp->err_reason); @@ -344,7 +341,6 @@ return (0); } - /*-------------------------------------------------------------------- * We have fetched the headers from the backend, ask the VCL code what * to do next, then head off in that direction. @@ -370,7 +366,7 @@ DOT vcl_fetch -> recv [label="restart"] DOT vcl_fetch -> rstfetch [label="restart",color=purple] DOT rstfetch [label="RESTART",shape=plaintext] -DOT fetch -> errfetch +DOT fetch -> errfetch DOT vcl_fetch -> errfetch [label="error"] DOT errfetch [label="ERROR",shape=plaintext] */ @@ -556,7 +552,6 @@ } } - /*-------------------------------------------------------------------- * LOOKUP * Hash things together and look object up in hash-table. @@ -654,7 +649,6 @@ return (0); } - /*-------------------------------------------------------------------- * We had a miss, ask VCL, proceed as instructed * @@ -719,7 +713,6 @@ } } - /*-------------------------------------------------------------------- * Start pass processing by getting headers from backend, then * continue in passbody. @@ -824,7 +817,6 @@ return (0); } - /*-------------------------------------------------------------------- * RECV * We have a complete request, set everything up and start it. @@ -1006,14 +998,14 @@ sp->step == STP_START || sp->step == STP_LOOKUP || sp->step == STP_RECV); - + /* * Whenever we come in from the acceptor we need to set blocking * mode, but there is no point in setting it when we come from * ESI or when a parked sessions returns. * It would be simpler to do this in the acceptor, but we'd rather * do the syscall in the worker thread. - */ + */ if (sp->step == STP_FIRST || sp->step == STP_START) TCP_blocking(sp->fd); @@ -1058,8 +1050,8 @@ static void cli_debug_xid(struct cli *cli, const char * const *av, void *priv) { - (void)priv; - if (av[2] != NULL) + (void)priv; + if (av[2] != NULL) xids = strtoul(av[2], NULL, 0); cli_out(cli, "XID is %u", xids); } Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -90,7 +90,7 @@ } /*-------------------------------------------------------------------- - * Called when we have a full line, look through all three command + * Called when we have a full line, look through all three command * lists to find it. */ @@ -182,19 +182,19 @@ #define SZOF(foo) cli_out(cli, \ "sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo)); - SZOF(struct ws); - SZOF(struct http); - SZOF(struct http_conn); - SZOF(struct acct); - SZOF(struct worker); - SZOF(struct workreq); - SZOF(struct bereq); - SZOF(struct storage); - SZOF(struct object); - SZOF(struct objhead); - SZOF(struct sess); - SZOF(struct vbe_conn); - SZOF(struct varnish_stats); + SZOF(struct ws); + SZOF(struct http); + SZOF(struct http_conn); + SZOF(struct acct); + SZOF(struct worker); + SZOF(struct workreq); + SZOF(struct bereq); + SZOF(struct storage); + SZOF(struct object); + SZOF(struct objhead); + SZOF(struct sess); + SZOF(struct vbe_conn); + SZOF(struct varnish_stats); } /*--------------------------------------------------------------------*/ Modified: trunk/varnish-cache/bin/varnishd/cache_dir_random.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_dir_random.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -88,7 +88,7 @@ continue; s1 += vs->hosts[i].weight; j++; - } + } if (j == 0) /* No healthy hosts */ return (NULL); @@ -116,7 +116,7 @@ if (vbe != NULL) return (vbe); k++; - } + } return (NULL); } @@ -147,7 +147,7 @@ CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(vs, d->priv, VDI_RANDOM_MAGIC); - + vh = vs->hosts; for (i = 0; i < vs->nhosts; i++, vh++) VBE_DropRef(vh->backend); @@ -158,13 +158,14 @@ } void -VRT_init_dir_random(struct cli *cli, struct director **bp, const struct vrt_dir_random *t) +VRT_init_dir_random(struct cli *cli, struct director **bp, + const struct vrt_dir_random *t) { struct vdi_random *vs; const struct vrt_dir_random_entry *te; struct vdi_random_host *vh; int i; - + (void)cli; ALLOC_OBJ(vs, VDI_RANDOM_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_dir_round_robin.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -111,7 +111,7 @@ CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(vs, d->priv, VDI_ROUND_ROBIN_MAGIC); - + vh = vs->hosts; for (i = 0; i < vs->nhosts; i++, vh++) VBE_DropRef(vh->backend); @@ -123,13 +123,14 @@ } void -VRT_init_dir_round_robin(struct cli *cli, struct director **bp, const struct vrt_dir_round_robin *t) +VRT_init_dir_round_robin(struct cli *cli, struct director **bp, + const struct vrt_dir_round_robin *t) { struct vdi_round_robin *vs; const struct vrt_dir_round_robin_entry *te; struct vdi_round_robin_host *vh; int i; - + (void)cli; ALLOC_OBJ(vs, VDI_ROUND_ROBIN_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/cache_dir_simple.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_dir_simple.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_dir_simple.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -85,7 +85,7 @@ CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(vs, d->priv, VDI_SIMPLE_MAGIC); - + VBE_DropRef(vs->backend); free(vs->dir.vcl_name); vs->dir.magic = 0; @@ -93,10 +93,11 @@ } void -VRT_init_dir_simple(struct cli *cli, struct director **bp, const struct vrt_dir_simple *t) +VRT_init_dir_simple(struct cli *cli, struct director **bp, + const struct vrt_dir_simple *t) { struct vdi_simple *vs; - + (void)cli; ALLOC_OBJ(vs, VDI_SIMPLE_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/cache_expire.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_expire.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -65,7 +65,7 @@ * Objects have sideways references in the binary heap and the LRU list * and we want to avoid paging in a lot of objects just to move them up * or down the binheap or to move a unrelated object on the LRU list. - * To avoid this we use a proxy object, objexp, to hold the relevant + * To avoid this we use a proxy object, objexp, to hold the relevant * housekeeping fields parts of an object. */ @@ -219,7 +219,7 @@ } /*-------------------------------------------------------------------- - * We have changed one or more of the object timers, shuffle it + * We have changed one or more of the object timers, shuffle it * accordingly in the binheap * * The VCL code can send us here on a non-cached object, just return. @@ -289,7 +289,7 @@ t = TIM_real(); continue; } - + o = oe->obj; CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); assert(oe->timer_idx != BINHEAP_NOIDX); @@ -364,7 +364,7 @@ * with active references, likely means that it is already in core. An * object with no active references will be prodded further anyway. * - * NB: Checking refcount here is no guarantee that it does not gain + * NB: Checking refcount here is no guarantee that it does not gain * another ref while we ponder its destiny without the lock held. */ LOCK(&exp_mtx); @@ -415,7 +415,7 @@ /* Insert in binheap and lru again */ LOCK(&exp_mtx); - VSL_stats->n_lru_nuked--; /* It was premature */ + VSL_stats->n_lru_nuked--; /* It was premature */ VSL_stats->n_lru_saved++; binheap_insert(exp_heap, oe); assert(oe->timer_idx != BINHEAP_NOIDX); Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -342,7 +342,7 @@ * header if one is necessary. * XXX: This possibly ought to go into the default VCL */ - if (!http_GetHdr(hp, H_Host, &b)) + if (!http_GetHdr(hp, H_Host, &b)) VBE_AddHostHeader(sp); TCP_blocking(vc->fd); /* XXX: we should timeout instead */ @@ -469,8 +469,8 @@ static void debug_fragfetch(struct cli *cli, const char * const *av, void *priv) { - (void)priv; - (void)cli; + (void)priv; + (void)cli; fetchfrag = strtoul(av[2], NULL, 0); } Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -119,7 +119,7 @@ VTAILQ_INIT(&w->nobj->store); VTAILQ_INIT(&w->nobj->esibits); VSL_stats->n_object++; - + } else CHECK_OBJ_NOTNULL(w->nobj, OBJECT_MAGIC); } @@ -223,7 +223,7 @@ } if (!o->cacheable) continue; - if (o->ttl == 0) + if (o->ttl == 0) continue; if (BAN_CheckObject(o, h->hd[HTTP_HDR_URL].b, oh->hash)) { o->ttl = 0; @@ -327,9 +327,9 @@ if (o->ws_o->overflow) VSL_stats->n_objoverflow++; if (params->diag_bitmap & 0x40) - WSP(sp, SLT_Debug, + WSP(sp, SLT_Debug, "Object %u workspace free %u", o->xid, WS_Free(o->ws_o)); - + oh = o->objhead; if (oh != NULL) { CHECK_OBJ(oh, OBJHEAD_MAGIC); Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -55,9 +55,9 @@ #undef HTTPH /*lint -save -e773 not () */ -#define LOGMTX2(ax, bx, cx) [bx] = SLT_##ax##cx +#define LOGMTX2(ax, bx, cx) [bx] = SLT_##ax##cx -#define LOGMTX1(ax) { \ +#define LOGMTX1(ax) { \ LOGMTX2(ax, HTTP_HDR_REQ, Request), \ LOGMTX2(ax, HTTP_HDR_RESPONSE, Response), \ LOGMTX2(ax, HTTP_HDR_STATUS, Status), \ @@ -229,12 +229,13 @@ } /*-------------------------------------------------------------------- - * Find a given headerfield, and if present and wanted, the beginning + * Find a given headerfield, and if present and wanted, the beginning * of its value. */ int -http_GetHdrField(const struct http *hp, const char *hdr, const char *field, char **ptr) +http_GetHdrField(const struct http *hp, const char *hdr, + const char *field, char **ptr) { char *h, *e; unsigned fl; @@ -271,7 +272,7 @@ return (1); } /* Skip token */ - while (*h && !vct_issepctl(*h)) + while (*h && !vct_issepctl(*h)) h++; } return (0); @@ -410,7 +411,8 @@ */ static int -http_splitline(struct worker *w, int fd, struct http *hp, const struct http_conn *htc, int h1, int h2, int h3) +http_splitline(struct worker *w, int fd, struct http *hp, + const struct http_conn *htc, int h1, int h2, int h3) { char *p; @@ -513,7 +515,8 @@ /*--------------------------------------------------------------------*/ int -http_DissectResponse(struct worker *w, const struct http_conn *htc, struct http *hp) +http_DissectResponse(struct worker *w, const struct http_conn *htc, + struct http *hp) { int i; @@ -530,13 +533,13 @@ if (hp->status == 0) hp->status = i; } else { - hp->status = + hp->status = strtoul(hp->hd[HTTP_HDR_STATUS].b, NULL /* XXX */, 10); } if (hp->hd[HTTP_HDR_RESPONSE].b == NULL || !Tlen(hp->hd[HTTP_HDR_RESPONSE])) { /* Backend didn't send a response string, use the standard */ - hp->hd[HTTP_HDR_RESPONSE].b = + hp->hd[HTTP_HDR_RESPONSE].b = TRUST_ME(http_StatusMessage(hp->status)); hp->hd[HTTP_HDR_RESPONSE].e = strchr(hp->hd[HTTP_HDR_RESPONSE].b, '\0'); @@ -606,7 +609,8 @@ } void -http_SetResp(struct http *to, const char *proto, const char *status, const char *response) +http_SetResp(struct http *to, const char *proto, const char *status, + const char *response) { CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); @@ -616,7 +620,8 @@ } static void -http_copyheader(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned n) +http_copyheader(struct worker *w, int fd, struct http *to, + const struct http *fm, unsigned n) { CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); @@ -636,7 +641,8 @@ /*--------------------------------------------------------------------*/ void -http_FilterFields(struct worker *w, int fd, struct http *to, const struct http *fm, unsigned how) +http_FilterFields(struct worker *w, int fd, struct http *to, + const struct http *fm, unsigned how) { unsigned u; @@ -664,10 +670,10 @@ struct bereq *bereq; struct http *hp; - bereq = VBE_new_bereq(); - AN(bereq); - hp = bereq->http; - hp->logtag = HTTP_Tx; + bereq = VBE_new_bereq(); + AN(bereq); + hp = bereq->http; + hp->logtag = HTTP_Tx; http_copyreq(hp, sp->http, how); http_FilterFields(sp->wrk, sp->fd, hp, sp->http, how); @@ -741,7 +747,8 @@ /*--------------------------------------------------------------------*/ static void -http_PutField(struct worker *w, int fd, struct http *to, int field, const char *string) +http_PutField(struct worker *w, int fd, struct http *to, int field, + const char *string) { char *p; unsigned l; @@ -763,7 +770,8 @@ } void -http_PutProtocol(struct worker *w, int fd, struct http *to, const char *protocol) +http_PutProtocol(struct worker *w, int fd, struct http *to, + const char *protocol) { http_PutField(w, fd, to, HTTP_HDR_PROTO, protocol); @@ -781,14 +789,16 @@ } void -http_PutResponse(struct worker *w, int fd, struct http *to, const char *response) +http_PutResponse(struct worker *w, int fd, struct http *to, + const char *response) { http_PutField(w, fd, to, HTTP_HDR_RESPONSE, response); } void -http_PrintfHeader(struct worker *w, int fd, struct http *to, const char *fmt, ...) +http_PrintfHeader(struct worker *w, int fd, struct http *to, + const char *fmt, ...) { va_list ap; unsigned l, n; @@ -818,7 +828,7 @@ unsigned u, v; for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) { - if (http_IsHdr(&hp->hd[u], hdr)) + if (http_IsHdr(&hp->hd[u], hdr)) continue; if (v != u) { memcpy(&hp->hd[v], &hp->hd[u], sizeof hp->hd[v]); Modified: trunk/varnish-cache/bin/varnishd/cache_httpconn.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_httpconn.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_httpconn.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -133,7 +133,7 @@ CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); i = htc_header_complete(&htc->rxbuf); - if (i < 0) + if (i < 0) htc->rxbuf.e = htc->rxbuf.b; if (i <= 0) return (0); @@ -195,7 +195,7 @@ p += l; len -= l; htc->pipeline.b += l; - if (htc->pipeline.b == htc->pipeline.e) + if (htc->pipeline.b == htc->pipeline.e) htc->pipeline.b = htc->pipeline.e = NULL; } if (len == 0) Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -64,15 +64,15 @@ ws, ws->overflow ? "overflow" : ""); vsb_printf(vsp, "%*sid = \"%s\",\n", indent + 2, "", ws->id); vsb_printf(vsp, "%*s{s,f,r,e} = {%p,", indent + 2, "", ws->s); - if (ws->f > ws->s) + if (ws->f > ws->s) vsb_printf(vsp, ",+%d", ws->f - ws->s); else vsb_printf(vsp, ",%p", ws->f); - if (ws->r > ws->s) + if (ws->r > ws->s) vsb_printf(vsp, ",+%d", ws->r - ws->s); else vsb_printf(vsp, ",%p", ws->r); - if (ws->e > ws->s) + if (ws->e > ws->s) vsb_printf(vsp, ",+%d", ws->e - ws->s); else vsb_printf(vsp, ",%p", ws->e); @@ -258,7 +258,8 @@ /*--------------------------------------------------------------------*/ static void -pan_ic(const char *func, const char *file, int line, const char *cond, int err, int xxx) +pan_ic(const char *func, const char *file, int line, const char *cond, + int err, int xxx) { int l; char *p; @@ -296,7 +297,7 @@ vsb_printf(vsp, " thread = (%s)", q); if (!(params->diag_bitmap & 0x2000)) { sp = THR_GetSession(); - if (sp != NULL) + if (sp != NULL) pan_sess(sp); } vsb_printf(vsp, "\n"); @@ -307,7 +308,7 @@ memcpy(p, panicstr, l); if (params->diag_bitmap & 0x4000) (void)fputs(panicstr, stderr); - + #ifdef HAVE_ABORT2 if (params->diag_bitmap & 0x8000) { void *arg[1]; Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -111,7 +111,7 @@ fds[0].revents = 0; fds[1].revents = 0; i = poll(fds, 2, params->pipe_timeout * 1000); - if (i < 1) + if (i < 1) break; if (fds[0].revents && rdf(vc->fd, sp->fd)) { (void)shutdown(vc->fd, SHUT_RD); Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -79,7 +79,7 @@ struct wq { unsigned magic; #define WQ_MAGIC 0x606658fa - MTX mtx; + MTX mtx; struct workerhead idle; VTAILQ_HEAD(, workreq) overflow; unsigned nthr; @@ -456,7 +456,7 @@ /*-------------------------------------------------------------------- * Periodic pool herding thread - * + * * Do things which we can do at our leisure: * Add pools * Scale constants Modified: trunk/varnish-cache/bin/varnishd/cache_vcl.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_vcl.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -208,8 +208,8 @@ struct vcls *vcl, *vcl2; ASSERT_CLI(); - VTAILQ_FOREACH_SAFE(vcl, &vcl_head, list, vcl2) - if (vcl->conf->discard && vcl->conf->busy == 0) + VTAILQ_FOREACH_SAFE(vcl, &vcl_head, list, vcl2) + if (vcl->conf->discard && vcl->conf->busy == 0) VCL_Nuke(vcl); } @@ -323,7 +323,7 @@ \ sp->handling = 0; \ sp->cur_method = VCL_MET_ ## upper; \ - WSP(sp, SLT_VCL_call, "%s", #func); \ + WSP(sp, SLT_VCL_call, "%s", #func); \ sp->vcl->func##_func(sp); \ WSP(sp, SLT_VCL_return, "%s", vcl_handlingname(sp->handling)); \ sp->cur_method = 0; \ @@ -342,7 +342,7 @@ { CLI_VCL_LIST, ccf_config_list }, { CLI_VCL_DISCARD, ccf_config_discard }, { CLI_VCL_USE, ccf_config_use }, - { NULL } + { NULL } }; void Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -136,7 +136,7 @@ if (b + x < e) memcpy(b, h, x); b += x; - if (b + 1 < e) + if (b + 1 < e) *b++ = ' '; } while (p != vrt_magic_string_end) { @@ -148,7 +148,7 @@ b += x; p = va_arg(ap, const char *); } - if (b + 1 < e) + if (b + 1 < e) *b++ = '\0'; if (b > e) { WS_Release(hp->ws, 0); @@ -164,7 +164,8 @@ /*--------------------------------------------------------------------*/ void -VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr, const char *p, ...) +VRT_SetHdr(const struct sess *sp , enum gethdr_e where, const char *hdr, + const char *p, ...) { struct http *hp; va_list ap; @@ -190,7 +191,8 @@ /*--------------------------------------------------------------------*/ static void -vrt_do_string(struct worker *w, int fd, struct http *hp, int fld, const char *err, const char *p, va_list ap) +vrt_do_string(struct worker *w, int fd, struct http *hp, int fld, + const char *err, const char *p, va_list ap) { char *b; @@ -512,7 +514,8 @@ if (sp->mysockaddr->sa_family == AF_UNSPEC) AZ(getsockname(sp->fd, sp->mysockaddr, &sp->mysockaddrlen)); - TCP_name(sp->mysockaddr, sp->mysockaddrlen, abuf, sizeof abuf, pbuf, sizeof pbuf); + TCP_name(sp->mysockaddr, sp->mysockaddrlen, + abuf, sizeof abuf, pbuf, sizeof pbuf); return (atoi(pbuf)); } @@ -665,7 +668,7 @@ *sp->http = *sp->http0; WS_Reset(sp->ws, sp->ws_req); } - + /*--------------------------------------------------------------------*/ /*lint -e{818} sp could be const */ @@ -718,7 +721,7 @@ void VRT_purge(const char *regexp, int hash) { - + if (regexp != NULL) (void)BAN_Add(NULL, regexp, hash); } Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -95,7 +95,7 @@ char buf[256], *q; txt t; - if (i == 0) + if (i == 0) i = p - ew->t.b; if (i > 20) { i = 20; @@ -234,7 +234,7 @@ /* Value, if any ? */ *val = *in; - if (in->b >= in->e) + if (in->b >= in->e) return (1); if (*in->b == '"') { @@ -287,7 +287,7 @@ tag.e - tag.b, tag.b, val.e - val.b, val.b); if (Tlen(tag) != 3 || memcmp(tag.b, "src", 3)) - continue; + continue; if (Tlen(val) == 0) { esi_error(ew, tag.b, Tlen(tag), "ESI esi:include src attribute withou value"); @@ -351,7 +351,7 @@ /*-------------------------------------------------------------------- * Zoom over a piece of object and dike out all releveant esi: pieces. - * The entire txt may not be processed because an interesting part + * The entire txt may not be processed because an interesting part * could possibly span into the next chunk of storage. * Return value: number of bytes processed. */ @@ -385,7 +385,7 @@ if (!memcmp(p, "]]>", 3)) { ew->incdata = 0; p += 3; - } else + } else p++; } continue; @@ -464,7 +464,7 @@ ew->incdata = 1; p += 9; continue; - } + } /* Ignore non esi elements, if so instructed */ if ((params->esi_syntax & 0x02)) { @@ -510,7 +510,7 @@ esi_error(ew, p, 1 + q - p, ew->remflg ? "ESI 1.0 forbids nested esi:remove" : "ESI 1.0 esi:remove not opened"); - + if (!ew->remflg) { ew->o.e = p; esi_addverbatim(ew); @@ -561,7 +561,7 @@ continue; } if (r + 10 < q && !memcmp(r, "esi:include", 11)) { - + ew->o.e = p; esi_addverbatim(ew); @@ -723,7 +723,7 @@ p = NULL; continue; } - assert(t.e > t.b + u); /* XXX incredibly long element ? */ + assert(t.e > t.b + u); /* XXX incredibly long element ? */ memcpy(t.b, p, u); /* Peel start off next chunk, until and including '<' */ @@ -755,7 +755,7 @@ ew->t = t; q = esi_parse(ew); assert(q == ew->t.e); /* XXX */ - + /* 'p' is cached starting point for next storage part */ } Modified: trunk/varnish-cache/bin/varnishd/cache_vrt_re.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/cache_vrt_re.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -104,7 +104,8 @@ } const char * -VRT_regsub(const struct sess *sp, int all, const char *str, void *re, const char *sub) +VRT_regsub(const struct sess *sp, int all, const char *str, void *re, + const char *sub) { regmatch_t pm[10]; regex_t *t; @@ -161,7 +162,7 @@ if (res.b >= res.e) { WS_Release(sp->http->ws, 0); return (str); - } + } Tcheck(res); WS_ReleaseP(sp->http->ws, res.b); return (b0); Modified: trunk/varnish-cache/bin/varnishd/default.vcl =================================================================== --- trunk/varnish-cache/bin/varnishd/default.vcl 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/default.vcl 2008-10-18 20:50:10 UTC (rev 3324) @@ -16,23 +16,24 @@ * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $Id$ * * The default VCL code. * - * NB! You do NOT need to copy & paste all of this into your won vcl code, - * if you do not handle one of the functions, the compiler will automaticall - * fall back to the default code. + * NB! You do NOT need to copy & paste all of these functions into your + * own vcl code, if you do not provide a definition of one of these + * functions, the compiler will automatically fall back to the default + * code from this file. * * This code will be prefixed with a backend declaration built from the * -b argument. @@ -134,7 +135,9 @@

"} obj.response {"

Guru Meditation:

XID: "} req.xid {"

-
Varnish
+
+ Varnish +
"}; Modified: trunk/varnish-cache/bin/varnishd/hash_classic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_classic.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/hash_classic.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -249,7 +249,7 @@ /*--------------------------------------------------------------------*/ struct hash_slinger hcl_slinger = { - .magic = SLINGER_MAGIC, + .magic = SLINGER_MAGIC, .name = "classic", .init = hcl_init, .start = hcl_start, Modified: trunk/varnish-cache/bin/varnishd/hash_simple_list.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/hash_simple_list.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -90,25 +90,23 @@ UNLOCK(&hsl_mutex); return (nobj); } - if (nobj == NULL) { - UNLOCK(&hsl_mutex); - return (NULL); - } - he2 = calloc(sizeof *he2, 1); - XXXAN(he2); - he2->obj = nobj; - he2->refcnt = 1; + if (nobj != NULL) { + he2 = calloc(sizeof *he2, 1); + XXXAN(he2); + he2->obj = nobj; + he2->refcnt = 1; - nobj->hashpriv = he2; - nobj->hash = malloc(sp->lhashptr); - XXXAN(nobj->hash); - nobj->hashlen = sp->lhashptr; - HSH_Copy(sp, nobj); + nobj->hashpriv = he2; + nobj->hash = malloc(sp->lhashptr); + XXXAN(nobj->hash); + nobj->hashlen = sp->lhashptr; + HSH_Copy(sp, nobj); - if (he != NULL) - VTAILQ_INSERT_BEFORE(he, he2, list); - else - VTAILQ_INSERT_TAIL(&hsl_head, he2, list); + if (he != NULL) + VTAILQ_INSERT_BEFORE(he, he2, list); + else + VTAILQ_INSERT_TAIL(&hsl_head, he2, list); + } UNLOCK(&hsl_mutex); return (nobj); } @@ -143,5 +141,5 @@ .name = "simple", .start = hsl_start, .lookup = hsl_lookup, - .deref = hsl_deref, + .deref = hsl_deref, }; Modified: trunk/varnish-cache/bin/varnishd/hash_slinger.h =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_slinger.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/hash_slinger.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -33,7 +33,8 @@ typedef void hash_init_f(int ac, char * const *av); typedef void hash_start_f(void); -typedef struct objhead *hash_lookup_f(const struct sess *sp, struct objhead *nobj); +typedef struct objhead * + hash_lookup_f(const struct sess *sp, struct objhead *nobj); typedef int hash_deref_f(const struct objhead *obj); struct hash_slinger { Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -77,7 +77,7 @@ /* TTL used for lack of anything better */ unsigned default_ttl; - + /* TTL used for synthesized error pages */ unsigned err_ttl; @@ -190,4 +190,5 @@ void child_main(void); -int varnish_instance(const char *n_arg, char *name, size_t namelen, char *dir, size_t dirlen); +int varnish_instance(const char *n_arg, char *name, size_t namelen, + char *dir, size_t dirlen); Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -194,7 +194,7 @@ continue; } ls->sock = VSS_bind(ls->addr); - if (ls->sock < 0) + if (ls->sock < 0) continue; mgt_child_inherit(ls->sock, "sock"); @@ -269,7 +269,7 @@ child_cli_in = cp[0]; /* - * Open pipe for child stdout/err + * Open pipe for child stdout/err * NB: not inherited, because we dup2() it to stdout/stderr in child */ AZ(pipe(cp)); @@ -548,7 +548,7 @@ AZ(sigaction(SIGPIPE, &sac, NULL)); AZ(sigaction(SIGHUP, &sac, NULL)); - if (!dflag && !mgt_has_vcl()) + if (!dflag && !mgt_has_vcl()) REPORT0(LOG_ERR, "No VCL loaded yet"); else if (!dflag) { start_child(NULL); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -66,8 +66,8 @@ static int cli_i = -1, cli_o = -1; struct telnet { - int fd; - struct vev *ev; + int fd; + struct vev *ev; VTAILQ_ENTRY(telnet) list; }; @@ -108,7 +108,7 @@ "help %s\n", av[2] != NULL ? av[2] : "")) { cli_out(cli, "%s", p); cli_result(cli, u); - } + } free(p); } } @@ -144,7 +144,7 @@ { CLI_PARAM_SHOW, mcf_param_show, NULL }, { CLI_PARAM_SET, mcf_param_set, NULL }, - { CLI_QUIT, mcf_close, NULL}, + { CLI_QUIT, mcf_close, NULL}, #if 0 { CLI_SERVER_RESTART }, { CLI_ZERO }, Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -155,7 +155,8 @@ /*--------------------------------------------------------------------*/ static void -tweak_generic_uint(struct cli *cli, volatile unsigned *dest, const char *arg, unsigned min, unsigned max) +tweak_generic_uint(struct cli *cli, volatile unsigned *dest, const char *arg, + unsigned min, unsigned max) { unsigned u; @@ -215,7 +216,7 @@ master.uid = getuid(); return; } - } else + } else pw = getpwnam(arg); if (pw == NULL) { cli_out(cli, "Unknown user"); @@ -229,7 +230,7 @@ /* set group to user's primary group */ if ((gr = getgrgid(pw->pw_gid)) != NULL && (gr = getgrnam(gr->gr_name)) != NULL && - gr->gr_gid == pw->pw_gid) + gr->gr_gid == pw->pw_gid) REPLACE(master.group, gr->gr_name); } else if (master.user) { cli_out(cli, "%s (%d)", master.user, (int)master.uid); @@ -276,7 +277,8 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pool_min(struct cli *cli, const struct parspec *par, const char *arg) +tweak_thread_pool_min(struct cli *cli, const struct parspec *par, + const char *arg) { tweak_generic_uint(cli, &master.wthread_min, arg, @@ -286,7 +288,8 @@ /*--------------------------------------------------------------------*/ static void -tweak_thread_pool_max(struct cli *cli, const struct parspec *par, const char *arg) +tweak_thread_pool_max(struct cli *cli, const struct parspec *par, + const char *arg) { (void)par; @@ -310,7 +313,8 @@ } static void -tweak_listen_address(struct cli *cli, const struct parspec *par, const char *arg) +tweak_listen_address(struct cli *cli, const struct parspec *par, + const char *arg) { char **av; int i; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -65,7 +65,7 @@ struct vclprog { VTAILQ_ENTRY(vclprog) list; - char *name; + char *name; char *fname; int active; }; @@ -487,7 +487,7 @@ cli_result(cli, CLIS_PARAM); return; } - + sb = vsb_newauto(); XXXAN(sb); vf = mgt_VccCompile(sb, av[3], NULL, 0); @@ -577,7 +577,7 @@ vp = mcf_find_vcl(cli, av[2]); if (vp == NULL) return; - if (vp->active != 0) + if (vp->active != 0) return; if (child_pid >= 0 && mgt_cli_askchild(&status, &p, "vcl.use %s\n", av[2])) { Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -86,7 +86,7 @@ p[__SHMLOG_ID_HIGH] = (id >> 8) & 0xff; p[__SHMLOG_ID_LOW] = id & 0xff; p[SHMLOG_DATA + len] = '\0'; - p[SHMLOG_NEXTTAG + len] = SLT_ENDMARKER; + p[SHMLOG_NEXTTAG + len] = SLT_ENDMARKER; /* XXX: Write barrier here */ p[SHMLOG_TAG] = tag; } @@ -159,7 +159,7 @@ p = logstart + loghead->ptr; n = vsnprintf((char *)(p + SHMLOG_DATA), 256, fmt, ap); if (n > 255) - n = 255; /* we truncate long fields */ + n = 255; /* we truncate long fields */ vsl_hdr(tag, p, n, id); loghead->ptr += SHMLOG_NEXTTAG + n; assert(loghead->ptr < loghead->size); @@ -254,7 +254,7 @@ p = w->wlp; n = vsnprintf((char *)(p + SHMLOG_DATA), 256, fmt, ap); if (n > 255) - n = 255; /* we truncate long fields */ + n = 255; /* we truncate long fields */ vsl_hdr(tag, p, n, id); w->wlp += SHMLOG_NEXTTAG + n; assert(w->wlp < w->wle); Modified: trunk/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- trunk/varnish-cache/bin/varnishd/stevedore.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/stevedore.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -105,7 +105,7 @@ if (stv->init != NULL) stv->init(stv, ac, av); - else if (ac != 0) + else if (ac != 0) ARGV_ERR("(-s%s) too many arguments\n", stv->name); VTAILQ_INSERT_TAIL(&stevedores, stv, list); Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -185,7 +185,7 @@ i = 0; while(1) { o = l; - if (o == l && o > 0) + if (o == l && o > 0) break; l >>= 1; i++; @@ -303,7 +303,7 @@ if (S_ISREG(st.st_mode)) { sc->fd = open(fn, O_RDWR); - if (sc->fd < 0) + if (sc->fd < 0) ARGV_ERR("(-sfile) \"%s\" could not open (%s)\n", fn, strerror(errno)); AZ(fstat(sc->fd, &st)); Modified: trunk/varnish-cache/bin/varnishd/storage_malloc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_malloc.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/storage_malloc.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -132,7 +132,7 @@ (void)parent; AZ(av[ac]); - if (ac > 1) + if (ac > 1) ARGV_ERR("(-smalloc) too many arguments\n"); if (ac == 0 || *av[0] == '\0') @@ -141,7 +141,7 @@ e = str2bytes(av[0], &u, 0); if (e != NULL) ARGV_ERR("(-smalloc) size \"%s\": %s\n", av[0], e); - if ((u != (uintmax_t)(size_t)u)) + if ((u != (uintmax_t)(size_t)u)) ARGV_ERR("(-smalloc) size \"%s\": too big\n", av[0]); sma_max = u; } Modified: trunk/varnish-cache/bin/varnishd/storage_umem.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -139,7 +139,7 @@ (void)parent; AZ(av[ac]); - if (ac > 1) + if (ac > 1) ARGV_ERR("(-sumem) too many arguments\n"); if (ac == 0 || *av[0] == '\0') @@ -148,7 +148,7 @@ e = str2bytes(av[0], &u, 0); if (e != NULL) ARGV_ERR("(-sumem) size \"%s\": %s\n", av[0], e); - if ((u != (uintmax_t)(size_t)u)) + if ((u != (uintmax_t)(size_t)u)) ARGV_ERR("(-sumem) size \"%s\": too big\n", av[0]); smu_max = u; } Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -136,7 +136,7 @@ av = ParseArgv(spec, ARGV_COMMA); AN(av); - if (av[0] != NULL) + if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); if (av[1] == NULL) @@ -175,7 +175,7 @@ av = ParseArgv(h_arg, ARGV_COMMA); AN(av); - if (av[0] != NULL) + if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); if (av[1] == NULL) @@ -226,7 +226,8 @@ fprintf(stderr, FMT, "", " -s file [default: use /tmp]"); fprintf(stderr, FMT, "", " -s file,"); fprintf(stderr, FMT, "", " -s file,,"); - fprintf(stderr, FMT, "", " -s file,,,"); + fprintf(stderr, FMT, "", + " -s file,,,"); fprintf(stderr, FMT, "-t", "Default TTL"); fprintf(stderr, FMT, "-T address:port", "Telnet listen address and port"); @@ -252,10 +253,10 @@ av = ParseArgv(argv, ARGV_COMMA); AN(av); - if (av[0] != NULL) + if (av[0] != NULL) ARGV_ERR("%s\n", av[0]); - if (av[1] == NULL) + if (av[1] == NULL) usage(); u = arg_ul(av[1]); @@ -462,7 +463,8 @@ MCF_ParamInit(cli); cli_check(cli); - while ((o = getopt(argc, argv, "a:b:Cdf:Fg:h:l:n:P:p:s:T:t:u:Vw:")) != -1) + while ((o = getopt(argc, argv, + "a:b:Cdf:Fg:h:l:n:P:p:s:T:t:u:Vw:")) != -1) switch (o) { case 'a': MCF_ParamSet(cli, "listen_address", optarg); @@ -580,7 +582,7 @@ exit(1); } - if (n_arg != NULL) + if (n_arg != NULL) openlog(n_arg, LOG_PID, LOG_LOCAL0); else openlog("varnishd", LOG_PID, LOG_LOCAL0); @@ -624,7 +626,7 @@ if (d_flag == 1) printf("%d\n", getpid()); - if (pfh != NULL && vpf_write(pfh)) + if (pfh != NULL && vpf_write(pfh)) fprintf(stderr, "NOTE: Could not write PID file\n"); mgt_run(d_flag, T_arg); Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -147,7 +147,8 @@ } static int -h_hist(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) +h_hist(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, + unsigned spec, const char *ptr) { double b; int i, j; @@ -308,8 +309,8 @@ static void usage(void) { - fprintf(stderr, - "usage: varnishhist %s [-n varnish_name] [-V] [-w delay]\n", VSL_USAGE); + fprintf(stderr, "usage: varnishhist " + "%s [-n varnish_name] [-V] [-w delay]\n", VSL_USAGE); exit(1); } Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -120,7 +120,8 @@ } static int -h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) +h_order(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, + unsigned spec, const char *ptr) { char type; @@ -261,7 +262,7 @@ flags = (a_flag ? O_APPEND : O_TRUNC) | O_WRONLY | O_CREAT; #ifdef O_LARGEFILE - flags |= O_LARGEFILE; + flags |= O_LARGEFILE; #endif if (!strcmp(w_arg, "-")) fd = STDOUT_FILENO; @@ -308,8 +309,8 @@ static void usage(void) { - fprintf(stderr, - "usage: varnishlog %s [-aDoV] [-n varnish_name] [-P file] [-w file]\n", VSL_USAGE); + fprintf(stderr, "usage: varnishlog " + "%s [-aDoV] [-n varnish_name] [-P file] [-w file]\n", VSL_USAGE); exit(1); } Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -105,7 +105,8 @@ static int prefer_x_forwarded_for = 0; static int -isprefix(const char *str, const char *prefix, const char *end, const char **next) +isprefix(const char *str, const char *prefix, const char *end, + const char **next) { while (str < end && *str && *prefix && @@ -511,7 +512,9 @@ usage(void) { - fprintf(stderr, "usage: varnishncsa %s [-aDV] [-n varnish_name] [-P file] [-w file]\n", VSL_USAGE); + fprintf(stderr, + "usage: varnishncsa %s [-aDV] [-n varnish_name] " + "[-P file] [-w file]\n", VSL_USAGE); exit(1); } Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -251,7 +251,8 @@ while (fd >= newnthreads) newnthreads += newnthreads + 1; - newthreads = realloc(newthreads, newnthreads * sizeof *newthreads); + newthreads = realloc(newthreads, + newnthreads * sizeof *newthreads); XXXAN(newthreads != NULL); memset(newthreads + nthreads, 0, (newnthreads - nthreads) * sizeof *newthreads); @@ -557,12 +558,15 @@ if (!thr->method || !thr->url || !thr->proto) { thr->bogus = 1; - } else if (strcmp(thr->method, "GET") != 0 && strcmp(thr->method, "HEAD") != 0) { + } else if (strcmp(thr->method, "GET") != 0 && + strcmp(thr->method, "HEAD") != 0) { thr->bogus = 1; } else if (strcmp(thr->proto, "HTTP/1.0") == 0) { - reopen = !(thr->conn && strcasecmp(thr->conn, "keep-alive") == 0); + reopen = !(thr->conn && + strcasecmp(thr->conn, "keep-alive") == 0); } else if (strcmp(thr->proto, "HTTP/1.1") == 0) { - reopen = (thr->conn && strcasecmp(thr->conn, "close") == 0); + reopen = (thr->conn && + strcasecmp(thr->conn, "close") == 0); } else { thr->bogus = 1; } @@ -701,7 +705,8 @@ usage(void) { - fprintf(stderr, "usage: varnishreplay [-D] -a address:port -r logfile\n"); + fprintf(stderr, + "usage: varnishreplay [-D] -a address:port -r logfile\n"); exit(1); } @@ -743,7 +748,11 @@ signal(SIGPIPE, SIG_IGN); pthread_attr_init(&thread_attr); - /* XXX: seting the stack size manually reduces the memory usasage and increases speed */ + + /* + * XXX: seting the stack size manually reduces the memory usage + * XXX: (allowing more threads) and increases speed (?) + */ pthread_attr_setstacksize(&thread_attr, 32768); while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -81,9 +81,10 @@ while (field_start != NULL) { field_end = field_start + field_length; - if ((field_start == fields || *(field_start - 1) == ',') && - (*field_end == ',' || *field_end == '\0')) - return (match_value); + if ((field_start == fields || + *(field_start - 1) == ',') && + (*field_end == ',' || *field_end == '\0')) + return (match_value); field_start = strstr( field_end, field ); } } @@ -237,14 +238,20 @@ usage(void) { #define FMT " %-28s # %s\n" - fprintf(stderr, "usage: varnishstat [-1lV] [-f field_list] [-n varnish_name] [-w delay]\n"); + fprintf(stderr, "usage: varnishstat " + "[-1lV] [-f field_list] [-n varnish_name] [-w delay]\n"); fprintf(stderr, FMT, "-1", "Print the statistics once and exit"); - fprintf(stderr, FMT, "-f field_list", "Comma separated list of fields to display. "); - fprintf(stderr, FMT, "", "If it starts with '^' it is used as an exclusion list"); - fprintf(stderr, FMT, "-l", "Lists the available fields to use with the -f option"); - fprintf(stderr, FMT, "-n varnish_name", "The varnishd instance to get logs from"); + fprintf(stderr, FMT, "-f field_list", + "Comma separated list of fields to display. "); + fprintf(stderr, FMT, "", + "If it starts with '^' it is used as an exclusion list"); + fprintf(stderr, FMT, "-l", + "Lists the available fields to use with the -f option"); + fprintf(stderr, FMT, "-n varnish_name", + "The varnishd instance to get logs from"); fprintf(stderr, FMT, "-V", "Display the version number and exit"); - fprintf(stderr, FMT, "-w delay", "Wait delay seconds between updates. The default is 1."); + fprintf(stderr, FMT, "-w delay", + "Wait delay seconds between updates. The default is 1."); #undef FMT exit(1); } @@ -252,7 +259,7 @@ static void list_fields(void) { - fprintf(stderr, "Available fields to use with the varnishstat -f option:\n"); + fprintf(stderr, "Varnishstat -f option fields:\n"); fprintf(stderr, "Field name Description\n"); fprintf(stderr, "---------- -----------\n"); fprintf(stderr, "uptime Child uptime\n"); @@ -290,7 +297,8 @@ valid_field = 0; for (i = 0; all_fields[i] != NULL; i++) { - if (strncmp(field_start, all_fields[i], field_length) == 0 && field_length == strlen( all_fields[i] )) { + if (strncmp(field_start, all_fields[i], field_length) + == 0 && field_length == strlen( all_fields[i])) { valid_field = 1; break; } @@ -346,7 +354,7 @@ if ((VSL_stats = VSL_OpenStats(n_arg)) == NULL) exit(1); - + if (fields != NULL && !valid_fields(fields)) { usage(); exit(1); Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -138,7 +138,8 @@ p++; } else { if (*p == '\n') - fprintf(stderr, "Unterminated quoted string in line:\n%s", p); + fprintf(stderr, + "Unterminated quoted string in line:\n%s", p); assert(*p != '\n'); *q++ = *p; } @@ -182,7 +183,7 @@ fprintf(stderr, "Unknown command: \"%s\"", token_s[0]); exit (1); } - + assert(cp->cmd != NULL); cp->cmd(token_s, priv, cmd, vl); } @@ -286,14 +287,14 @@ */ static struct cmds cmds[] = { - { "server", cmd_server }, - { "client", cmd_client }, - { "varnish", cmd_varnish }, - { "delay", cmd_delay }, - { "test", cmd_test }, - { "shell", cmd_shell }, - { "sema", cmd_sema }, - { NULL, NULL } + { "server", cmd_server }, + { "client", cmd_client }, + { "varnish", cmd_varnish }, + { "delay", cmd_delay }, + { "test", cmd_test }, + { "shell", cmd_shell }, + { "sema", cmd_sema }, + { NULL, NULL } }; static void @@ -325,7 +326,7 @@ } /********************************************************************** - * Main + * Main */ int Modified: trunk/varnish-cache/bin/varnishtest/vtc.h =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -22,7 +22,7 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * + * * $Id$ */ @@ -30,7 +30,9 @@ struct vtclog; struct cmds; -#define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd, struct vtclog *vl +#define CMD_ARGS \ + char * const *av, void *priv, const struct cmds *cmd, struct vtclog *vl + typedef void cmd_f(CMD_ARGS); struct cmds { @@ -38,7 +40,8 @@ cmd_f *cmd; }; -void parse_string(char *buf, const struct cmds *cmd, void *priv, struct vtclog *vl); +void parse_string(char *buf, const struct cmds *cmd, void *priv, + struct vtclog *vl); cmd_f cmd_dump; cmd_f cmd_delay; @@ -60,4 +63,5 @@ struct vtclog *vtc_logopen(const char *id); void vtc_logclose(struct vtclog *vl); void vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...); -void vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str); +void vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, + const char *str); Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -50,7 +50,7 @@ VTAILQ_ENTRY(client) list; char *spec; - + char *connect; pthread_t tp; @@ -208,7 +208,7 @@ VTAILQ_FOREACH(c, &clients, list) if (!strcmp(c->name, av[0])) break; - if (c == NULL) + if (c == NULL) c = client_new(av[0]); av++; Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -75,8 +75,8 @@ { int i, j, k, l; char *b; - - + + AN(len); i = strtoul(len, NULL, 0); assert(i > 0); @@ -347,8 +347,8 @@ { char *p, *q; int i, l, ll; - + ll = 0; p = http_find_header(hh, "content-length"); if (p != NULL) { @@ -397,7 +397,7 @@ ll += i; } while (i > 0); vtc_dump(hp->vl, 4, "rxeof", hp->body); - } + } sprintf(hp->bodylen, "%d", ll); } @@ -419,7 +419,7 @@ p = hp->rxbuf + hp->prxbuf - 1; i = 0; for (i = 0; p > hp->rxbuf; p--) { - if (*p != '\n') + if (*p != '\n') break; if (p - 1 > hp->rxbuf && p[-1] == '\r') p--; @@ -456,7 +456,7 @@ vtc_log(hp->vl, 3, "rxresp"); http_rxhdr(hp); http_splitheader(hp, 0); - if (!strcmp(hp->resp[1], "200")) + if (!strcmp(hp->resp[1], "200")) http_swallow_body(hp, hp->resp, 1); else http_swallow_body(hp, hp->resp, 0); @@ -506,7 +506,7 @@ if (!strcmp(*av, "-hdr")) { vsb_printf(hp->vsb, "%s%s", av[1], nl); av++; - } else + } else break; } for(; *av != NULL; av++) { @@ -525,7 +525,7 @@ fprintf(stderr, "Unknown http txresp spec: %s\n", *av); exit (1); } - if (body != NULL) + if (body != NULL) vsb_printf(hp->vsb, "Content-Length: %d%s", strlen(body), nl); vsb_cat(hp->vsb, nl); if (body != NULL) { @@ -621,7 +621,7 @@ fprintf(stderr, "Unknown http txreq spec: %s\n", *av); exit (1); } - if (body != NULL) + if (body != NULL) vsb_printf(hp->vsb, "Content-Length: %d%s", strlen(body), nl); vsb_cat(hp->vsb, nl); if (body != NULL) { Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -56,7 +56,7 @@ struct vtclog *vl; ALLOC_OBJ(vl, VTCLOG_MAGIC); - AN(vl); + AN(vl); vl->id = id; vl->vsb = vsb_newauto(); return (vl); @@ -125,7 +125,7 @@ vsb_clear(vl->vsb); if (pfx == NULL) pfx = ""; - if (str == NULL) + if (str == NULL) vsb_printf(vl->vsb, "%s %-4s %s(null)\n", lead[lvl], vl->id, pfx); else Modified: trunk/varnish-cache/bin/varnishtest/vtc_sema.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -141,7 +141,7 @@ VTAILQ_FOREACH(r, &semas, list) if (!strcmp(r->name, av[0])) break; - if (r == NULL) + if (r == NULL) r = sema_new(av[0], vl); AZ(pthread_mutex_unlock(&sema_mtx)); av++; Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -54,7 +54,7 @@ unsigned repeat; char *spec; - + int depth; int sock; char *listen; @@ -233,7 +233,7 @@ /* Reset and free */ VTAILQ_FOREACH_SAFE(s, &servers, list, s2) { VTAILQ_REMOVE(&servers, s, list); - if (s->sock >= 0) + if (s->sock >= 0) server_wait(s); server_delete(s); } @@ -246,7 +246,7 @@ VTAILQ_FOREACH(s, &servers, list) if (!strcmp(s->name, av[0])) break; - if (s == NULL) + if (s == NULL) s = server_new(av[0]); av++; Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -1,7 +1,7 @@ /* * Copyright (c) 2006-2008 Linpro AS * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -10,7 +10,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -446,7 +446,7 @@ for (i = 0; i < 10; i++, usleep(100000)) { -#define MAC_STAT(n, t, f, d) \ +#define MAC_STAT(n, t, f, d) \ if (!strcmp(av[0], #n)) { \ val = v->stats->n; \ } else @@ -510,7 +510,7 @@ VTAILQ_FOREACH(v, &varnishes, list) if (!strcmp(v->name, av[0])) break; - if (v == NULL) + if (v == NULL) v = varnish_new(av[0]); av++; Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -286,7 +286,8 @@ static void usage(void) { - fprintf(stderr, "usage: varnishtop %s [-1fV] [-n varnish_name]\n", VSL_USAGE); + fprintf(stderr, + "usage: varnishtop %s [-1fV] [-n varnish_name]\n", VSL_USAGE); exit(1); } Modified: trunk/varnish-cache/include/cli.h =================================================================== --- trunk/varnish-cache/include/cli.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/cli.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -57,7 +57,7 @@ "url.query", \ "url.query ", \ "\tQuery the cache status of a specific URL.\n" \ - "\tReturns the TTL, size and checksum of the object.", \ + "\tReturns the TTL, size and checksum of the object.", \ 1, 1 #define CLI_PURGE_URL \ Modified: trunk/varnish-cache/include/http_headers.h =================================================================== --- trunk/varnish-cache/include/http_headers.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/http_headers.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -28,6 +28,8 @@ * * $Id$ * + * Argument list: + * --------------------------------------- * a Http header name * b session field name * c Request(1)/Response(2) bitfield @@ -38,8 +40,6 @@ * * see [RFC2616 13.5.1 End-to-end and Hop-by-hop Headers] * - * a b c d e f g - *-------------------------------------------------------------------- */ #ifndef HTTPH_R_PASS @@ -51,52 +51,51 @@ #define HTTPH_A_DELIVER (1 << 5) /* Response (o->c) for deliver */ #endif -HTTPH("Keep-Alive", H_Keep_Alive, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH, 0, 0) /* RFC2068 */ - -HTTPH("Accept", H_Accept, 1, 0, 0, 0, 0) /* RFC2616 14.1 */ -HTTPH("Accept-Charset", H_Accept_Charset, 1, 0, 0, 0, 0) /* RFC2616 14.2 */ -HTTPH("Accept-Encoding", H_Accept_Encoding, 1, 0, 0, 0, 0) /* RFC2616 14.3 */ -HTTPH("Accept-Language", H_Accept_Language, 1, 0, 0, 0, 0) /* RFC2616 14.4 */ -HTTPH("Accept-Ranges", H_Accept_Ranges, 2, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.5 */ -HTTPH("Age", H_Age, 2, 0, HTTPH_A_INS, 0, 0) /* RFC2616 14.6 */ -HTTPH("Allow", H_Allow, 2, 0, 0, 0, 0) /* RFC2616 14.7 */ -HTTPH("Authorization", H_Authorization, 1, 0, 0, 0, 0) /* RFC2616 14.8 */ -HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS|HTTPH_R_FETCH, 0, 0) /* RFC2616 14.9 */ -HTTPH("Connection", H_Connection, 3, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.10 */ -HTTPH("Content-Encoding", H_Content_Encoding, 2, 0, 0, 0, 0) /* RFC2616 14.11 */ -HTTPH("Content-Langugae", H_Content_Language, 2, 0, 0, 0, 0) /* RFC2616 14.12 */ -HTTPH("Content-Length", H_Content_Length, 2, 2, HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.13 */ -HTTPH("Content-Location", H_Content_Location, 2, 0, 0, 0, 0) /* RFC2616 14.14 */ -HTTPH("Content-MD5", H_Content_MD5, 2, 0, 0, 0, 0) /* RFC2616 14.15 */ -HTTPH("Content-Range", H_Content_Range, 2, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.16 */ -HTTPH("Content-Type", H_Content_Type, 2, 0, 0, 0, 0) /* RFC2616 14.17 */ -HTTPH("Date", H_Date, 2, 0, HTTPH_A_DELIVER, 0, 0) /* RFC2616 14.18 */ -HTTPH("ETag", H_ETag, 2, 0, 0, 0, 0) /* RFC2616 14.19 */ -HTTPH("Expect", H_Expect, 1, 0, 0, 0, 0) /* RFC2616 14.20 */ -HTTPH("Expires", H_Expires, 2, 0, 0, 0, 0) /* RFC2616 14.21 */ -HTTPH("From", H_From, 1, 0, 0, 0, 0) /* RFC2616 14.22 */ -HTTPH("Host", H_Host, 1, 0, 0, 0, 0) /* RFC2616 14.23 */ -HTTPH("If-Match", H_If_Match, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.24 */ -HTTPH("If-Modified-Since", H_If_Modified_Since, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.25 */ -HTTPH("If-None-Match", H_If_None_Match, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.26 */ -HTTPH("If-Range", H_If_Range, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.27 */ -HTTPH("If-Unmodified-Since", H_If_Unmodifed_Since, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.28 */ -HTTPH("Last-Modified", H_Last_Modified, 2, 0, 0, 0, 0) /* RFC2616 14.29 */ -HTTPH("Location", H_Location, 2, 0, 0, 0, 0) /* RFC2616 14.30 */ -HTTPH("Max-Forwards", H_Max_Forwards, 1, 0, 0, 0, 0) /* RFC2616 14.31 */ -HTTPH("Pragma", H_Pragma, 1, 0, 0, 0, 0) /* RFC2616 14.32 */ -HTTPH("Proxy-Authenticate", H_Proxy_Authenticate, 2, 3, HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.33 */ -HTTPH("Proxy-Authorization", H_Proxy_Authorization, 1, 3, HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.34 */ -HTTPH("Range", H_Range, 1, 0, 0, 0, 0) /* RFC2616 14.35 */ -HTTPH("Referer", H_Referer, 1, 0, 0, 0, 0) /* RFC2616 14.36 */ -HTTPH("Retry-After", H_Retry_After, 2, 0, 0, 0, 0) /* RFC2616 14.37 */ -HTTPH("Server", H_Server, 2, 0, 0, 0, 0) /* RFC2616 14.38 */ -HTTPH("TE", H_TE, 1, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.39 */ -HTTPH("Trailer", H_Trailer, 1, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.40 */ -HTTPH("Transfer-Encoding", H_Transfer_Encoding, 2, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.41 */ -HTTPH("Upgrade", H_Upgrade, 2, 3, HTTPH_R_PASS|HTTPH_A_PASS|HTTPH_R_FETCH|HTTPH_A_INS, 0, 0) /* RFC2616 14.42 */ -HTTPH("User-Agent", H_User_Agent, 1, 0, 0, 0, 0) /* RFC2616 14.43 */ -HTTPH("Vary", H_Vary, 2, 0, 0, 0, 0) /* RFC2616 14.44 */ -HTTPH("Via", H_Via, 2, 0, 0, 0, 0) /* RFC2616 14.45 */ -HTTPH("Warning", H_Warning, 2, 0, 0, 0, 0) /* RFC2616 14.46 */ -HTTPH("WWW-Authenticate", H_WWW_Authenticate, 2, 0, 0, 0, 0) /* RFC2616 14.47 */ +HTTPH("Keep-Alive", H_Keep_Alive, 3, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH, 0, 0) /* RFC2068 */ +HTTPH("Accept", H_Accept, 1, 0, 0, 0, 0) /* RFC2616 14.1 */ +HTTPH("Accept-Charset", H_Accept_Charset, 1, 0, 0, 0, 0) /* RFC2616 14.2 */ +HTTPH("Accept-Encoding", H_Accept_Encoding, 1, 0, 0, 0, 0) /* RFC2616 14.3 */ +HTTPH("Accept-Language", H_Accept_Language, 1, 0, 0, 0, 0) /* RFC2616 14.4 */ +HTTPH("Accept-Ranges", H_Accept_Ranges, 2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.5 */ +HTTPH("Age", H_Age, 2, 0, HTTPH_A_INS, 0, 0) /* RFC2616 14.6 */ +HTTPH("Allow", H_Allow, 2, 0, 0, 0, 0) /* RFC2616 14.7 */ +HTTPH("Authorization", H_Authorization, 1, 0, 0, 0, 0) /* RFC2616 14.8 */ +HTTPH("Cache-Control", H_Cache_Control, 3, 3, HTTPH_R_PASS | HTTPH_R_FETCH, 0, 0) /* RFC2616 14.9 */ +HTTPH("Connection", H_Connection, 3, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.10 */ +HTTPH("Content-Encoding", H_Content_Encoding, 2, 0, 0, 0, 0) /* RFC2616 14.11 */ +HTTPH("Content-Langugae", H_Content_Language, 2, 0, 0, 0, 0) /* RFC2616 14.12 */ +HTTPH("Content-Length", H_Content_Length, 2, 2, HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.13 */ +HTTPH("Content-Location", H_Content_Location, 2, 0, 0, 0, 0) /* RFC2616 14.14 */ +HTTPH("Content-MD5", H_Content_MD5, 2, 0, 0, 0, 0) /* RFC2616 14.15 */ +HTTPH("Content-Range", H_Content_Range, 2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.16 */ +HTTPH("Content-Type", H_Content_Type, 2, 0, 0, 0, 0) /* RFC2616 14.17 */ +HTTPH("Date", H_Date, 2, 0, HTTPH_A_DELIVER, 0, 0) /* RFC2616 14.18 */ +HTTPH("ETag", H_ETag, 2, 0, 0, 0, 0) /* RFC2616 14.19 */ +HTTPH("Expect", H_Expect, 1, 0, 0, 0, 0) /* RFC2616 14.20 */ +HTTPH("Expires", H_Expires, 2, 0, 0, 0, 0) /* RFC2616 14.21 */ +HTTPH("From", H_From, 1, 0, 0, 0, 0) /* RFC2616 14.22 */ +HTTPH("Host", H_Host, 1, 0, 0, 0, 0) /* RFC2616 14.23 */ +HTTPH("If-Match", H_If_Match, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.24 */ +HTTPH("If-Modified-Since", H_If_Modified_Since, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.25 */ +HTTPH("If-None-Match", H_If_None_Match, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.26 */ +HTTPH("If-Range", H_If_Range, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.27 */ +HTTPH("If-Unmodified-Since", H_If_Unmodifed_Since, 1, 1, HTTPH_R_FETCH, 0, 0) /* RFC2616 14.28 */ +HTTPH("Last-Modified", H_Last_Modified, 2, 0, 0, 0, 0) /* RFC2616 14.29 */ +HTTPH("Location", H_Location, 2, 0, 0, 0, 0) /* RFC2616 14.30 */ +HTTPH("Max-Forwards", H_Max_Forwards, 1, 0, 0, 0, 0) /* RFC2616 14.31 */ +HTTPH("Pragma", H_Pragma, 1, 0, 0, 0, 0) /* RFC2616 14.32 */ +HTTPH("Proxy-Authenticate", H_Proxy_Authenticate, 2, 3, HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.33 */ +HTTPH("Proxy-Authorization", H_Proxy_Authorization, 1, 3, HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.34 */ +HTTPH("Range", H_Range, 1, 0, 0, 0, 0) /* RFC2616 14.35 */ +HTTPH("Referer", H_Referer, 1, 0, 0, 0, 0) /* RFC2616 14.36 */ +HTTPH("Retry-After", H_Retry_After, 2, 0, 0, 0, 0) /* RFC2616 14.37 */ +HTTPH("Server", H_Server, 2, 0, 0, 0, 0) /* RFC2616 14.38 */ +HTTPH("TE", H_TE, 1, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.39 */ +HTTPH("Trailer", H_Trailer, 1, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.40 */ +HTTPH("Transfer-Encoding", H_Transfer_Encoding, 2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.41 */ +HTTPH("Upgrade", H_Upgrade, 2, 3, HTTPH_R_PASS | HTTPH_A_PASS | HTTPH_R_FETCH | HTTPH_A_INS, 0, 0) /* RFC2616 14.42 */ +HTTPH("User-Agent", H_User_Agent, 1, 0, 0, 0, 0) /* RFC2616 14.43 */ +HTTPH("Vary", H_Vary, 2, 0, 0, 0, 0) /* RFC2616 14.44 */ +HTTPH("Via", H_Via, 2, 0, 0, 0, 0) /* RFC2616 14.45 */ +HTTPH("Warning", H_Warning, 2, 0, 0, 0, 0) /* RFC2616 14.46 */ +HTTPH("WWW-Authenticate", H_WWW_Authenticate, 2, 0, 0, 0, 0) /* RFC2616 14.47 */ Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/libvarnish.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -60,8 +60,10 @@ void TCP_blocking(int sock); void TCP_nonblocking(int sock); #ifdef SOL_SOCKET -void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen); -int TCP_connect(int s, const struct sockaddr *name, socklen_t namelen, int msec); +void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, + unsigned alen, char *pbuf, unsigned plen); +int TCP_connect(int s, const struct sockaddr *name, socklen_t namelen, + int msec); void TCP_close(int *s); #endif @@ -88,7 +90,8 @@ * handle gracefully, such as malloc failure. */ -typedef void lbv_assert_f(const char *, const char *, int, const char *, int, int); +typedef void lbv_assert_f(const char *, const char *, int, const char *, + int, int); extern lbv_assert_f *lbv_assert; @@ -96,14 +99,14 @@ #define assert(e) ((void)(e)) #else /* WITH_ASSERTS */ #define assert(e) \ -do { \ +do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno, 0); \ } while (0) #endif #define xxxassert(e) \ -do { \ +do { \ if (!(e)) \ lbv_assert(__func__, __FILE__, __LINE__, #e, errno, 1); \ } while (0) @@ -114,7 +117,7 @@ #define XXXAZ(foo) do { xxxassert((foo) == 0); } while (0) #define XXXAN(foo) do { xxxassert((foo) != 0); } while (0) #define diagnostic(foo) assert(foo) -#define WRONG(expl) \ +#define WRONG(expl) \ do { \ lbv_assert(__func__, __FILE__, __LINE__, expl, errno, 3); \ } while (0) Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/stat_field.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -37,7 +37,8 @@ MAC_STAT(cache_miss, uint64_t, 'a', "Cache misses") MAC_STAT(backend_conn, uint64_t, 'a', "Backend connections success") -MAC_STAT(backend_unhealthy, uint64_t, 'a', "Backend connections not attempted") +MAC_STAT(backend_unhealthy, uint64_t, 'a', + "Backend connections not attempted") MAC_STAT(backend_busy, uint64_t, 'a', "Backend connections too many") MAC_STAT(backend_fail, uint64_t, 'a', "Backend connections failures") MAC_STAT(backend_reuse, uint64_t, 'a', "Backend connections reuses") Modified: trunk/varnish-cache/include/varnishapi.h =================================================================== --- trunk/varnish-cache/include/varnishapi.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/varnishapi.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -41,11 +41,13 @@ int base64_decode(char *d, unsigned dlen, const char *s); /* shmlog.c */ -typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr); +typedef int vsl_handler(void *priv, enum shmlogtag tag, unsigned fd, + unsigned len, unsigned spec, const char *ptr); #define VSL_S_CLIENT (1 << 0) #define VSL_S_BACKEND (1 << 1) #define VSL_ARGS "bCcdI:i:k:r:s:X:x:" -#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-k keep] [-r file] [-s skip] [-X regexp] [-x tag]" +#define VSL_USAGE "[-bCcd] [-i tag] [-I regexp] [-k keep]" \ + " [-r file] [-s skip] [-X regexp] [-x tag]" vsl_handler VSL_H_Print; struct VSL_data; struct VSL_data *VSL_New(void); @@ -60,6 +62,6 @@ extern const char *VSL_tags[256]; /* instance.c */ -int varnish_instance(const char *n_arg, char *name, size_t namelen, char *dir, size_t dirlen); - +int varnish_instance(const char *n_arg, char *name, size_t namelen, char *dir, + size_t dirlen); #endif Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vcl.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -23,7 +23,7 @@ unsigned nref; unsigned busy; unsigned discard; - + unsigned nsrc; const char **srcname; const char **srcbody; Modified: trunk/varnish-cache/include/vcl_returns.h =================================================================== --- trunk/varnish-cache/include/vcl_returns.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vcl_returns.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -34,18 +34,30 @@ #endif #ifdef VCL_MET_MAC -VCL_MET_MAC(recv,RECV,(VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_PIPE|VCL_RET_LOOKUP)) -VCL_MET_MAC(pipe,PIPE,(VCL_RET_ERROR|VCL_RET_PIPE)) -VCL_MET_MAC(pass,PASS,(VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS)) -VCL_MET_MAC(hash,HASH,(VCL_RET_HASH)) -VCL_MET_MAC(miss,MISS,(VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_FETCH)) -VCL_MET_MAC(hit,HIT,(VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER)) -VCL_MET_MAC(fetch,FETCH,(VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER)) -VCL_MET_MAC(deliver,DELIVER,(VCL_RET_RESTART|VCL_RET_DELIVER)) -VCL_MET_MAC(prefetch,PREFETCH,(VCL_RET_FETCH|VCL_RET_PASS)) -VCL_MET_MAC(timeout,TIMEOUT,(VCL_RET_FETCH|VCL_RET_DISCARD)) -VCL_MET_MAC(discard,DISCARD,(VCL_RET_DISCARD|VCL_RET_KEEP)) -VCL_MET_MAC(error,ERROR,(VCL_RET_DELIVER)) +VCL_MET_MAC(recv,RECV,( + VCL_RET_ERROR|VCL_RET_PASS|VCL_RET_PIPE|VCL_RET_LOOKUP)) +VCL_MET_MAC(pipe,PIPE,( + VCL_RET_ERROR|VCL_RET_PIPE)) +VCL_MET_MAC(pass,PASS,( + VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS)) +VCL_MET_MAC(hash,HASH,( + VCL_RET_HASH)) +VCL_MET_MAC(miss,MISS,( + VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_FETCH)) +VCL_MET_MAC(hit,HIT,( + VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER)) +VCL_MET_MAC(fetch,FETCH,( + VCL_RET_ERROR|VCL_RET_RESTART|VCL_RET_PASS|VCL_RET_DELIVER)) +VCL_MET_MAC(deliver,DELIVER,( + VCL_RET_RESTART|VCL_RET_DELIVER)) +VCL_MET_MAC(prefetch,PREFETCH,( + VCL_RET_FETCH|VCL_RET_PASS)) +VCL_MET_MAC(timeout,TIMEOUT,( + VCL_RET_FETCH|VCL_RET_DISCARD)) +VCL_MET_MAC(discard,DISCARD,( + VCL_RET_DISCARD|VCL_RET_KEEP)) +VCL_MET_MAC(error,ERROR,( + VCL_RET_DELIVER)) #else #define VCL_MET_RECV (1 << 0) #define VCL_MET_PIPE (1 << 1) Modified: trunk/varnish-cache/include/vct.h =================================================================== --- trunk/varnish-cache/include/vct.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vct.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -31,10 +31,10 @@ /* from libvarnish/vct.c */ -#define VCT_SP (1<<0) -#define VCT_CRLF (1<<1) -#define VCT_LWS (VCT_CRLF | VCT_SP) -#define VCT_CTL (1<<2) +#define VCT_SP (1<<0) +#define VCT_CRLF (1<<1) +#define VCT_LWS (VCT_CRLF | VCT_SP) +#define VCT_CTL (1<<2) #define VCT_ALPHA (1<<3) #define VCT_SEPARATOR (1<<4) #define VCT_DIGIT (1<<5) @@ -45,8 +45,8 @@ static inline int vct_is(unsigned char x, unsigned char y) { - - return (vct_typtab[x] & (y)); + + return (vct_typtab[x] & (y)); } #define vct_issp(x) vct_is(x, VCT_SP) Modified: trunk/varnish-cache/include/vev.h =================================================================== --- trunk/varnish-cache/include/vev.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vev.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -40,7 +40,7 @@ struct vev { unsigned magic; -#define VEV_MAGIC 0x46bbd419 +#define VEV_MAGIC 0x46bbd419 /* pub */ const char *name; Modified: trunk/varnish-cache/include/vqueue.h =================================================================== --- trunk/varnish-cache/include/vqueue.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vqueue.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -220,7 +220,8 @@ } while (0) #define VSTAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \ - if ((VSTAILQ_NEXT((elm), field) = VSTAILQ_NEXT((tqelm), field)) == NULL)\ + if ((VSTAILQ_NEXT((elm), field) = \ + VSTAILQ_NEXT((tqelm), field)) == NULL) \ (head)->vstqh_last = &VSTAILQ_NEXT((elm), field); \ VSTAILQ_NEXT((tqelm), field) = (elm); \ } while (0) @@ -241,7 +242,8 @@ (VSTAILQ_EMPTY((head)) ? \ NULL : \ ((struct type *)(void *) \ - ((char *)((head)->vstqh_last) - __offsetof(struct type, field)))) + ((char *)((head)->vstqh_last) - \ + __offsetof(struct type, field)))) #define VSTAILQ_NEXT(elm, field) ((elm)->field.vstqe_next) @@ -320,7 +322,8 @@ #define VLIST_INSERT_HEAD(head, elm, field) do { \ if ((VLIST_NEXT((elm), field) = VLIST_FIRST((head))) != NULL) \ - VLIST_FIRST((head))->field.vle_prev = &VLIST_NEXT((elm), field);\ + VLIST_FIRST((head))->field.vle_prev = \ + &VLIST_NEXT((elm), field); \ VLIST_FIRST((head)) = (elm); \ (elm)->field.vle_prev = &VLIST_FIRST((head)); \ } while (0) @@ -329,7 +332,7 @@ #define VLIST_REMOVE(elm, field) do { \ if (VLIST_NEXT((elm), field) != NULL) \ - VLIST_NEXT((elm), field)->field.vle_prev = \ + VLIST_NEXT((elm), field)->field.vle_prev = \ (elm)->field.vle_prev; \ *(elm)->field.vle_prev = VLIST_NEXT((elm), field); \ } while (0) @@ -394,8 +397,9 @@ } while (0) #define VTAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if ((VTAILQ_NEXT((elm), field) = VTAILQ_NEXT((listelm), field)) != NULL)\ - VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ + if ((VTAILQ_NEXT((elm), field) = \ + VTAILQ_NEXT((listelm), field)) != NULL) \ + VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ &VTAILQ_NEXT((elm), field); \ else { \ (head)->vtqh_last = &VTAILQ_NEXT((elm), field); \ @@ -438,7 +442,7 @@ #define VTAILQ_REMOVE(head, elm, field) do { \ if ((VTAILQ_NEXT((elm), field)) != NULL) \ - VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ + VTAILQ_NEXT((elm), field)->field.vtqe_prev = \ (elm)->field.vtqe_prev; \ else { \ (head)->vtqh_last = (elm)->field.vtqe_prev; \ Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vrt.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -70,7 +70,7 @@ double connect_timeout; unsigned max_connections; - struct vrt_backend_probe probe; + struct vrt_backend_probe probe; }; /* @@ -92,9 +92,9 @@ }; struct vrt_dir_random { - const char *name; + const char *name; unsigned retries; - unsigned nmember; + unsigned nmember; const struct vrt_dir_random_entry *members; }; @@ -108,7 +108,7 @@ struct vrt_dir_round_robin { const char *name; - unsigned nmember; + unsigned nmember; const struct vrt_dir_round_robin_entry *members; }; @@ -137,7 +137,8 @@ void VRT_re_fini(void *); int VRT_re_match(const char *, void *re); int VRT_re_test(struct vsb *, const char *, int sub); -const char *VRT_regsub(const struct sess *sp, int all, const char *, void *, const char *); +const char *VRT_regsub(const struct sess *sp, int all, const char *, + void *, const char *); void VRT_panic(struct sess *sp, const char *, ...); void VRT_purge(const char *, int hash); @@ -149,7 +150,8 @@ enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ }; char *VRT_GetHdr(const struct sess *, enum gethdr_e where, const char *); -void VRT_SetHdr(const struct sess *, enum gethdr_e where, const char *, const char *, ...); +void VRT_SetHdr(const struct sess *, enum gethdr_e where, const char *, + const char *, ...); void VRT_handling(struct sess *sp, unsigned hand); /* Simple stuff */ @@ -163,9 +165,12 @@ void VRT_synth_page(struct sess *sp, unsigned flags, const char *, ...); /* Backend related */ -void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *); -void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *); -void VRT_init_dir_round_robin(struct cli *, struct director **, const struct vrt_dir_round_robin *); +void VRT_init_dir_simple(struct cli *, struct director **, + const struct vrt_dir_simple *); +void VRT_init_dir_random(struct cli *, struct director **, + const struct vrt_dir_random *); +void VRT_init_dir_round_robin(struct cli *, struct director **, + const struct vrt_dir_round_robin *); void VRT_fini_dir(struct cli *, struct director *); char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa); Modified: trunk/varnish-cache/include/vsb.h =================================================================== --- trunk/varnish-cache/include/vsb.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/include/vsb.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -65,9 +65,11 @@ int vsb_bcpy(struct vsb *, const void *, size_t); int vsb_cat(struct vsb *, const char *); int vsb_cpy(struct vsb *, const char *); -int vsb_printf(struct vsb *, const char *, ...) /* __printflike(2, 3) */; +int vsb_printf(struct vsb *, const char *, ...) + /* __printflike(2, 3) */; #ifdef va_start -int vsb_vprintf(struct vsb *, const char *, va_list) /* __printflike(2, 0) */; +int vsb_vprintf(struct vsb *, const char *, va_list) + /* __printflike(2, 0) */; #endif int vsb_putc(struct vsb *, int); int vsb_trim(struct vsb *); Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -41,7 +41,8 @@ #include "libvarnish.h" static void -lbv_assert_default(const char *func, const char *file, int line, const char *cond, int err, int xxx) +lbv_assert_default(const char *func, const char *file, int line, + const char *cond, int err, int xxx) { if (xxx) { Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -225,11 +225,9 @@ #ifdef TEST_DRIVER /* Test driver -------------------------------------------------------*/ - #include #if 0 - static int cmp(void *priv, void *a, void *b) { @@ -295,11 +293,9 @@ dump(bh, "Delete", u); } printf("Deletes done\n"); - return (0); } #else - struct foo { unsigned idx; unsigned key; @@ -310,7 +306,6 @@ struct foo ff[N]; - static int cmp(void *priv, void *a, void *b) { @@ -359,12 +354,12 @@ struct binheap *bh; unsigned u, v; -#if 0 - srandomdev(); - u = random(); - printf("Seed %u\n", u); - srandom(u); -#endif + if (0) { + srandomdev(); + u = random(); + printf("Seed %u\n", u); + srandom(u); + } bh = binheap_new(NULL, cmp, update); for (u = 0; u < M; u++) { v = random() % N; Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -132,7 +132,8 @@ { cli_result(cli, CLIS_PARAM); - cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n"); + cli_out(cli, + "Parameter error, use \"help [command]\" for more info.\n"); } int Modified: trunk/varnish-cache/lib/libvarnish/num.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/num.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/num.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -125,45 +125,45 @@ uintmax_t val; const char *err; } test_cases[] = { - { "1", (uintmax_t)0, (uintmax_t)1 }, - { "1B", (uintmax_t)0, (uintmax_t)1<<0 }, - { "1 B", (uintmax_t)0, (uintmax_t)1<<0 }, - { "1.3B", (uintmax_t)0, (uintmax_t)1 }, - { "1.7B", (uintmax_t)0, (uintmax_t)2 }, + { "1", (uintmax_t)0, (uintmax_t)1 }, + { "1B", (uintmax_t)0, (uintmax_t)1<<0 }, + { "1 B", (uintmax_t)0, (uintmax_t)1<<0 }, + { "1.3B", (uintmax_t)0, (uintmax_t)1 }, + { "1.7B", (uintmax_t)0, (uintmax_t)2 }, - { "1024", (uintmax_t)0, (uintmax_t)1024 }, - { "1k", (uintmax_t)0, (uintmax_t)1<<10 }, - { "1kB", (uintmax_t)0, (uintmax_t)1<<10 }, - { "1.3kB", (uintmax_t)0, (uintmax_t)1331 }, - { "1.7kB", (uintmax_t)0, (uintmax_t)1741 }, + { "1024", (uintmax_t)0, (uintmax_t)1024 }, + { "1k", (uintmax_t)0, (uintmax_t)1<<10 }, + { "1kB", (uintmax_t)0, (uintmax_t)1<<10 }, + { "1.3kB", (uintmax_t)0, (uintmax_t)1331 }, + { "1.7kB", (uintmax_t)0, (uintmax_t)1741 }, - { "1048576", (uintmax_t)0, (uintmax_t)1048576 }, - { "1M", (uintmax_t)0, (uintmax_t)1<<20 }, - { "1MB", (uintmax_t)0, (uintmax_t)1<<20 }, - { "1.3MB", (uintmax_t)0, (uintmax_t)1363149 }, - { "1.7MB", (uintmax_t)0, (uintmax_t)1782579 }, + { "1048576", (uintmax_t)0, (uintmax_t)1048576 }, + { "1M", (uintmax_t)0, (uintmax_t)1<<20 }, + { "1MB", (uintmax_t)0, (uintmax_t)1<<20 }, + { "1.3MB", (uintmax_t)0, (uintmax_t)1363149 }, + { "1.7MB", (uintmax_t)0, (uintmax_t)1782579 }, - { "1073741824", (uintmax_t)0, (uintmax_t)1073741824 }, - { "1G", (uintmax_t)0, (uintmax_t)1<<30 }, - { "1GB", (uintmax_t)0, (uintmax_t)1<<30 }, - { "1.3GB", (uintmax_t)0, (uintmax_t)1395864371 }, - { "1.7GB", (uintmax_t)0, (uintmax_t)1825361101 }, + { "1073741824", (uintmax_t)0, (uintmax_t)1073741824 }, + { "1G", (uintmax_t)0, (uintmax_t)1<<30 }, + { "1GB", (uintmax_t)0, (uintmax_t)1<<30 }, + { "1.3GB", (uintmax_t)0, (uintmax_t)1395864371 }, + { "1.7GB", (uintmax_t)0, (uintmax_t)1825361101 }, - { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776ULL }, - { "1T", (uintmax_t)0, (uintmax_t)1<<40 }, - { "1TB", (uintmax_t)0, (uintmax_t)1<<40 }, - { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109ULL }, - { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219ULL }, + { "1099511627776", (uintmax_t)0, (uintmax_t)1099511627776ULL }, + { "1T", (uintmax_t)0, (uintmax_t)1<<40 }, + { "1TB", (uintmax_t)0, (uintmax_t)1<<40 }, + { "1.3TB", (uintmax_t)0, (uintmax_t)1429365116109ULL }, + { "1.7TB", (uintmax_t)0, (uintmax_t)1869169767219ULL }, { "1%", (uintmax_t)1024, (uintmax_t)10 }, { "2%", (uintmax_t)1024, (uintmax_t)20 }, { "3%", (uintmax_t)1024, (uintmax_t)31 }, /* Check the error checks */ - { "", 0, 0, err_miss_num }, - { "m", 0, 0, err_invalid_num }, - { "4%", 0, 0, err_abs_req }, - { "3*", 0, 0, err_invalid_suff }, + { "", 0, 0, err_miss_num }, + { "m", 0, 0, err_invalid_num }, + { "4%", 0, 0, err_abs_req }, + { "3*", 0, 0, err_invalid_suff }, /* TODO: add more */ Modified: trunk/varnish-cache/lib/libvarnish/tcp.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/tcp.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/tcp.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -58,7 +58,8 @@ /*--------------------------------------------------------------------*/ void -TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen) +TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, + char *pbuf, unsigned plen) { int i; @@ -119,7 +120,7 @@ /*-------------------------------------------------------------------- * Functions for controlling NONBLOCK mode. - * + * * We use FIONBIO because it is cheaper than fcntl(2), which requires * us to do two syscalls, one to get and one to set, the latter of * which mucks about a bit before it ends up calling ioctl(FIONBIO), Modified: trunk/varnish-cache/lib/libvarnish/vct.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vct.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/vct.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -70,12 +70,12 @@ [0x1d] = VCT_CTL, [0x1e] = VCT_CTL, [0x1f] = VCT_CTL, - [0x20] = VCT_SP | VCT_SEPARATOR, - [0x22] = VCT_SEPARATOR, - [0x28] = VCT_SEPARATOR, - [0x29] = VCT_SEPARATOR, - [0x2c] = VCT_SEPARATOR, - [0x2f] = VCT_SEPARATOR, + [0x20] = VCT_SP | VCT_SEPARATOR, + [0x22] = VCT_SEPARATOR, + [0x28] = VCT_SEPARATOR, + [0x29] = VCT_SEPARATOR, + [0x2c] = VCT_SEPARATOR, + [0x2f] = VCT_SEPARATOR, [0x30] = VCT_DIGIT | VCT_HEX, [0x31] = VCT_DIGIT | VCT_HEX, [0x32] = VCT_DIGIT | VCT_HEX, @@ -86,13 +86,13 @@ [0x37] = VCT_DIGIT | VCT_HEX, [0x38] = VCT_DIGIT | VCT_HEX, [0x39] = VCT_DIGIT | VCT_HEX, - [0x3a] = VCT_SEPARATOR, - [0x3b] = VCT_SEPARATOR, - [0x3c] = VCT_SEPARATOR, - [0x3d] = VCT_SEPARATOR, - [0x3e] = VCT_SEPARATOR, - [0x3f] = VCT_SEPARATOR, - [0x40] = VCT_SEPARATOR, + [0x3a] = VCT_SEPARATOR, + [0x3b] = VCT_SEPARATOR, + [0x3c] = VCT_SEPARATOR, + [0x3d] = VCT_SEPARATOR, + [0x3e] = VCT_SEPARATOR, + [0x3f] = VCT_SEPARATOR, + [0x40] = VCT_SEPARATOR, [0x41] = VCT_UPALPHA | VCT_HEX, [0x42] = VCT_UPALPHA | VCT_HEX, [0x43] = VCT_UPALPHA | VCT_HEX, @@ -119,9 +119,9 @@ [0x58] = VCT_UPALPHA, [0x59] = VCT_UPALPHA, [0x5a] = VCT_UPALPHA, - [0x5b] = VCT_SEPARATOR, - [0x5c] = VCT_SEPARATOR, - [0x5d] = VCT_SEPARATOR, + [0x5b] = VCT_SEPARATOR, + [0x5c] = VCT_SEPARATOR, + [0x5d] = VCT_SEPARATOR, [0x61] = VCT_LOALPHA | VCT_HEX, [0x62] = VCT_LOALPHA | VCT_HEX, [0x63] = VCT_LOALPHA | VCT_HEX, @@ -148,7 +148,7 @@ [0x78] = VCT_LOALPHA, [0x79] = VCT_LOALPHA, [0x7a] = VCT_LOALPHA, - [0x7b] = VCT_SEPARATOR, - [0x7d] = VCT_SEPARATOR, + [0x7b] = VCT_SEPARATOR, + [0x7d] = VCT_SEPARATOR, [0x7f] = VCT_CTL, }; Modified: trunk/varnish-cache/lib/libvarnish/version.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/version.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/version.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -43,5 +43,6 @@ { fprintf(stderr, "%s (%s-%s)\n", progname, PACKAGE_TARNAME, PACKAGE_VERSION); - fprintf(stderr, "Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS\n"); + fprintf(stderr, + "Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS\n"); } Modified: trunk/varnish-cache/lib/libvarnish/vlu.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vlu.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/vlu.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -63,7 +63,7 @@ if (l->buf == NULL) { FREE_OBJ(l); l = NULL; - } + } } return (l); } Modified: trunk/varnish-cache/lib/libvarnish/vss.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vss.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnish/vss.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -283,7 +283,7 @@ if (retval >= 0) break; } - for (n = 0; n < nvaddr; n++) + for (n = 0; n < nvaddr; n++) free(vaddr[n]); free(vaddr); free(addr); Modified: trunk/varnish-cache/lib/libvarnishapi/instance.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -39,8 +39,7 @@ int varnish_instance(const char *n_arg, - char *name, size_t namelen, - char *dir, size_t dirlen) + char *name, size_t namelen, char *dir, size_t dirlen) { size_t len; Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -362,7 +362,8 @@ /*--------------------------------------------------------------------*/ int -VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, unsigned spec, const char *ptr) +VSL_H_Print(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, + unsigned spec, const char *ptr) { FILE *fo = priv; int type; Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -52,7 +52,7 @@ struct acl_e { VTAILQ_ENTRY(acl_e) list; unsigned char data[VRT_ACL_MAXADDR + 1]; - unsigned mask; + unsigned mask; unsigned not; unsigned para; struct token *t_addr; @@ -74,9 +74,9 @@ if (ae2->mask < m) m = ae2->mask; for (; m >= 8; m -= 8) { - if (*p1 < *p2) + if (*p1 < *p2) return (-1); - if (*p1 > *p2) + if (*p1 > *p2) return (1); p1++; p2++; @@ -135,7 +135,8 @@ } static void -vcc_acl_emit_entry(struct tokenlist *tl, const struct acl_e *ae, int l, const unsigned char *u, int fam) +vcc_acl_emit_entry(struct tokenlist *tl, const struct acl_e *ae, int l, + const unsigned char *u, int fam) { struct acl_e *ae2; @@ -186,7 +187,7 @@ Fh(tl, 1, "/* Ignored ACL entry: %s%s", ae->para ? "\"(\" " : "", ae->not ? "\"!\" " : ""); EncToken(tl->fh, ae->t_addr); - if (ae->t_mask) + if (ae->t_mask) Fh(tl, 0, "/%u", ae->mask); Fh(tl, 0, "%s\n", ae->para ? " \")\"" : ""); Fh(tl, 1, " * getaddrinfo: %s */\n", @@ -322,7 +323,8 @@ } static void -vcc_acl_bot(const struct tokenlist *tl, const char *acln, int silent, const char *pfx) +vcc_acl_bot(const struct tokenlist *tl, const char *acln, int silent, + const char *pfx) { struct acl_e *ae; int depth, l, m, i; @@ -346,7 +348,7 @@ Fh(tl, 0, "\tunsigned int fam;\n"); else assert(0 == __LINE__); - + Fh(tl, 0, "\n"); Fh(tl, 0, "\ta = p;\n"); Fh(tl, 0, "\tVRT_memmove(&fam, a + %d, sizeof fam);\n", @@ -421,7 +423,7 @@ Fh(tl, 0, "\t%*sreturn (%d);\n", -i, "", ae->not ? 0 : 1); } - for (; 0 <= depth; depth--) + for (; 0 <= depth; depth--) Fh(tl, 0, "\t%*.*s}\n", depth, depth, ""); if (!silent) Fh(tl, 0, "\tVRT_acl_log(sp, \"NO_MATCH %s\");\n", acln); @@ -439,7 +441,8 @@ vcc_NextToken(tl); ExpectErr(tl, ID); vcc_AddRef(tl, tl->t, R_ACL); - Fb(tl, 1, "match_acl_named_%.*s(sp, %s)\n", PF(tl->t), vp->rname); + Fb(tl, 1, "match_acl_named_%.*s(sp, %s)\n", + PF(tl->t), vp->rname); vcc_NextToken(tl); break; case T_EQ: Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -42,13 +42,13 @@ /*--------------------------------------------------------------------*/ -#define VCL_RET_MAC(l,u,b,i) \ +#define VCL_RET_MAC(l,u,b,i) \ static void \ parse_##l(struct tokenlist *tl) \ { \ \ - Fb(tl, 1, "VRT_done(sp, VCL_RET_%s);\n", #u); \ - vcc_ProcAction(tl->curproc, i, tl->t); \ + Fb(tl, 1, "VRT_done(sp, VCL_RET_%s);\n", #u); \ + vcc_ProcAction(tl->curproc, i, tl->t); \ vcc_NextToken(tl); \ } @@ -61,7 +61,7 @@ parse_restart_real(struct tokenlist *tl) { struct token *t1; - + t1 = VTAILQ_NEXT(tl->t, list); if (t1->tok == ID && vcc_IdIs(t1, "rollback")) { Fb(tl, 1, "VRT_Rollback(sp);\n"); @@ -201,7 +201,8 @@ Fb(tl, 0, "%u", vcc_UintVal(tl)); vcc_NextToken(tl); } else { - vsb_printf(tl->sb, "Cannot assign this variable type.\n"); + vsb_printf(tl->sb, + "Cannot assign this variable type.\n"); vcc_ErrWhere(tl, vt); return; } @@ -269,7 +270,7 @@ vcc_ExpectedStringval(tl); return; } - do + do Fb(tl, 0, ", "); while (vcc_StringVal(tl)); if (tl->t->tok != ';') { @@ -338,17 +339,17 @@ { vcc_NextToken(tl); - + Fb(tl, 1, "VRT_purge("); - + Expect(tl, '('); vcc_NextToken(tl); - + if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; } - + Expect(tl, ')'); vcc_NextToken(tl); Fb(tl, 0, ", 0);\n"); @@ -362,17 +363,17 @@ { vcc_NextToken(tl); - + Fb(tl, 1, "VRT_purge("); - + Expect(tl, '('); vcc_NextToken(tl); - + if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; } - + Expect(tl, ')'); vcc_NextToken(tl); Fb(tl, 0, ", 1);\n"); @@ -392,13 +393,13 @@ parse_panic(struct tokenlist *tl) { vcc_NextToken(tl); - + Fb(tl, 1, "VRT_panic(sp, "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; } - do + do Fb(tl, 0, ", "); while (vcc_StringVal(tl)); Fb(tl, 0, " vrt_magic_string_end);\n"); @@ -410,13 +411,13 @@ parse_synthetic(struct tokenlist *tl) { vcc_NextToken(tl); - + Fb(tl, 1, "VRT_synth_page(sp, 0, "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; } - do + do Fb(tl, 0, ", "); while (vcc_StringVal(tl)); Fb(tl, 0, " vrt_magic_string_end);\n"); @@ -432,21 +433,21 @@ } action_table[] = { { "restart", parse_restart_real }, #define VCL_RET_MAC(l, u, b, i) { #l, parse_##l }, -#define VCL_RET_MAC_E(l, u, b, i) VCL_RET_MAC(l, u, b, i) +#define VCL_RET_MAC_E(l, u, b, i) VCL_RET_MAC(l, u, b, i) #include "vcl_returns.h" #undef VCL_RET_MAC #undef VCL_RET_MAC_E /* Keep list sorted from here */ - { "call", parse_call }, + { "call", parse_call }, { "esi", parse_esi }, { "panic", parse_panic }, { "purge_hash", parse_purge_hash }, { "purge_url", parse_purge_url }, - { "remove", parse_unset }, /* backward compatibility */ - { "set", parse_set }, - { "synthetic", parse_synthetic }, - { "unset", parse_unset }, + { "remove", parse_unset }, /* backward compatibility */ + { "set", parse_set }, + { "synthetic", parse_synthetic }, + { "unset", parse_unset }, { NULL, NULL } }; Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -37,7 +37,7 @@ * A VCL backend therefore has an implicit director of type "simple" created * by the compiler, but not visible in VCL. * - * A VCL backend is a "named host", these can be referenced by name form + * A VCL backend is a "named host", these can be referenced by name from * VCL directors, but not from VCL backends. * * The reason for this quasimadness is that we want to collect statistics @@ -90,13 +90,14 @@ } /*-------------------------------------------------------------------- - * Struct sockaddr is not really designed to be a compile time + * Struct sockaddr is not really designed to be a compile time * initialized data structure, so we encode it as a byte-string * and put it in an official sockaddr when we load the VCL. */ static void -Emit_Sockaddr(struct tokenlist *tl, const struct token *t_host, const char *port) +Emit_Sockaddr(struct tokenlist *tl, const struct token *t_host, + const char *port) { struct addrinfo *res, *res0, hint; int n4, n6, len, error, retval; @@ -118,7 +119,7 @@ if (res->ai_family == PF_INET) { if (n4++ == 0) emit = "ipv4_sockaddr"; - else + else multiple = "IPv4"; } else if (res->ai_family == PF_INET6) { if (n6++ == 0) @@ -155,12 +156,12 @@ Fh(tl, 0, " %3u, /* Length */\n", res->ai_addrlen); u = (void*)res->ai_addr; for (len = 0; len < res->ai_addrlen; len++) { - if ((len % 8) == 0) + if ((len % 8) == 0) Fh(tl, 0, " "); Fh(tl, 0, " %3u", u[len]); if (len + 1 < res->ai_addrlen) Fh(tl, 0, ","); - if ((len % 8) == 7) + if ((len % 8) == 7) Fh(tl, 0, "\n"); } Fh(tl, 0, "\n};\n"); @@ -188,7 +189,9 @@ */ static void -vcc_EmitBeIdent(struct vsb *v, const struct token *name, const struct token *qual, int serial, const struct token *first, const struct token *last) +vcc_EmitBeIdent(struct vsb *v, const struct token *name, + const struct token *qual, int serial, const struct token *first, + const struct token *last) { AN(name); @@ -276,7 +279,7 @@ vcc_NextToken(tl); for (; fs->name != NULL; fs++) { - if (!vcc_IdIs(t_field, fs->name + 1)) + if (!vcc_IdIs(t_field, fs->name + 1)) continue; if (fs->found == NULL) { fs->found = t_field; @@ -315,7 +318,8 @@ */ static void -vcc_ProbeRedef(struct tokenlist *tl, struct token **t_did, struct token *t_field) +vcc_ProbeRedef(struct tokenlist *tl, struct token **t_did, + struct token *t_field) { /* .url and .request are mutually exclusive */ @@ -446,25 +450,14 @@ } /*-------------------------------------------------------------------- - * Parse and emit a backend host definition + * Parse and emit a backend host definition * - * The syntax is the following: - * - * backend_host_def: - * '{' be_elements '}' - * - * be_elements: - * be_element - * be_element be_elements - * - * be_element: - * '.' name '=' value ';' - * * The struct vrt_backend is emitted to Fh(). */ static void -vcc_ParseHostDef(struct tokenlist *tl, int *nbh, const struct token *name, const struct token *qual, int serial) +vcc_ParseHostDef(struct tokenlist *tl, int *nbh, const struct token *name, + const struct token *qual, int serial) { struct token *t_field; struct token *t_first; @@ -627,7 +620,8 @@ */ void -vcc_ParseBackendHost(struct tokenlist *tl, int *nbh, const struct token *name, const struct token *qual, int serial) +vcc_ParseBackendHost(struct tokenlist *tl, int *nbh, const struct token *name, + const struct token *qual, int serial) { struct host *h; struct token *t; @@ -674,7 +668,8 @@ */ static void -vcc_ParseSimpleDirector(struct tokenlist *tl, const struct token *t_first, struct token *t_dir) +vcc_ParseSimpleDirector(struct tokenlist *tl, const struct token *t_first, + struct token *t_dir) { struct host *h; @@ -707,8 +702,8 @@ const char *name; parsedirector_f *func; } dirlist[] = { - { "random", vcc_ParseRandomDirector }, - { "round-robin", vcc_ParseRoundRobinDirector }, + { "random", vcc_ParseRandomDirector }, + { "round-robin", vcc_ParseRoundRobinDirector }, { NULL, NULL } }; @@ -738,7 +733,7 @@ t_policy = tl->t; vcc_NextToken(tl); - for (dl = dirlist; dl->name != NULL; dl++) + for (dl = dirlist; dl->name != NULL; dl++) if (vcc_IdIs(t_policy, dl->name)) break; if (dl->name == NULL) { Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -700,6 +700,4 @@ vcc_default_vcl_b = default_vcl; vcc_default_vcl_e = strchr(default_vcl, '\0'); assert(vcc_default_vcl_e != NULL); - - vcl_init_tnames(); } Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -158,10 +158,12 @@ /* vcc_backend.c */ struct fld_spec; -typedef void parsedirector_f(struct tokenlist *tl, const struct token *t_policy, const struct token *t_dir); +typedef void parsedirector_f(struct tokenlist *tl, + const struct token *t_policy, const struct token *t_dir); void vcc_ParseDirector(struct tokenlist *tl); -void vcc_ParseBackendHost(struct tokenlist *tl, int *nbr, const struct token *name, const struct token *qual, int serial); +void vcc_ParseBackendHost(struct tokenlist *tl, int *nbr, + const struct token *name, const struct token *qual, int serial); struct fld_spec * vcc_FldSpec(struct tokenlist *tl, const char *first, ...); void vcc_ResetFldSpec(struct fld_spec *f); void vcc_IsField(struct tokenlist *tl, struct token **t, struct fld_spec *fs); @@ -203,7 +205,8 @@ void vcc_ExpectedStringval(struct tokenlist *tl); /* vcc_token.c */ -void vcc_Coord(const struct tokenlist *tl, struct vsb *vsb, const struct token *t); +void vcc_Coord(const struct tokenlist *tl, struct vsb *vsb, + const struct token *t); void vcc_ErrToken(const struct tokenlist *tl, const struct token *t); void vcc_ErrWhere(struct tokenlist *tl, const struct token *t); void vcc__Expect(struct tokenlist *tl, unsigned tok, int line); @@ -212,11 +215,14 @@ void vcc_ExpectCid(struct tokenlist *tl); void vcc_Lexer(struct tokenlist *tl, struct source *sp); void vcc_NextToken(struct tokenlist *tl); -void vcc__ErrInternal(struct tokenlist *tl, const char *func, unsigned line); -void vcc_AddToken(struct tokenlist *tl, unsigned tok, const char *b, const char *e); +void vcc__ErrInternal(struct tokenlist *tl, const char *func, + unsigned line); +void vcc_AddToken(struct tokenlist *tl, unsigned tok, const char *b, + const char *e); /* vcc_var.c */ -struct var *vcc_FindVar(struct tokenlist *tl, const struct token *t, struct var *vl); +struct var *vcc_FindVar(struct tokenlist *tl, const struct token *t, + struct var *vl); /* vcc_xref.c */ void vcc_AddDef(struct tokenlist *tl, struct token *t, enum ref_type type); Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_random.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -50,7 +50,8 @@ */ void -vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_policy, const struct token *t_dir) +vcc_ParseRandomDirector(struct tokenlist *tl, const struct token *t_policy, + const struct token *t_dir) { struct token *t_field, *t_be; int nbh, nelem; @@ -91,7 +92,7 @@ ExpectErr(tl, '{'); vcc_NextToken(tl); Fc(tl, 0, "\t{"); - + while (tl->t->tok != '}') { /* Member fields */ vcc_IsField(tl, &t_field, mfs); ERRCHK(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -49,7 +49,8 @@ */ void -vcc_ParseRoundRobinDirector(struct tokenlist *tl, const struct token *t_policy, const struct token *t_dir) +vcc_ParseRoundRobinDirector(struct tokenlist *tl, const struct token *t_policy, + const struct token *t_dir) { struct token *t_field, *t_be; int nbh, nelem; @@ -58,9 +59,8 @@ fs = vcc_FldSpec(tl, "!backend", NULL); - Fc(tl, 0, - "\nstatic const struct vrt_dir_round_robin_entry vdrre_%.*s[] = {\n", - PF(t_dir)); + Fc(tl, 0, "\nstatic const struct vrt_dir_round_robin_entry " + "vdrre_%.*s[] = {\n", PF(t_dir)); for (nelem = 0; tl->t->tok != '}'; nelem++) { /* List of members */ first = ""; @@ -71,7 +71,7 @@ ExpectErr(tl, '{'); vcc_NextToken(tl); Fc(tl, 0, "\t{"); - + while (tl->t->tok != '}') { /* Member fields */ vcc_IsField(tl, &t_field, fs); ERRCHK(tl); @@ -103,8 +103,7 @@ Fc(tl, 0, "\t.nmember = %d,\n", nelem); Fc(tl, 0, "\t.members = vdrre_%.*s,\n", PF(t_dir)); Fc(tl, 0, "};\n"); - Fi(tl, 0, - "\tVRT_init_dir_round_robin(cli, &VGC_backend_%.*s , &vdrr_%.*s);\n", - PF(t_dir), PF(t_dir)); + Fi(tl, 0, "\tVRT_init_dir_round_robin(" + "cli, &VGC_backend_%.*s , &vdrr_%.*s);\n", PF(t_dir), PF(t_dir)); Ff(tl, 0, "\tVRT_fini_dir(cli, VGC_backend_%.*s);\n", PF(t_dir)); } Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -13,211 +13,145 @@ #include "vcc_priv.h" #include "vsb.h" +#define M1() do {*q = p + 1; return (p[0]); } while (0) +#define M2(c, t) do {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) + unsigned vcl_fixed_token(const char *p, const char **q) { switch (p[0]) { case '!': - if (p[1] == '=') { - *q = p + 2; - return (T_NEQ); - } - *q = p + 1; - return (p[0]); + M2('=', T_NEQ); + M1(); case '%': - *q = p + 1; - return (p[0]); + M1(); case '&': - if (p[1] == '&') { - *q = p + 2; - return (T_CAND); - } - *q = p + 1; - return (p[0]); + M2('&', T_CAND); + M1(); case '(': - *q = p + 1; - return (p[0]); + M1(); case ')': - *q = p + 1; - return (p[0]); + M1(); case '*': - if (p[1] == '=') { - *q = p + 2; - return (T_MUL); - } - *q = p + 1; - return (p[0]); + M2('=', T_MUL); + M1(); case '+': - if (p[1] == '=') { - *q = p + 2; - return (T_INCR); - } - if (p[1] == '+') { - *q = p + 2; - return (T_INC); - } - *q = p + 1; - return (p[0]); + M2('=', T_INCR); + M2('+', T_INC); + M1(); case ',': - *q = p + 1; - return (p[0]); + M1(); case '-': - if (p[1] == '=') { - *q = p + 2; - return (T_DECR); - } - if (p[1] == '-') { - *q = p + 2; - return (T_DEC); - } - *q = p + 1; - return (p[0]); + M2('=', T_DECR); + M2('-', T_DEC); + M1(); case '.': - *q = p + 1; - return (p[0]); + M1(); case '/': - if (p[1] == '=') { - *q = p + 2; - return (T_DIV); - } - *q = p + 1; - return (p[0]); + M2('=', T_DIV); + M1(); case ';': - *q = p + 1; - return (p[0]); + M1(); case '<': - if (p[1] == '=') { - *q = p + 2; - return (T_LEQ); - } - if (p[1] == '<') { - *q = p + 2; - return (T_SHL); - } - *q = p + 1; - return (p[0]); + M2('=', T_LEQ); + M2('<', T_SHL); + M1(); case '=': - if (p[1] == '=') { - *q = p + 2; - return (T_EQ); - } - *q = p + 1; - return (p[0]); + M2('=', T_EQ); + M1(); case '>': - if (p[1] == '>') { - *q = p + 2; - return (T_SHR); - } - if (p[1] == '=') { - *q = p + 2; - return (T_GEQ); - } - *q = p + 1; - return (p[0]); + M2('>', T_SHR); + M2('=', T_GEQ); + M1(); case 'e': - if (p[1] == 'l' && p[2] == 's' && - p[3] == 'i' && p[4] == 'f' && !isvar(p[5])) { + if (p[1] == 'l' && p[2] == 's' && p[3] == 'i' && + p[4] == 'f' && !isvar(p[5])) { *q = p + 5; return (T_ELSIF); } - if (p[1] == 'l' && p[2] == 's' && - p[3] == 'e' && p[4] == 'i' && p[5] == 'f' - && !isvar(p[6])) { + if (p[1] == 'l' && p[2] == 's' && p[3] == 'e' && + p[4] == 'i' && p[5] == 'f' && !isvar(p[6])) { *q = p + 6; return (T_ELSEIF); } - if (p[1] == 'l' && p[2] == 's' && - p[3] == 'e' && !isvar(p[4])) { + if (p[1] == 'l' && p[2] == 's' && p[3] == 'e' + && !isvar(p[4])) { *q = p + 4; return (T_ELSE); } return (0); case 'i': - if (p[1] == 'n' && p[2] == 'c' && - p[3] == 'l' && p[4] == 'u' && p[5] == 'd' && - p[6] == 'e' && !isvar(p[7])) { + if (p[1] == 'n' && p[2] == 'c' && p[3] == 'l' && + p[4] == 'u' && p[5] == 'd' && p[6] == 'e' + && !isvar(p[7])) { *q = p + 7; return (T_INCLUDE); } - if (p[1] == 'f' && !isvar(p[2])) { - *q = p + 2; - return (T_IF); - } + M2('f', T_IF); return (0); case '{': - *q = p + 1; - return (p[0]); + M1(); case '|': - if (p[1] == '|') { - *q = p + 2; - return (T_COR); - } - *q = p + 1; - return (p[0]); + M2('|', T_COR); + M1(); case '}': - *q = p + 1; - return (p[0]); + M1(); case '~': - *q = p + 1; - return (p[0]); + M1(); default: return (0); } } -const char *vcl_tnames[256]; +const char *vcl_tnames[256] = { + ['!'] = "'!'", + ['%'] = "'%'", + ['&'] = "'&'", + ['('] = "'('", + [')'] = "')'", + ['*'] = "'*'", + ['+'] = "'+'", + [','] = "','", + ['-'] = "'-'", + ['.'] = "'.'", + ['/'] = "'/'", + ['<'] = "'<'", + ['='] = "'='", + ['>'] = "'>'", + ['{'] = "'{'", + ['}'] = "'}'", + ['|'] = "'|'", + ['~'] = "'~'", + [';'] = "';'", + [CNUM] = "CNUM", + [CSRC] = "CSRC", + [CSTR] = "CSTR", + [EOI] = "EOI", + [ID] = "ID", + [T_CAND] = "&&", + [T_COR] = "||", + [T_DEC] = "--", + [T_DECR] = "-=", + [T_DIV] = "/=", + [T_ELSE] = "else", + [T_ELSEIF] = "elseif", + [T_ELSIF] = "elsif", + [T_EQ] = "==", + [T_GEQ] = ">=", + [T_IF] = "if", + [T_INC] = "++", + [T_INCLUDE] = "include", + [T_INCR] = "+=", + [T_LEQ] = "<=", + [T_MUL] = "*=", + [T_NEQ] = "!=", + [T_SHL] = "<<", + [T_SHR] = ">>", + [VAR] = "VAR", +}; void -vcl_init_tnames(void) -{ - vcl_tnames['!'] = "'!'"; - vcl_tnames['%'] = "'%'"; - vcl_tnames['&'] = "'&'"; - vcl_tnames['('] = "'('"; - vcl_tnames[')'] = "')'"; - vcl_tnames['*'] = "'*'"; - vcl_tnames['+'] = "'+'"; - vcl_tnames[','] = "','"; - vcl_tnames['-'] = "'-'"; - vcl_tnames['.'] = "'.'"; - vcl_tnames['/'] = "'/'"; - vcl_tnames['<'] = "'<'"; - vcl_tnames['='] = "'='"; - vcl_tnames['>'] = "'>'"; - vcl_tnames['{'] = "'{'"; - vcl_tnames['}'] = "'}'"; - vcl_tnames['|'] = "'|'"; - vcl_tnames['~'] = "'~'"; - vcl_tnames[';'] = "';'"; - vcl_tnames[CNUM] = "CNUM"; - vcl_tnames[CSRC] = "CSRC"; - vcl_tnames[CSTR] = "CSTR"; - vcl_tnames[EOI] = "EOI"; - vcl_tnames[ID] = "ID"; - vcl_tnames[T_CAND] = "&&"; - vcl_tnames[T_COR] = "||"; - vcl_tnames[T_DEC] = "--"; - vcl_tnames[T_DECR] = "-="; - vcl_tnames[T_DIV] = "/="; - vcl_tnames[T_ELSE] = "else"; - vcl_tnames[T_ELSEIF] = "elseif"; - vcl_tnames[T_ELSIF] = "elsif"; - vcl_tnames[T_EQ] = "=="; - vcl_tnames[T_GEQ] = ">="; - vcl_tnames[T_IF] = "if"; - vcl_tnames[T_INC] = "++"; - vcl_tnames[T_INCLUDE] = "include"; - vcl_tnames[T_INCR] = "+="; - vcl_tnames[T_LEQ] = "<="; - vcl_tnames[T_MUL] = "*="; - vcl_tnames[T_NEQ] = "!="; - vcl_tnames[T_SHL] = "<<"; - vcl_tnames[T_SHR] = ">>"; - vcl_tnames[VAR] = "VAR"; -} - -void vcl_output_lang_h(struct vsb *sb) { vsb_cat(sb, "#define VCL_RET_ERROR (1 << 0)\n"); @@ -230,287 +164,185 @@ vsb_cat(sb, "#define VCL_RET_DISCARD (1 << 7)\n"); vsb_cat(sb, "#define VCL_RET_KEEP (1 << 8)\n"); vsb_cat(sb, "#define VCL_RET_RESTART (1 << 9)\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * $Id$\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * NB: This file is machine generated, DO NOT EDIT!\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * Edit vcc_gen_fixed_token.tcl instead\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct sess;\n"); - vsb_cat(sb, "struct cli;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "typedef void vcl_init_f(struct cli *);\n"); - vsb_cat(sb, "typedef void vcl_fini_f(struct cli *);\n"); - vsb_cat(sb, "typedef int vcl_func_f(struct sess *sp);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct VCL_conf {\n"); - vsb_cat(sb, " unsigned magic;\n"); - vsb_cat(sb, "#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " struct director **director;\n"); - vsb_cat(sb, " unsigned ndirector;\n"); - vsb_cat(sb, " struct vrt_ref *ref;\n"); - vsb_cat(sb, " unsigned nref;\n"); - vsb_cat(sb, " unsigned busy;\n"); - vsb_cat(sb, " unsigned discard;\n"); - vsb_cat(sb, " \n"); - vsb_cat(sb, " unsigned nsrc;\n"); - vsb_cat(sb, " const char **srcname;\n"); - vsb_cat(sb, " const char **srcbody;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " unsigned nhashcount;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " vcl_init_f *init_func;\n"); - vsb_cat(sb, " vcl_fini_f *fini_func;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " vcl_func_f *recv_func;\n"); - vsb_cat(sb, " vcl_func_f *pipe_func;\n"); - vsb_cat(sb, " vcl_func_f *pass_func;\n"); - vsb_cat(sb, " vcl_func_f *hash_func;\n"); - vsb_cat(sb, " vcl_func_f *miss_func;\n"); - vsb_cat(sb, " vcl_func_f *hit_func;\n"); - vsb_cat(sb, " vcl_func_f *fetch_func;\n"); - vsb_cat(sb, " vcl_func_f *deliver_func;\n"); - vsb_cat(sb, " vcl_func_f *prefetch_func;\n"); - vsb_cat(sb, " vcl_func_f *timeout_func;\n"); - vsb_cat(sb, " vcl_func_f *discard_func;\n"); - vsb_cat(sb, " vcl_func_f *error_func;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "/*-\n"); - vsb_cat(sb, " * Copyright (c) 2006 Verdens Gang AS\n"); - vsb_cat(sb, " * Copyright (c) 2006-2008 Linpro AS\n"); - vsb_cat(sb, " * All rights reserved.\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * Author: Poul-Henning Kamp \n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * Redistribution and use in source and binary forms, with or without\n"); - vsb_cat(sb, " * modification, are permitted provided that the following conditions\n"); - vsb_cat(sb, " * are met:\n"); - vsb_cat(sb, " * 1. Redistributions of source code must retain the above copyright\n"); - vsb_cat(sb, " * notice, this list of conditions and the following disclaimer.\n"); - vsb_cat(sb, " * 2. Redistributions in binary form must reproduce the above copyright\n"); - vsb_cat(sb, " * notice, this list of conditions and the following disclaimer in the\n"); - vsb_cat(sb, " * documentation and/or other materials provided with the distribution.\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n"); - vsb_cat(sb, " * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n"); - vsb_cat(sb, " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"); - vsb_cat(sb, " * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n"); - vsb_cat(sb, " * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n"); - vsb_cat(sb, " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n"); - vsb_cat(sb, " * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n"); - vsb_cat(sb, " * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"); - vsb_cat(sb, " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n"); - vsb_cat(sb, " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n"); - vsb_cat(sb, " * SUCH DAMAGE.\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * $Id$\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * Runtime support for compiled VCL programs.\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * XXX: When this file is changed, lib/libvcl/vcc_gen_fixed_token.tcl\n"); - vsb_cat(sb, " * XXX: *MUST* be rerun.\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct sess;\n"); - vsb_cat(sb, "struct vsb;\n"); - vsb_cat(sb, "struct cli;\n"); - vsb_cat(sb, "struct director;\n"); - vsb_cat(sb, "struct VCL_conf;\n"); - vsb_cat(sb, "struct sockaddr;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * A backend probe specification\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "extern void *vrt_magic_string_end;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_backend_probe {\n"); - vsb_cat(sb, " const char *url;\n"); - vsb_cat(sb, " const char *request;\n"); - vsb_cat(sb, " double timeout;\n"); - vsb_cat(sb, " double interval;\n"); - vsb_cat(sb, " unsigned window;\n"); - vsb_cat(sb, " unsigned threshold;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * A backend is a host+port somewhere on the network\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "struct vrt_backend {\n"); - vsb_cat(sb, " const char *vcl_name;\n"); - vsb_cat(sb, " const char *ident;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " const char *hosthdr;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " const unsigned char *ipv4_sockaddr;\n"); - vsb_cat(sb, " const unsigned char *ipv6_sockaddr;\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, " double connect_timeout;\n"); - vsb_cat(sb, " unsigned max_connections;\n"); - vsb_cat(sb, " struct vrt_backend_probe probe;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * A director with a predictable reply\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_dir_simple {\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " const struct vrt_backend *host;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * A director with an unpredictable reply\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_dir_random_entry {\n"); - vsb_cat(sb, " const struct vrt_backend *host;\n"); - vsb_cat(sb, " double weight;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_dir_random {\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " unsigned retries;\n"); - vsb_cat(sb, " unsigned nmember;\n"); - vsb_cat(sb, " const struct vrt_dir_random_entry *members;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * A director with round robin selection\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_dir_round_robin_entry {\n"); - vsb_cat(sb, " const struct vrt_backend *host;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_dir_round_robin {\n"); - vsb_cat(sb, " const char *name;\n"); - vsb_cat(sb, " unsigned nmember;\n"); - vsb_cat(sb, " const struct vrt_dir_round_robin_entry *members;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * other stuff.\n"); - vsb_cat(sb, " * XXX: document when bored\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct vrt_ref {\n"); - vsb_cat(sb, " unsigned source;\n"); - vsb_cat(sb, " unsigned offset;\n"); - vsb_cat(sb, " unsigned line;\n"); - vsb_cat(sb, " unsigned pos;\n"); - vsb_cat(sb, " unsigned count;\n"); - vsb_cat(sb, " const char *token;\n"); - vsb_cat(sb, "};\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/* ACL related */\n"); - vsb_cat(sb, "#define VRT_ACL_MAXADDR 16 /* max(IPv4, IPv6) */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "void VRT_acl_log(const struct sess *, const char *msg);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/* Regexp related */\n"); - vsb_cat(sb, "void VRT_re_init(void **, const char *, int sub);\n"); - vsb_cat(sb, "void VRT_re_fini(void *);\n"); - vsb_cat(sb, "int VRT_re_match(const char *, void *re);\n"); - vsb_cat(sb, "int VRT_re_test(struct vsb *, const char *, int sub);\n"); - vsb_cat(sb, "const char *VRT_regsub(const struct sess *sp, int all, const char *, void *, const char *);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "void VRT_panic(struct sess *sp, const char *, ...);\n"); - vsb_cat(sb, "void VRT_purge(const char *, int hash);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "void VRT_count(const struct sess *, unsigned);\n"); - vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n"); - vsb_cat(sb, "void VRT_error(struct sess *, unsigned, const char *);\n"); - vsb_cat(sb, "int VRT_switch_config(const char *);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "enum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ };\n"); - vsb_cat(sb, "char *VRT_GetHdr(const struct sess *, enum gethdr_e where, const char *);\n"); - vsb_cat(sb, "void VRT_SetHdr(const struct sess *, enum gethdr_e where, const char *, const char *, ...);\n"); - vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/* Simple stuff */\n"); - vsb_cat(sb, "int VRT_strcmp(const char *s1, const char *s2);\n"); - vsb_cat(sb, "void VRT_memmove(void *dst, const void *src, unsigned len);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "void VRT_ESI(struct sess *sp);\n"); - vsb_cat(sb, "void VRT_Rollback(struct sess *sp);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/* Synthetic pages */\n"); - vsb_cat(sb, "void VRT_synth_page(struct sess *sp, unsigned flags, const char *, ...);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "/* Backend related */\n"); - vsb_cat(sb, "void VRT_init_dir_simple(struct cli *, struct director **, const struct vrt_dir_simple *);\n"); - vsb_cat(sb, "void VRT_init_dir_random(struct cli *, struct director **, const struct vrt_dir_random *);\n"); - vsb_cat(sb, "void VRT_init_dir_round_robin(struct cli *, struct director **, const struct vrt_dir_round_robin *);\n"); - vsb_cat(sb, "void VRT_fini_dir(struct cli *, struct director *);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "char *VRT_IP_string(const struct sess *sp, const struct sockaddr *sa);\n"); - vsb_cat(sb, "char *VRT_int_string(const struct sess *sp, int);\n"); - vsb_cat(sb, "char *VRT_double_string(const struct sess *sp, double);\n"); - vsb_cat(sb, "const char *VRT_backend_string(struct sess *sp);\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "#define VRT_done(sp, hand) \\\n"); - vsb_cat(sb, " do { \\\n"); - vsb_cat(sb, " VRT_handling(sp, hand); \\\n"); - vsb_cat(sb, " return (1); \\\n"); - vsb_cat(sb, " } while (0)\n"); - vsb_cat(sb, "/*\n"); - vsb_cat(sb, " * $Id$\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * NB: This file is machine generated, DO NOT EDIT!\n"); - vsb_cat(sb, " *\n"); - vsb_cat(sb, " * Edit vcc_gen_obj.tcl instead\n"); - vsb_cat(sb, " */\n"); - vsb_cat(sb, "\n"); - vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(const struct sess *);\n"); - vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); - vsb_cat(sb, "int VRT_r_server_port(struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_req_request(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_request(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_req_url(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_url(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_req_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_proto(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "void VRT_l_req_hash(struct sess *, const char *);\n"); - vsb_cat(sb, "struct director * VRT_r_req_backend(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_backend(struct sess *, struct director *);\n"); - vsb_cat(sb, "int VRT_r_req_restarts(const struct sess *);\n"); - vsb_cat(sb, "double VRT_r_req_grace(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_grace(struct sess *, double);\n"); - vsb_cat(sb, "const char * VRT_r_req_xid(struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_bereq_request(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_bereq_request(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_bereq_url(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_bereq_url(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_bereq_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_bereq_proto(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_obj_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_proto(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "int VRT_r_obj_status(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_status(const struct sess *, int);\n"); - vsb_cat(sb, "const char * VRT_r_obj_response(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_response(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "int VRT_r_obj_hits(const struct sess *);\n"); - vsb_cat(sb, "unsigned VRT_r_obj_cacheable(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_cacheable(const struct sess *, unsigned);\n"); - vsb_cat(sb, "double VRT_r_obj_ttl(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_ttl(const struct sess *, double);\n"); - vsb_cat(sb, "double VRT_r_obj_grace(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_grace(const struct sess *, double);\n"); - vsb_cat(sb, "double VRT_r_obj_prefetch(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_prefetch(const struct sess *, double);\n"); - vsb_cat(sb, "double VRT_r_obj_lastuse(const struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_obj_hash(const struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_resp_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_proto(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "int VRT_r_resp_status(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_status(const struct sess *, int);\n"); - vsb_cat(sb, "const char * VRT_r_resp_response(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_resp_response(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "double VRT_r_now(const struct sess *);\n"); - vsb_cat(sb, "unsigned VRT_r_req_backend_healthy(const struct sess *);\n"); + + /* ../../include/vcl.h */ + + vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3098 2008-08-18 08"); + vsb_cat(sb, ":18:43Z phk $\n *\n * NB: This file is machine genera"); + vsb_cat(sb, "ted, DO NOT EDIT!\n *\n * Edit vcc_gen_fixed_token.tcl"); + vsb_cat(sb, " instead\n */\n\nstruct sess;\nstruct cli;\n\ntypedef "); + vsb_cat(sb, "void vcl_init_f(struct cli *);\ntypedef void vcl_fini_"); + vsb_cat(sb, "f(struct cli *);\ntypedef int vcl_func_f(struct sess *"); + vsb_cat(sb, "sp);\n\nstruct VCL_conf {\n\tunsigned magic;\n#"); + vsb_cat(sb, "define VCL_CONF_MAGIC 0x7406c509 /* from /dev/ra"); + vsb_cat(sb, "ndom */\n\n struct director **director;\n "); + vsb_cat(sb, " unsigned ndirector;\n struct vrt_ref "); + vsb_cat(sb, " *ref;\n unsigned nref;\n unsigne"); + vsb_cat(sb, "d busy;\n unsigned discard;\n\n\t"); + vsb_cat(sb, "unsigned\tnsrc;\n\tconst char\t**srcname;\n\tconst cha"); + vsb_cat(sb, "r\t**srcbody;\n\n\tunsigned\tnhashcount;\n\n vc"); + vsb_cat(sb, "l_init_f *init_func;\n vcl_fini_f *fi"); + vsb_cat(sb, "ni_func;\n\n\tvcl_func_f\t*recv_func;\n\tvcl_func_f\t*"); + vsb_cat(sb, "pipe_func;\n\tvcl_func_f\t*pass_func;\n\tvcl_func_f\t*"); + vsb_cat(sb, "hash_func;\n\tvcl_func_f\t*miss_func;\n\tvcl_func_f\t*"); + vsb_cat(sb, "hit_func;\n\tvcl_func_f\t*fetch_func;\n\tvcl_func_f\t*"); + vsb_cat(sb, "deliver_func;\n\tvcl_func_f\t*prefetch_func;\n\tvcl_fu"); + vsb_cat(sb, "nc_f\t*timeout_func;\n\tvcl_func_f\t*discard_func;\n\t"); + vsb_cat(sb, "vcl_func_f\t*error_func;\n};\n"); + + /* ../../include/vrt.h */ + + vsb_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n * Copyrig"); + vsb_cat(sb, "ht (c) 2006-2008 Linpro AS\n * All rights reserved.\n "); + vsb_cat(sb, "*\n * Author: Poul-Henning Kamp \n"); + vsb_cat(sb, " *\n * Redistribution and use in source and binary for"); + vsb_cat(sb, "ms, with or without\n * modification, are permitted pr"); + vsb_cat(sb, "ovided that the following conditions\n * are met:\n * "); + vsb_cat(sb, "1. Redistributions of source code must retain the abov"); + vsb_cat(sb, "e copyright\n * notice, this list of conditions and"); + vsb_cat(sb, " the following disclaimer.\n * 2. Redistributions in b"); + vsb_cat(sb, "inary form must reproduce the above copyright\n * n"); + vsb_cat(sb, "otice, this list of conditions and the following discl"); + vsb_cat(sb, "aimer in the\n * documentation and/or other materia"); + vsb_cat(sb, "ls provided with the distribution.\n *\n * THIS SOFTWA"); + vsb_cat(sb, "RE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'"); + vsb_cat(sb, "' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING"); + vsb_cat(sb, ", BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF ME"); + vsb_cat(sb, "RCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n *"); + vsb_cat(sb, " ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBU"); + vsb_cat(sb, "TORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTA"); + vsb_cat(sb, "L, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (I"); + vsb_cat(sb, "NCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUT"); + vsb_cat(sb, "E GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS"); + vsb_cat(sb, "; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON "); + vsb_cat(sb, "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"); + vsb_cat(sb, " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI"); + vsb_cat(sb, "SE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFT"); + vsb_cat(sb, "WARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH D"); + vsb_cat(sb, "AMAGE.\n *\n * $Id: vrt.h 3234 2008-09-29 07:32:26Z ph"); + vsb_cat(sb, "k $\n *\n * Runtime support for compiled VCL programs."); + vsb_cat(sb, "\n *\n * XXX: When this file is changed, lib/libvcl/vc"); + vsb_cat(sb, "c_gen_fixed_token.tcl\n * XXX: *MUST* be rerun.\n */\n"); + vsb_cat(sb, "\nstruct sess;\nstruct vsb;\nstruct cli;\nstruct direc"); + vsb_cat(sb, "tor;\nstruct VCL_conf;\nstruct sockaddr;\n\n/*\n * A b"); + vsb_cat(sb, "ackend probe specification\n */\n\nextern void *vrt_ma"); + vsb_cat(sb, "gic_string_end;\n\nstruct vrt_backend_probe {\n\tconst"); + vsb_cat(sb, " char\t*url;\n\tconst char\t*request;\n\tdouble\t\ttim"); + vsb_cat(sb, "eout;\n\tdouble\t\tinterval;\n\tunsigned\twindow;\n\tu"); + vsb_cat(sb, "nsigned\tthreshold;\n};\n\n/*\n * A backend is a host+"); + vsb_cat(sb, "port somewhere on the network\n */\nstruct vrt_backend"); + vsb_cat(sb, " {\n\tconst char\t\t\t*vcl_name;\n\tconst char\t\t\t*i"); + vsb_cat(sb, "dent;\n\n\tconst char\t\t\t*hosthdr;\n\n\tconst unsign"); + vsb_cat(sb, "ed char\t\t*ipv4_sockaddr;\n\tconst unsigned char\t\t*"); + vsb_cat(sb, "ipv6_sockaddr;\n\n\tdouble\t\t\t\tconnect_timeout;\n\t"); + vsb_cat(sb, "unsigned\t\t\tmax_connections;\n\tstruct vrt_backend_p"); + vsb_cat(sb, "robe\tprobe;\n};\n\n/*\n * A director with a predictab"); + vsb_cat(sb, "le reply\n */\n\nstruct vrt_dir_simple {\n\tconst char"); + vsb_cat(sb, "\t\t\t\t*name;\n\tconst struct vrt_backend\t\t*host;\n"); + vsb_cat(sb, "};\n\n/*\n * A director with an unpredictable reply\n "); + vsb_cat(sb, "*/\n\nstruct vrt_dir_random_entry {\n\tconst struct vr"); + vsb_cat(sb, "t_backend\t\t*host;\n\tdouble\t\t\t\t\tweight;\n};\n\n"); + vsb_cat(sb, "struct vrt_dir_random {\n\tconst char\t\t\t\t*name;\n\t"); + vsb_cat(sb, "unsigned\t\t\t\tretries;\n\tunsigned\t\t\t\tnmember;\n"); + vsb_cat(sb, "\tconst struct vrt_dir_random_entry\t*members;\n};\n\n"); + vsb_cat(sb, "/*\n * A director with round robin selection\n */\n\ns"); + vsb_cat(sb, "truct vrt_dir_round_robin_entry {\n\tconst struct vrt_"); + vsb_cat(sb, "backend\t\t*host;\n};\n\nstruct vrt_dir_round_robin {\n"); + vsb_cat(sb, "\tconst char\t\t\t\t*name;\n\tunsigned\t\t\t\tnmember;"); + vsb_cat(sb, "\n\tconst struct vrt_dir_round_robin_entry\t*members;\n"); + vsb_cat(sb, "};\n\n\n/*\n * other stuff.\n * XXX: document when bor"); + vsb_cat(sb, "ed\n */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n\tun"); + vsb_cat(sb, "signed\toffset;\n\tunsigned\tline;\n\tunsigned\tpos;\n"); + vsb_cat(sb, "\tunsigned\tcount;\n\tconst char\t*token;\n};\n\n/* AC"); + vsb_cat(sb, "L related */\n#define VRT_ACL_MAXADDR\t\t16\t/* max(IP"); + vsb_cat(sb, "v4, IPv6) */\n\nvoid VRT_acl_log(const struct sess *, "); + vsb_cat(sb, "const char *msg);\n\n/* Regexp related */\nvoid VRT_re"); + vsb_cat(sb, "_init(void **, const char *, int sub);\nvoid VRT_re_fi"); + vsb_cat(sb, "ni(void *);\nint VRT_re_match(const char *, void *re);"); + vsb_cat(sb, "\nint VRT_re_test(struct vsb *, const char *, int sub)"); + vsb_cat(sb, ";\nconst char *VRT_regsub(const struct sess *sp, int a"); + vsb_cat(sb, "ll, const char *,\n void *, const char *);\n\nvoid "); + vsb_cat(sb, "VRT_panic(struct sess *sp, const char *, ...);\nvoid "); + vsb_cat(sb, "VRT_purge(const char *, int hash);\n\nvoid VRT_count(c"); + vsb_cat(sb, "onst struct sess *, unsigned);\nint VRT_rewrite(const "); + vsb_cat(sb, "char *, const char *);\nvoid VRT_error(struct sess *, "); + vsb_cat(sb, "unsigned, const char *);\nint VRT_switch_config(const "); + vsb_cat(sb, "char *);\n\nenum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ"); + vsb_cat(sb, ", HDR_BEREQ };\nchar *VRT_GetHdr(const struct sess *, "); + vsb_cat(sb, "enum gethdr_e where, const char *);\nvoid VRT_SetHdr(c"); + vsb_cat(sb, "onst struct sess *, enum gethdr_e where, const char *,"); + vsb_cat(sb, "\n const char *, ...);\nvoid VRT_handling(struct se"); + vsb_cat(sb, "ss *sp, unsigned hand);\n\n/* Simple stuff */\nint VRT"); + vsb_cat(sb, "_strcmp(const char *s1, const char *s2);\nvoid VRT_mem"); + vsb_cat(sb, "move(void *dst, const void *src, unsigned len);\n\nvoi"); + vsb_cat(sb, "d VRT_ESI(struct sess *sp);\nvoid VRT_Rollback(struct "); + vsb_cat(sb, "sess *sp);\n\n/* Synthetic pages */\nvoid VRT_synth_pa"); + vsb_cat(sb, "ge(struct sess *sp, unsigned flags, const char *, ...)"); + vsb_cat(sb, ";\n\n/* Backend related */\nvoid VRT_init_dir_simple(s"); + vsb_cat(sb, "truct cli *, struct director **,\n const struct vrt"); + vsb_cat(sb, "_dir_simple *);\nvoid VRT_init_dir_random(struct cli *"); + vsb_cat(sb, ", struct director **,\n const struct vrt_dir_random"); + vsb_cat(sb, " *);\nvoid VRT_init_dir_round_robin(struct cli *, stru"); + vsb_cat(sb, "ct director **,\n const struct vrt_dir_round_robin "); + vsb_cat(sb, "*);\nvoid VRT_fini_dir(struct cli *, struct director *"); + vsb_cat(sb, ");\n\nchar *VRT_IP_string(const struct sess *sp, const"); + vsb_cat(sb, " struct sockaddr *sa);\nchar *VRT_int_string(const str"); + vsb_cat(sb, "uct sess *sp, int);\nchar *VRT_double_string(const str"); + vsb_cat(sb, "uct sess *sp, double);\nconst char *VRT_backend_string"); + vsb_cat(sb, "(struct sess *sp);\n\n#define VRT_done(sp, hand)\t\t\t"); + vsb_cat(sb, "\\\n\tdo {\t\t\t\t\t\\\n\t\tVRT_handling(sp, hand);\t\t"); + vsb_cat(sb, "\\\n\t\treturn (1);\t\t\t\\\n\t} while (0)\n"); + + /* ../../include/vrt_obj.h */ + + vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3169 2008-09-08 09:49:01Z "); + vsb_cat(sb, "tfheen $\n *\n * NB: This file is machine generated, "); + vsb_cat(sb, "DO NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n */"); + vsb_cat(sb, "\n\nstruct sockaddr * VRT_r_client_ip(const struct ses"); + vsb_cat(sb, "s *);\nstruct sockaddr * VRT_r_server_ip(struct sess *"); + vsb_cat(sb, ");\nint VRT_r_server_port(struct sess *);\nconst char "); + vsb_cat(sb, "* VRT_r_req_request(const struct sess *);\nvoid VRT_l_"); + vsb_cat(sb, "req_request(const struct sess *, const char *, ...);\n"); + vsb_cat(sb, "const char * VRT_r_req_url(const struct sess *);\nvoid"); + vsb_cat(sb, " VRT_l_req_url(const struct sess *, const char *, ...)"); + vsb_cat(sb, ";\nconst char * VRT_r_req_proto(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_proto(const struct sess *, const char *"); + vsb_cat(sb, ", ...);\nvoid VRT_l_req_hash(struct sess *, const char"); + vsb_cat(sb, " *);\nstruct director * VRT_r_req_backend(struct sess "); + vsb_cat(sb, "*);\nvoid VRT_l_req_backend(struct sess *, struct dire"); + vsb_cat(sb, "ctor *);\nint VRT_r_req_restarts(const struct sess *);"); + vsb_cat(sb, "\ndouble VRT_r_req_grace(struct sess *);\nvoid VRT_l_r"); + vsb_cat(sb, "eq_grace(struct sess *, double);\nconst char * VRT_r_r"); + vsb_cat(sb, "eq_xid(struct sess *);\nconst char * VRT_r_bereq_reque"); + vsb_cat(sb, "st(const struct sess *);\nvoid VRT_l_bereq_request(con"); + vsb_cat(sb, "st struct sess *, const char *, ...);\nconst char * VR"); + vsb_cat(sb, "T_r_bereq_url(const struct sess *);\nvoid VRT_l_bereq_"); + vsb_cat(sb, "url(const struct sess *, const char *, ...);\nconst ch"); + vsb_cat(sb, "ar * VRT_r_bereq_proto(const struct sess *);\nvoid VRT"); + vsb_cat(sb, "_l_bereq_proto(const struct sess *, const char *, ...)"); + vsb_cat(sb, ";\nconst char * VRT_r_obj_proto(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_proto(const struct sess *, const char *"); + vsb_cat(sb, ", ...);\nint VRT_r_obj_status(const struct sess *);\nv"); + vsb_cat(sb, "oid VRT_l_obj_status(const struct sess *, int);\nconst"); + vsb_cat(sb, " char * VRT_r_obj_response(const struct sess *);\nvoid"); + vsb_cat(sb, " VRT_l_obj_response(const struct sess *, const char *,"); + vsb_cat(sb, " ...);\nint VRT_r_obj_hits(const struct sess *);\nunsi"); + vsb_cat(sb, "gned VRT_r_obj_cacheable(const struct sess *);\nvoid V"); + vsb_cat(sb, "RT_l_obj_cacheable(const struct sess *, unsigned);\ndo"); + vsb_cat(sb, "uble VRT_r_obj_ttl(const struct sess *);\nvoid VRT_l_o"); + vsb_cat(sb, "bj_ttl(const struct sess *, double);\ndouble VRT_r_obj"); + vsb_cat(sb, "_grace(const struct sess *);\nvoid VRT_l_obj_grace(con"); + vsb_cat(sb, "st struct sess *, double);\ndouble VRT_r_obj_prefetch("); + vsb_cat(sb, "const struct sess *);\nvoid VRT_l_obj_prefetch(const s"); + vsb_cat(sb, "truct sess *, double);\ndouble VRT_r_obj_lastuse(const"); + vsb_cat(sb, " struct sess *);\nconst char * VRT_r_obj_hash(const st"); + vsb_cat(sb, "ruct sess *);\nconst char * VRT_r_resp_proto(const str"); + vsb_cat(sb, "uct sess *);\nvoid VRT_l_resp_proto(const struct sess "); + vsb_cat(sb, "*, const char *, ...);\nint VRT_r_resp_status(const st"); + vsb_cat(sb, "ruct sess *);\nvoid VRT_l_resp_status(const struct ses"); + vsb_cat(sb, "s *, int);\nconst char * VRT_r_resp_response(const str"); + vsb_cat(sb, "uct sess *);\nvoid VRT_l_resp_response(const struct se"); + vsb_cat(sb, "ss *, const char *, ...);\ndouble VRT_r_now(const stru"); + vsb_cat(sb, "ct sess *);\nunsigned VRT_r_req_backend_healthy(const "); + vsb_cat(sb, "struct sess *);\n"); } Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-10-18 20:50:10 UTC (rev 3324) @@ -30,7 +30,7 @@ # Generate various .c and .h files for the VCL compiler and the interfaces # for it. -# These are the metods which can be called in the VCL program. +# These are the metods which can be called in the VCL program. # Second element is list of valid return actions. # set methods { @@ -66,7 +66,7 @@ # Language keywords # set keywords { - include + include if else elseif elsif } @@ -104,7 +104,8 @@ proc warns {fd} { puts $fd "/*" - puts $fd { * $Id$} + puts $fd \ + { * $Id$} puts $fd " *" puts $fd " * NB: This file is machine generated, DO NOT EDIT!" puts $fd " *" @@ -135,7 +136,7 @@ unsigned nref; unsigned busy; unsigned discard; - + unsigned nsrc; const char **srcname; const char **srcbody; @@ -160,12 +161,13 @@ puts $for "#ifdef VCL_RET_MAC" set i 0 foreach k $returns { + set u [string toupper $k] if {$k == "error"} { puts $for "#ifdef VCL_RET_MAC_E" - puts $for "VCL_RET_MAC_E($k, [string toupper $k], (1 << $i), $i)" + puts $for "VCL_RET_MAC_E($k, $u, (1 << $i), $i)" puts $for "#endif" } else { - puts $for "VCL_RET_MAC($k, [string toupper $k], (1 << $i), $i)" + puts $for "VCL_RET_MAC($k, $u, (1 << $i), $i)" } incr i } @@ -184,7 +186,7 @@ puts -nonewline $for "VCL_MET_MAC([lindex $m 0]" puts -nonewline $for ",[string toupper [lindex $m 0]]" set l [lindex $m 1] - puts -nonewline $for ",(VCL_RET_[string toupper [lindex $l 0]]" + puts -nonewline $for ",(\n VCL_RET_[string toupper [lindex $l 0]]" foreach r [lrange $l 1 end] { puts -nonewline $for "|VCL_RET_[string toupper $r]" } @@ -260,6 +262,9 @@ set seq [lsort [array names xx]] puts $fo { +#define M1() do {*q = p + 1; return (p[0]); } while (0) +#define M2(c, t) do {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) + unsigned vcl_fixed_token(const char *p, const char **q)} puts $fo "{" @@ -279,25 +284,33 @@ scan "$ch" "%c" cx puts $fo " case '$ch':" set retval "0" + set m1 0 foreach tt $l { set k [lindex $tt 0] if {[string length $k] == 1} { - puts $fo "\t\t*q = p + 1;" - set retval {p[0]} + puts $fo "\t\tM1();" + set m1 1 continue; } + if {[string length $k] == 2} { + puts -nonewline $fo " M2(" + puts -nonewline $fo "'[string index $k 1]'" + puts $fo ", [lindex $tt 1]);" + continue; + } puts -nonewline $fo " if (" for {set i 1} {$i < [string length $k]} {incr i} { if {$i > 1} { - puts -nonewline $fo " && " - if {![expr $i % 3]} { - puts -nonewline $fo "\n\t\t " + puts -nonewline $fo " &&" + if {[expr $i % 3] == 1} { + puts -nonewline $fo "\n\t\t " } + puts -nonewline $fo " " } puts -nonewline $fo "p\[$i\] == '[string index $k $i]'" } if {[lindex $tt 2]} { - if {![expr $i % 3]} { + if {[expr $i % 3] == 1} { puts -nonewline $fo "\n\t\t " } puts -nonewline $fo " && !isvar(p\[$i\])" @@ -307,8 +320,10 @@ puts $fo "\t\t\treturn ([lindex $tt 1]);" puts $fo "\t\t}" } - puts $fo "\t\treturn ($retval);" -} + if {$m1 == 0} { + puts $fo "\t\treturn ($retval);" + } +} puts $fo " default:" puts $fo " return (0);" @@ -316,17 +331,14 @@ puts $fo "}" puts $fo "" -puts $fo "const char *vcl_tnames\[256\];\n" -puts $fo "void" -puts $fo "vcl_init_tnames(void)" -puts $fo "{" +puts $fo "const char *vcl_tnames\[256\] = {" foreach i $token2 { - puts $fo "\tvcl_tnames\[[lindex $i 0]\] = \"[lindex $i 0]\";" + puts $fo "\t\[[lindex $i 0]\] = \"[lindex $i 0]\"," } foreach i $tokens { - puts $fo "\tvcl_tnames\[[lindex $i 0]\] = \"[lindex $i 1]\";" + puts $fo "\t\[[lindex $i 0]\] = \"[lindex $i 1]\"," } -puts $fo "}" +puts $fo "};" #---------------------------------------------------------------------- # Create the C-code which emits the boilerplate definitions for the @@ -335,11 +347,43 @@ proc copy_include {n} { global fo + puts $fo "\n\t/* $n */\n" set fi [open $n] + set n 0 while {[gets $fi a] >= 0} { - regsub -all {\\} $a {\\\\} a - puts $fo "\tvsb_cat(sb, \"$a\\n\");" + for {set b 0} {$b < [string length $a]} {incr b} { + if {$n == 0} { + puts -nonewline $fo "\tvsb_cat(sb, \"" + } + set c [string index $a $b] + if {"$c" == "\\"} { + puts -nonewline $fo "\\\\" + incr n + } elseif {"$c" == "\t"} { + puts -nonewline $fo "\\t" + incr n + } else { + puts -nonewline $fo "$c" + } + incr n + if {$n > 53} { + puts $fo "\");" + set n 0 + } + } + if {$n == 0} { + puts -nonewline $fo "\tvsb_cat(sb, \"" + } + puts -nonewline $fo "\\n" + incr n 2 + if {$n > 53} { + puts $fo "\");" + set n 0 + } } + if {$n > 0} { + puts $fo "\");" + } close $fi } @@ -349,7 +393,8 @@ puts $fo "{" set i 0 foreach k $returns { - puts $fo "\tvsb_cat(sb, \"#define VCL_RET_[string toupper $k] (1 << $i)\\n\");" + set u [string toupper $k] + puts $fo "\tvsb_cat(sb, \"#define VCL_RET_$u (1 << $i)\\n\");" incr i } Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl 2008-10-18 20:50:10 UTC (rev 3324) @@ -261,15 +261,31 @@ proc method_map {m} { - set l "" + set l1 "" + set l2 "" foreach i $m { - append l " | " - append l VCL_MET_[string toupper $i] + if {[string length $l2] > 55} { + if {$l1 != ""} { + append l1 "\n\t " + } + append l1 "$l2" + set l2 "" + } + if {$l2 != "" || $l1 != ""} { + append l2 " | " + } + append l2 VCL_MET_[string toupper $i] } - if {$l == ""} { + if {$l2 != ""} { + if {$l1 != ""} { + append l1 "\n\t " + } + append l1 "$l2" + } + if {$l1 == ""} { return "0" } - return [string range $l 3 end] + return $l1 } proc vars {v pa} { @@ -289,12 +305,12 @@ puts $fo "\t\{ \"$n\", $t, [string length $n]," } if {$a == "RO" || $a == "RW"} { - puts $fo "\t \"VRT_r_${m}($pa)\"," + puts -nonewline $fo "\t \"VRT_r_${m}($pa)\"," if {![regexp HDR_ $t]} { puts $fp "$tt($t) VRT_r_${m}($ty);" } } else { - puts $fo "\t NULL," + puts -nonewline $fo "\t NULL," } if {$a == "WO" || $a == "RW"} { puts $fo "\t \"VRT_l_${m}($pa, \"," @@ -307,7 +323,7 @@ } else { puts $fo "\t NULL," } - puts $fo "\t V_$a," + puts -nonewline $fo "\t V_$a," if {![regexp HDR_ $t]} { puts $fo "\t 0," } else { Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -12,235 +12,195 @@ struct var vcc_vars[] = { { "client.ip", IP, 9, - "VRT_r_client_ip(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_client_ip(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "server.ip", IP, 9, - "VRT_r_server_ip(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_server_ip(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "server.port", INT, 11, - "VRT_r_server_port(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_server_port(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "req.request", STRING, 11, - "VRT_r_req_request(sp)", - "VRT_l_req_request(sp, ", - V_RW, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR + "VRT_r_req_request(sp)", "VRT_l_req_request(sp, ", + V_RW, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "req.url", STRING, 7, - "VRT_r_req_url(sp)", - "VRT_l_req_url(sp, ", - V_RW, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR + "VRT_r_req_url(sp)", "VRT_l_req_url(sp, ", + V_RW, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "req.proto", STRING, 9, - "VRT_r_req_proto(sp)", - "VRT_l_req_proto(sp, ", - V_RW, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR + "VRT_r_req_proto(sp)", "VRT_l_req_proto(sp, ", + V_RW, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "req.http.", HEADER, 9, - "VRT_r_req_http_(sp)", - "VRT_l_req_http_(sp, ", - V_RW, - "HDR_REQ", - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR + "VRT_r_req_http_(sp)", "VRT_l_req_http_(sp, ", + V_RW, "HDR_REQ", + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "req.hash", HASH, 8, - NULL, - "VRT_l_req_hash(sp, ", - V_WO, - 0, + NULL, "VRT_l_req_hash(sp, ", + V_WO, 0, VCL_MET_HASH | VCL_MET_ERROR }, { "req.backend", BACKEND, 11, - "VRT_r_req_backend(sp)", - "VRT_l_req_backend(sp, ", - V_RW, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR + "VRT_r_req_backend(sp)", "VRT_l_req_backend(sp, ", + V_RW, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "req.restarts", INT, 12, - "VRT_r_req_restarts(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_req_restarts(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "req.grace", TIME, 9, - "VRT_r_req_grace(sp)", - "VRT_l_req_grace(sp, ", - V_RW, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_req_grace(sp)", "VRT_l_req_grace(sp, ", + V_RW, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "req.xid", STRING, 7, - "VRT_r_req_xid(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_req_xid(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "bereq.request", STRING, 13, - "VRT_r_bereq_request(sp)", - "VRT_l_bereq_request(sp, ", - V_RW, - 0, + "VRT_r_bereq_request(sp)", "VRT_l_bereq_request(sp, ", + V_RW, 0, VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH }, { "bereq.url", STRING, 9, - "VRT_r_bereq_url(sp)", - "VRT_l_bereq_url(sp, ", - V_RW, - 0, + "VRT_r_bereq_url(sp)", "VRT_l_bereq_url(sp, ", + V_RW, 0, VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH }, { "bereq.proto", STRING, 11, - "VRT_r_bereq_proto(sp)", - "VRT_l_bereq_proto(sp, ", - V_RW, - 0, + "VRT_r_bereq_proto(sp)", "VRT_l_bereq_proto(sp, ", + V_RW, 0, VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH }, { "bereq.http.", HEADER, 11, - "VRT_r_bereq_http_(sp)", - "VRT_l_bereq_http_(sp, ", - V_RW, - "HDR_BEREQ", + "VRT_r_bereq_http_(sp)", "VRT_l_bereq_http_(sp, ", + V_RW, "HDR_BEREQ", VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH }, { "obj.proto", STRING, 9, - "VRT_r_obj_proto(sp)", - "VRT_l_obj_proto(sp, ", - V_RW, - 0, + "VRT_r_obj_proto(sp)", "VRT_l_obj_proto(sp, ", + V_RW, 0, VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "obj.status", INT, 10, - "VRT_r_obj_status(sp)", - "VRT_l_obj_status(sp, ", - V_RW, - 0, + "VRT_r_obj_status(sp)", "VRT_l_obj_status(sp, ", + V_RW, 0, VCL_MET_FETCH | VCL_MET_ERROR }, { "obj.response", STRING, 12, - "VRT_r_obj_response(sp)", - "VRT_l_obj_response(sp, ", - V_RW, - 0, + "VRT_r_obj_response(sp)", "VRT_l_obj_response(sp, ", + V_RW, 0, VCL_MET_FETCH | VCL_MET_ERROR }, { "obj.hits", INT, 8, - "VRT_r_obj_hits(sp)", - NULL, - V_RO, - 0, + "VRT_r_obj_hits(sp)", NULL, + V_RO, 0, VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER }, { "obj.http.", HEADER, 9, - "VRT_r_obj_http_(sp)", - "VRT_l_obj_http_(sp, ", - V_RW, - "HDR_OBJ", + "VRT_r_obj_http_(sp)", "VRT_l_obj_http_(sp, ", + V_RW, "HDR_OBJ", VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_ERROR }, { "obj.cacheable", BOOL, 13, - "VRT_r_obj_cacheable(sp)", - "VRT_l_obj_cacheable(sp, ", - V_RW, - 0, - VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT | VCL_MET_ERROR + "VRT_r_obj_cacheable(sp)", "VRT_l_obj_cacheable(sp, ", + V_RW, 0, + VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT + | VCL_MET_ERROR }, { "obj.ttl", TIME, 7, - "VRT_r_obj_ttl(sp)", - "VRT_l_obj_ttl(sp, ", - V_RW, - 0, - VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT | VCL_MET_ERROR + "VRT_r_obj_ttl(sp)", "VRT_l_obj_ttl(sp, ", + V_RW, 0, + VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT + | VCL_MET_ERROR }, { "obj.grace", TIME, 9, - "VRT_r_obj_grace(sp)", - "VRT_l_obj_grace(sp, ", - V_RW, - 0, - VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT | VCL_MET_ERROR + "VRT_r_obj_grace(sp)", "VRT_l_obj_grace(sp, ", + V_RW, 0, + VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DISCARD | VCL_MET_TIMEOUT + | VCL_MET_ERROR }, { "obj.prefetch", RTIME, 12, - "VRT_r_obj_prefetch(sp)", - "VRT_l_obj_prefetch(sp, ", - V_RW, - 0, + "VRT_r_obj_prefetch(sp)", "VRT_l_obj_prefetch(sp, ", + V_RW, 0, VCL_MET_FETCH | VCL_MET_PREFETCH }, { "obj.lastuse", TIME, 11, - "VRT_r_obj_lastuse(sp)", - NULL, - V_RO, - 0, - VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT | VCL_MET_ERROR + "VRT_r_obj_lastuse(sp)", NULL, + V_RO, 0, + VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD + | VCL_MET_TIMEOUT | VCL_MET_ERROR }, { "obj.hash", STRING, 8, - "VRT_r_obj_hash(sp)", - NULL, - V_RO, - 0, - VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + "VRT_r_obj_hash(sp)", NULL, + V_RO, 0, + VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_ERROR }, { "resp.proto", STRING, 10, - "VRT_r_resp_proto(sp)", - "VRT_l_resp_proto(sp, ", - V_RW, - 0, + "VRT_r_resp_proto(sp)", "VRT_l_resp_proto(sp, ", + V_RW, 0, VCL_MET_DELIVER }, { "resp.status", INT, 11, - "VRT_r_resp_status(sp)", - "VRT_l_resp_status(sp, ", - V_RW, - 0, + "VRT_r_resp_status(sp)", "VRT_l_resp_status(sp, ", + V_RW, 0, VCL_MET_DELIVER }, { "resp.response", STRING, 13, - "VRT_r_resp_response(sp)", - "VRT_l_resp_response(sp, ", - V_RW, - 0, + "VRT_r_resp_response(sp)", "VRT_l_resp_response(sp, ", + V_RW, 0, VCL_MET_DELIVER }, { "resp.http.", HEADER, 10, - "VRT_r_resp_http_(sp)", - "VRT_l_resp_http_(sp, ", - V_RW, - "HDR_RESP", + "VRT_r_resp_http_(sp)", "VRT_l_resp_http_(sp, ", + V_RW, "HDR_RESP", VCL_MET_DELIVER }, { "now", TIME, 3, - "VRT_r_now(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT + "VRT_r_now(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_DISCARD | VCL_MET_TIMEOUT }, { "req.backend.healthy", BOOL, 19, - "VRT_r_req_backend_healthy(sp)", - NULL, - V_RO, - 0, - VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_DISCARD | VCL_MET_TIMEOUT + "VRT_r_req_backend_healthy(sp)", NULL, + V_RO, 0, + VCL_MET_RECV | VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_HASH + | VCL_MET_MISS | VCL_MET_HIT | VCL_MET_FETCH | VCL_MET_DELIVER + | VCL_MET_DISCARD | VCL_MET_TIMEOUT }, { NULL } }; Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -56,7 +56,7 @@ #define C(tl, sep) do { \ Fb(tl, 1, "VRT_count(sp, %u)%s\n", ++tl->cnt, sep); \ - tl->t->cnt = tl->cnt; \ + tl->t->cnt = tl->cnt; \ } while (0) /*-------------------------------------------------------------------- @@ -614,7 +614,7 @@ break; case ID: for (tp = toplev; tp->name != NULL; tp++) { - if (!vcc_IdIs(tl->t, tp->name)) + if (!vcc_IdIs(tl->t, tp->name)) continue; tp->func(tl); break; Modified: trunk/varnish-cache/lib/libvcl/vcc_priv.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_priv.h 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_priv.h 2008-10-18 20:50:10 UTC (rev 3324) @@ -40,7 +40,6 @@ #define isvar(c) (isident(c) || (c) == '.') unsigned vcl_fixed_token(const char *p, const char **q); extern const char *vcl_tnames[256]; -void vcl_init_tnames(void); void vcl_output_lang_h(struct vsb *sb); #define PF(t) (int)((t)->e - (t)->b), (t)->b Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -88,7 +88,7 @@ Expect(tl, ','); vcc_NextToken(tl); - + Expect(tl, CSTR); p = vcc_regexp(tl, 1); vcc_NextToken(tl); @@ -96,7 +96,7 @@ Expect(tl, ','); vcc_NextToken(tl); - + if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return (0); @@ -119,7 +119,7 @@ */ int -vcc_StringVal(struct tokenlist *tl) +vcc_StringVal(struct tokenlist *tl) { struct var *vp; @@ -154,9 +154,8 @@ Fb(tl, 0, "VRT_backend_string(sp)"); break; default: - vsb_printf(tl->sb, - "String representation of '%s' not implemented yet.\n", - vp->name); + vsb_printf(tl->sb, "String representation of '%s'" + " not implemented yet.\n", vp->name); vcc_ErrWhere(tl, tl->t); return (0); } Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -113,7 +113,7 @@ vcc_icoord(tl->sb, t, &l); vsb_printf(tl->sb, "\n"); - + x = y = 0; e = t->src->e; for (p = l; p < e && *p != '\n'; p++) { @@ -221,7 +221,7 @@ assert(t->tok == ID); for (q = t->b; q < t->e; q++) { - if (!isalnum(*q) && *q != '_') + if (!isalnum(*q) && *q != '_') return (0); } return (1); @@ -394,7 +394,7 @@ vcc_ErrWhere(tl, tl->t); return; } - + /* Recognize long-strings */ if (*p == '{' && p[1] == '"') { for (q = p + 2; q < sp->e; q++) { @@ -406,7 +406,7 @@ if (q < sp->e) { p = q + 2; u = tl->t->e - tl->t->b; - u -= 4; /* {" ... "} */ + u -= 4; /* {" ... "} */ tl->t->dec = TlAlloc(tl, u + 1 ); AN(tl->t->dec); memcpy(tl->t->dec, tl->t->b + 2, u); Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-10-17 21:53:06 UTC (rev 3323) +++ trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-10-18 20:50:10 UTC (rev 3324) @@ -340,13 +340,14 @@ struct procuse *pu; VTAILQ_FOREACH(pu, &p->uses, list) - if (!(pu->v->methods & m->bitval)) + if (!(pu->v->methods & m->bitval)) return (pu); return (NULL); } static int -vcc_CheckUseRecurse(struct tokenlist *tl, const struct proc *p, struct method *m) +vcc_CheckUseRecurse(struct tokenlist *tl, const struct proc *p, + struct method *m) { struct proccall *pc; struct procuse *pu; @@ -356,7 +357,7 @@ vsb_printf(tl->sb, "Variable \"%.*s\" is not available in %s\n", PF(pu->t), m->name); - vcc_ErrWhere(tl, pu->t); + vcc_ErrWhere(tl, pu->t); vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name)); vcc_ErrWhere(tl, p->name); From tfheen at projects.linpro.no Mon Oct 20 08:55:24 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 20 Oct 2008 10:55:24 +0200 (CEST) Subject: r3325 - in branches/2.0/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20081020085524.924501EC46B@projects.linpro.no> Author: tfheen Date: 2008-10-20 10:55:24 +0200 (Mon, 20 Oct 2008) New Revision: 3325 Added: branches/2.0/varnish-cache/bin/varnishtest/tests/r00345.vtc Modified: branches/2.0/varnish-cache/bin/varnishd/cache_hash.c branches/2.0/varnish-cache/bin/varnishd/cache_vrt_esi.c Log: Merge r3322 from trunk Modified: branches/2.0/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/cache_hash.c 2008-10-18 20:50:10 UTC (rev 3324) +++ branches/2.0/varnish-cache/bin/varnishd/cache_hash.c 2008-10-20 08:55:24 UTC (rev 3325) @@ -266,7 +266,8 @@ if (busy_o != NULL) { /* There are one or more busy objects, wait for them */ - VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list); + if (sp->esis == 0) + VTAILQ_INSERT_TAIL(&oh->waitinglist, sp, list); sp->objhead = oh; UNLOCK(&oh->mtx); return (NULL); Modified: branches/2.0/varnish-cache/bin/varnishd/cache_vrt_esi.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-18 20:50:10 UTC (rev 3324) +++ branches/2.0/varnish-cache/bin/varnishd/cache_vrt_esi.c 2008-10-20 08:55:24 UTC (rev 3325) @@ -796,7 +796,6 @@ void ESI_Deliver(struct sess *sp) { - struct esi_bit *eb; struct object *obj; @@ -839,7 +838,16 @@ sp->step = STP_RECV; http_ForceGet(sp->http); http_Unset(sp->http, H_Content_Length); - CNT_Session(sp); + while (1) { + CNT_Session(sp); + if (sp->step == STP_DONE) + break; + AN(sp->wrk); + WSL_Flush(sp->wrk, 0); + DSL(0x20, SLT_Debug, sp->id, "loop waiting for ESI"); + usleep(10000); + } + assert(sp->step == STP_DONE); sp->esis--; sp->obj = obj; Copied: branches/2.0/varnish-cache/bin/varnishtest/tests/r00345.vtc (from rev 3322, trunk/varnish-cache/bin/varnishtest/tests/r00345.vtc) =================================================================== --- branches/2.0/varnish-cache/bin/varnishtest/tests/r00345.vtc (rev 0) +++ branches/2.0/varnish-cache/bin/varnishtest/tests/r00345.vtc 2008-10-20 08:55:24 UTC (rev 3325) @@ -0,0 +1,40 @@ +# $Id$ + +test "#345, ESI waitinglist trouble" + +server s1 { + rxreq + txresp -body {} + rxreq + sema r1 sync 2 + delay 1 + txresp -body {DATA} +} -start + +varnish v1 -arg "-p diag_bitmap=0x20" -vcl+backend { + sub vcl_fetch { + if (req.url == "/") { + esi; + } + } +} -start + +client c1 { + txreq + rxresp + expect resp.bodylen == 4 +} -start + +client c2 { + txreq + sema r1 sync 2 + rxresp + expect resp.bodylen == 4 +} -run + +client c1 { + txreq + rxresp + expect resp.bodylen == 4 +} -run + From tfheen at projects.linpro.no Mon Oct 20 08:58:05 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 20 Oct 2008 10:58:05 +0200 (CEST) Subject: r3326 - branches/2.0/varnish-cache/bin/varnishreplay Message-ID: <20081020085805.9D6241EC7CA@projects.linpro.no> Author: tfheen Date: 2008-10-20 10:58:05 +0200 (Mon, 20 Oct 2008) New Revision: 3326 Modified: branches/2.0/varnish-cache/bin/varnishreplay/varnishreplay.c Log: Merge r3314 from trunk. Modified: branches/2.0/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-20 08:55:24 UTC (rev 3325) +++ branches/2.0/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-20 08:58:05 UTC (rev 3326) @@ -743,7 +743,8 @@ signal(SIGPIPE, SIG_IGN); pthread_attr_init(&thread_attr); - pthread_attr_setstacksize(&thread_attr, 16384); + /* XXX: seting the stack size manually reduces the memory usasage and increases speed */ + pthread_attr_setstacksize(&thread_attr, 32768); while (VSL_Dispatch(vd, gen_traffic, NULL) == 0) /* nothing */ ; From tfheen at projects.linpro.no Mon Oct 20 09:03:54 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 20 Oct 2008 11:03:54 +0200 (CEST) Subject: r3327 - trunk/varnish-cache/doc Message-ID: <20081020090354.2CC171EC46B@projects.linpro.no> Author: tfheen Date: 2008-10-20 11:03:53 +0200 (Mon, 20 Oct 2008) New Revision: 3327 Added: trunk/varnish-cache/doc/changes-2.0-2.0.1.xml trunk/varnish-cache/doc/changes-2.0.1.xml Modified: trunk/varnish-cache/doc/Makefile.am Log: Merge 2.0.x changes files from branches/2.0 Modified: trunk/varnish-cache/doc/Makefile.am =================================================================== --- trunk/varnish-cache/doc/Makefile.am 2008-10-20 08:58:05 UTC (rev 3326) +++ trunk/varnish-cache/doc/Makefile.am 2008-10-20 09:03:53 UTC (rev 3327) @@ -1,6 +1,7 @@ # $Id$ CHANGELOGS = \ + changes-2.0.1.html \ changes-2.0.html \ changes-1.1.2.html \ changes-1.1.1.html \ @@ -8,6 +9,7 @@ changes-1.0.4.html XML = \ + changes-2.0-2.0.1.xml \ changes-1.1.2-2.0.xml \ changes-1.1.1-1.1.2.xml \ changes-1.1-1.1.1.xml \ Copied: trunk/varnish-cache/doc/changes-2.0-2.0.1.xml (from rev 3317, branches/2.0/varnish-cache/doc/changes-2.0-2.0.1.xml) =================================================================== --- trunk/varnish-cache/doc/changes-2.0-2.0.1.xml (rev 0) +++ trunk/varnish-cache/doc/changes-2.0-2.0.1.xml 2008-10-20 09:03:53 UTC (rev 3327) @@ -0,0 +1,29 @@ + + +]> + + + + varnishd + + + When receiving a garbled HTTP + request, varnishd would sometimes crash. This has + been fixed. + + + + There was an off-by-one error in the ACL compilation. + Now fixed. + + + + + Red Hat spec file + + + A typo in the spec file made the .rpm file names wrong. + + + Copied: trunk/varnish-cache/doc/changes-2.0.1.xml (from rev 3317, branches/2.0/varnish-cache/doc/changes-2.0.1.xml) =================================================================== --- trunk/varnish-cache/doc/changes-2.0.1.xml (rev 0) +++ trunk/varnish-cache/doc/changes-2.0.1.xml 2008-10-20 09:03:53 UTC (rev 3327) @@ -0,0 +1,12 @@ + + + +]> + + + Varnish + 2.0.1 + + + From tfheen at projects.linpro.no Mon Oct 20 09:04:54 2008 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 20 Oct 2008 11:04:54 +0200 (CEST) Subject: r3328 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081020090454.8F4F91EC421@projects.linpro.no> Author: tfheen Date: 2008-10-20 11:04:54 +0200 (Mon, 20 Oct 2008) New Revision: 3328 Modified: trunk/varnish-cache/bin/varnishtest/tests/b00001.vtc Log: No need to delay for varnishd to update stats, varnishtest does this for us Modified: trunk/varnish-cache/bin/varnishtest/tests/b00001.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00001.vtc 2008-10-20 09:03:53 UTC (rev 3327) +++ trunk/varnish-cache/bin/varnishtest/tests/b00001.vtc 2008-10-20 09:04:54 UTC (rev 3328) @@ -19,9 +19,6 @@ expect resp.status == 200 } -run -# Give varnish a chance to update stats -delay .1 - varnish v1 -expect n_object == 0 varnish v1 -expect client_conn == 1 varnish v1 -expect client_req == 1 From phk at projects.linpro.no Mon Oct 20 15:01:37 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 17:01:37 +0200 (CEST) Subject: r3329 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20081020150137.F20A91EC46B@projects.linpro.no> Author: phk Date: 2008-10-20 17:01:37 +0200 (Mon, 20 Oct 2008) New Revision: 3329 Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/include/stat_field.h Log: Add a boolean parameter "purge_dups", to make it possible to mark earlier bans of the same regexp as "gone" to save duplicate regexp checking. Prodded to by: jodok Modified: trunk/varnish-cache/bin/varnishd/cache_ban.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-10-20 09:04:54 UTC (rev 3328) +++ trunk/varnish-cache/bin/varnishd/cache_ban.c 2008-10-20 15:01:37 UTC (rev 3329) @@ -49,6 +49,8 @@ #define BAN_MAGIC 0x700b08ea VTAILQ_ENTRY(ban) list; unsigned refcount; + int flags; +#define BAN_F_GONE (1 << 0) regex_t regexp; char *ban; int hash; @@ -68,8 +70,9 @@ int BAN_Add(struct cli *cli, const char *regexp, int hash) { - struct ban *b; + struct ban *b, *bi, *be; char buf[512]; + unsigned pcount; int i; ALLOC_OBJ(b, BAN_MAGIC); @@ -97,8 +100,37 @@ ban_start = b; VSL_stats->n_purge++; VSL_stats->n_purge_add++; + + if (params->purge_dups) { + be = VTAILQ_LAST(&ban_head, banhead); + be->refcount++; + } else + be = NULL; UNLOCK(&ban_mtx); + if (be == NULL) + return (0); + + /* Hunt down duplicates, and mark them as gone */ + bi = b; + pcount = 0; + while(bi != be) { + bi = VTAILQ_NEXT(bi, list); + if (bi->flags & BAN_F_GONE) + continue; + if (b->hash != bi->hash) + continue; + if (strcmp(b->ban, bi->ban)) + continue; + bi->flags |= BAN_F_GONE; + pcount++; + } + LOCK(&ban_mtx); + be->refcount--; + /* XXX: We should check if the tail can be removed */ + VSL_stats->n_purge_dups += pcount; + UNLOCK(&ban_mtx); + return (0); } @@ -168,7 +200,8 @@ tests = 0; for (b = b0; b != o->ban; b = VTAILQ_NEXT(b, list)) { tests++; - if (!regexec(&b->regexp, b->hash ? hash : url, 0, NULL, 0)) + if (!(b->flags & BAN_F_GONE) && + !regexec(&b->regexp, b->hash ? hash : url, 0, NULL, 0)) break; } @@ -227,8 +260,8 @@ for (b0 = ban_start; b0 != NULL; b0 = VTAILQ_NEXT(b0, list)) { if (b0->refcount == 0 && VTAILQ_NEXT(b0, list) == NULL) break; - cli_out(cli, "%5u %s \"%s\"\n", - b0->refcount, + cli_out(cli, "%5u %d %s \"%s\"\n", + b0->refcount, b0->flags, b0->hash ? "hash" : "url ", b0->ban); } Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-20 09:04:54 UTC (rev 3328) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2008-10-20 15:01:37 UTC (rev 3329) @@ -183,6 +183,9 @@ /* Amount of time to sleep when running out of file descriptors. In msecs */ unsigned accept_fd_holdoff; + + /* Get rid of duplicate purges */ + unsigned purge_dups; }; extern volatile struct params *params; Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 09:04:54 UTC (rev 3328) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 15:01:37 UTC (rev 3329) @@ -825,6 +825,10 @@ "The TTL assigned to the synthesized error pages\n", 0, "0", "seconds" }, + { "purge_dups", tweak_bool, &master.purge_dups, 0, 0, + "Detect and eliminate duplicate purges.\n", + 0, + "off", "bool" }, { NULL, NULL, NULL } }; Modified: trunk/varnish-cache/include/stat_field.h =================================================================== --- trunk/varnish-cache/include/stat_field.h 2008-10-20 09:04:54 UTC (rev 3328) +++ trunk/varnish-cache/include/stat_field.h 2008-10-20 15:01:37 UTC (rev 3329) @@ -125,3 +125,4 @@ MAC_STAT(n_purge_retire, uint64_t, 'a', "N old purges deleted") MAC_STAT(n_purge_obj_test, uint64_t, 'a', "N objects tested") MAC_STAT(n_purge_re_test, uint64_t, 'a', "N regexps tested against") +MAC_STAT(n_purge_dups, uint64_t, 'a', "N duplicate purges removed") From phk at projects.linpro.no Mon Oct 20 17:45:54 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 19:45:54 +0200 (CEST) Subject: r3330 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081020174554.77DE71EC7CA@projects.linpro.no> Author: phk Date: 2008-10-20 19:45:54 +0200 (Mon, 20 Oct 2008) New Revision: 3330 Added: trunk/varnish-cache/bin/varnishtest/c00019.vtc Log: Add a test-case for dup purge elimination Added: trunk/varnish-cache/bin/varnishtest/c00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/c00019.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/c00019.vtc 2008-10-20 17:45:54 UTC (rev 3330) @@ -0,0 +1,83 @@ +# $Id$ + +test "Check purge counters and duplicate purge elimination" + +server s1 { + rxreq + txresp -hdr "foo: 1" -body "foo1" + rxreq + txresp -hdr "foo: 2" -body "foo2" + rxreq + txresp -hdr "foo: 3" -body "foo3" +} -start + +varnish v1 -vcl+backend {} -start + +varnish v1 -cliok "purge.url FOO" + +# There is one "magic" purge from boot +varnish v1 -expect n_purge_add == 2 +varnish v1 -cliok "purge.list" + +# Our fetch is not affected by the purge +# as the FOO-purge was preexisting +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 1 +} -run + +varnish v1 -cliok "purge.list" +varnish v1 -expect n_purge_obj_test == 0 +varnish v1 -expect n_purge_re_test == 0 + +# Add another purge +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 3 +varnish v1 -cliok "purge.list" + +# The cached object will be purged, and a new +# fetched from the backend +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 2 +} -run + +varnish v1 -expect n_purge_obj_test == 1 +varnish v1 -expect n_purge_re_test == 1 +varnish v1 -cliok "purge.list" + +# Fetch the cached copy, just for grins +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 2 +} -run + + +# Now add another purge +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 4 + +# Enable dup removal of purges +varnish v1 -cliok "param.set purge_dups on" + +# This should incapacitate the to previous FOO purges. +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 5 +varnish v1 -expect n_purge_dups == 3 +varnish v1 -cliok "purge.list" + +# And we should get a fresh object from backend +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 3 +} -run + +# With only two objects having ever been compared +varnish v1 -expect n_purge_obj_test == 2 +varnish v1 -expect n_purge_re_test == 2 +varnish v1 -cliok "purge.list" + From phk at projects.linpro.no Mon Oct 20 17:57:28 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 19:57:28 +0200 (CEST) Subject: r3331 - in trunk/varnish-cache/bin/varnishtest: . tests Message-ID: <20081020175728.EB7871EC815@projects.linpro.no> Author: phk Date: 2008-10-20 19:57:28 +0200 (Mon, 20 Oct 2008) New Revision: 3331 Added: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc Removed: trunk/varnish-cache/bin/varnishtest/c00019.vtc Log: OOps, wrong directory Deleted: trunk/varnish-cache/bin/varnishtest/c00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/c00019.vtc 2008-10-20 17:45:54 UTC (rev 3330) +++ trunk/varnish-cache/bin/varnishtest/c00019.vtc 2008-10-20 17:57:28 UTC (rev 3331) @@ -1,83 +0,0 @@ -# $Id$ - -test "Check purge counters and duplicate purge elimination" - -server s1 { - rxreq - txresp -hdr "foo: 1" -body "foo1" - rxreq - txresp -hdr "foo: 2" -body "foo2" - rxreq - txresp -hdr "foo: 3" -body "foo3" -} -start - -varnish v1 -vcl+backend {} -start - -varnish v1 -cliok "purge.url FOO" - -# There is one "magic" purge from boot -varnish v1 -expect n_purge_add == 2 -varnish v1 -cliok "purge.list" - -# Our fetch is not affected by the purge -# as the FOO-purge was preexisting -client c1 { - txreq -url /FOO - rxresp - expect resp.http.foo == 1 -} -run - -varnish v1 -cliok "purge.list" -varnish v1 -expect n_purge_obj_test == 0 -varnish v1 -expect n_purge_re_test == 0 - -# Add another purge -varnish v1 -cliok "purge.url FOO" -varnish v1 -expect n_purge_add == 3 -varnish v1 -cliok "purge.list" - -# The cached object will be purged, and a new -# fetched from the backend -client c1 { - txreq -url /FOO - rxresp - expect resp.http.foo == 2 -} -run - -varnish v1 -expect n_purge_obj_test == 1 -varnish v1 -expect n_purge_re_test == 1 -varnish v1 -cliok "purge.list" - -# Fetch the cached copy, just for grins -client c1 { - txreq -url /FOO - rxresp - expect resp.http.foo == 2 -} -run - - -# Now add another purge -varnish v1 -cliok "purge.url FOO" -varnish v1 -expect n_purge_add == 4 - -# Enable dup removal of purges -varnish v1 -cliok "param.set purge_dups on" - -# This should incapacitate the to previous FOO purges. -varnish v1 -cliok "purge.url FOO" -varnish v1 -expect n_purge_add == 5 -varnish v1 -expect n_purge_dups == 3 -varnish v1 -cliok "purge.list" - -# And we should get a fresh object from backend -client c1 { - txreq -url /FOO - rxresp - expect resp.http.foo == 3 -} -run - -# With only two objects having ever been compared -varnish v1 -expect n_purge_obj_test == 2 -varnish v1 -expect n_purge_re_test == 2 -varnish v1 -cliok "purge.list" - Copied: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc (from rev 3330, trunk/varnish-cache/bin/varnishtest/c00019.vtc) =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc 2008-10-20 17:57:28 UTC (rev 3331) @@ -0,0 +1,83 @@ +# $Id$ + +test "Check purge counters and duplicate purge elimination" + +server s1 { + rxreq + txresp -hdr "foo: 1" -body "foo1" + rxreq + txresp -hdr "foo: 2" -body "foo2" + rxreq + txresp -hdr "foo: 3" -body "foo3" +} -start + +varnish v1 -vcl+backend {} -start + +varnish v1 -cliok "purge.url FOO" + +# There is one "magic" purge from boot +varnish v1 -expect n_purge_add == 2 +varnish v1 -cliok "purge.list" + +# Our fetch is not affected by the purge +# as the FOO-purge was preexisting +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 1 +} -run + +varnish v1 -cliok "purge.list" +varnish v1 -expect n_purge_obj_test == 0 +varnish v1 -expect n_purge_re_test == 0 + +# Add another purge +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 3 +varnish v1 -cliok "purge.list" + +# The cached object will be purged, and a new +# fetched from the backend +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 2 +} -run + +varnish v1 -expect n_purge_obj_test == 1 +varnish v1 -expect n_purge_re_test == 1 +varnish v1 -cliok "purge.list" + +# Fetch the cached copy, just for grins +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 2 +} -run + + +# Now add another purge +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 4 + +# Enable dup removal of purges +varnish v1 -cliok "param.set purge_dups on" + +# This should incapacitate the to previous FOO purges. +varnish v1 -cliok "purge.url FOO" +varnish v1 -expect n_purge_add == 5 +varnish v1 -expect n_purge_dups == 3 +varnish v1 -cliok "purge.list" + +# And we should get a fresh object from backend +client c1 { + txreq -url /FOO + rxresp + expect resp.http.foo == 3 +} -run + +# With only two objects having ever been compared +varnish v1 -expect n_purge_obj_test == 2 +varnish v1 -expect n_purge_re_test == 2 +varnish v1 -cliok "purge.list" + Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Name: svn:mergeinfo + From phk at projects.linpro.no Mon Oct 20 18:01:48 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 20:01:48 +0200 (CEST) Subject: r3332 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081020180148.96A241EC7CA@projects.linpro.no> Author: phk Date: 2008-10-20 20:01:48 +0200 (Mon, 20 Oct 2008) New Revision: 3332 Modified: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc Log: Add a bit more coverage to this test. Modified: trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc 2008-10-20 17:57:28 UTC (rev 3331) +++ trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc 2008-10-20 18:01:48 UTC (rev 3332) @@ -56,16 +56,17 @@ } -run -# Now add another purge +# Now add another two purge, the hash should not be hit. +varnish v1 -cliok "purge.hash FOO" varnish v1 -cliok "purge.url FOO" -varnish v1 -expect n_purge_add == 4 +varnish v1 -expect n_purge_add == 5 # Enable dup removal of purges varnish v1 -cliok "param.set purge_dups on" # This should incapacitate the to previous FOO purges. varnish v1 -cliok "purge.url FOO" -varnish v1 -expect n_purge_add == 5 +varnish v1 -expect n_purge_add == 6 varnish v1 -expect n_purge_dups == 3 varnish v1 -cliok "purge.list" @@ -81,3 +82,6 @@ varnish v1 -expect n_purge_re_test == 2 varnish v1 -cliok "purge.list" +# Test a bogus regexp + +varnish v1 -clierr 106 "purge.url [[[" From phk at projects.linpro.no Mon Oct 20 18:19:06 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 20:19:06 +0200 (CEST) Subject: r3333 - trunk/varnish-cache/bin/varnishd Message-ID: <20081020181906.9A68D1EC7CA@projects.linpro.no> Author: phk Date: 2008-10-20 20:19:06 +0200 (Mon, 20 Oct 2008) New Revision: 3333 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Change default to always use HTTP/1.1 with the backend Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 18:01:48 UTC (rev 3332) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 18:19:06 UTC (rev 3333) @@ -690,7 +690,7 @@ "By default we copy the protocol version from the " "incoming client request.", EXPERIMENTAL, - "off", "bool" }, + "on", "bool" }, { "client_http11", tweak_bool, &master.client_http11, 0, 0, "Force all client responses to be HTTP/1.1.\n" "By default we copy the protocol version from the " From des at des.no Mon Oct 20 18:28:14 2008 From: des at des.no (=?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?=) Date: Mon, 20 Oct 2008 20:28:14 +0200 Subject: r3324 - in trunk/varnish-cache: bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtest bin/varnishtop include lib/libvarnish lib/libvarnishapi lib/libvcl In-Reply-To: <20081018205010.B7B3B1EC7D5@projects.linpro.no> (phk@projects.linpro.no's message of "Sat, 18 Oct 2008 22:50:10 +0200 (CEST)") References: <20081018205010.B7B3B1EC7D5@projects.linpro.no> Message-ID: <864p37glz5.fsf@ds4.des.no> phk at projects.linpro.no writes: > trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c > trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl > trunk/varnish-cache/lib/libvcl/vcc_gen_obj.tcl > trunk/varnish-cache/lib/libvcl/vcc_obj.c You need to commit the generated files separately, otherwise make will insist that they are out of date + the $Id$ in the generated file will not match the $Id$ in the source. DES -- Dag-Erling Sm?rgrav - des at des.no From des at projects.linpro.no Mon Oct 20 18:33:15 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 20:33:15 +0200 (CEST) Subject: r3334 - trunk/varnish-cache Message-ID: <20081020183315.EC9C91EC45F@projects.linpro.no> Author: des Date: 2008-10-20 20:33:15 +0200 (Mon, 20 Oct 2008) New Revision: 3334 Modified: trunk/varnish-cache/configure.ac Log: Strictly speaking, we should test $target, not $host - although in practice, varnish is not cross-buildable anyway due to the SO_RCVTIMEO / SO_SNDTIMEO tests. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-10-20 18:19:06 UTC (rev 3333) +++ trunk/varnish-cache/configure.ac 2008-10-20 18:33:15 UTC (rev 3334) @@ -110,7 +110,7 @@ LIBS="${save_LIBS}" ## This one is tricky, there are multiple versions -case $host in +case $target in *-*-freebsd*) AC_CACHE_CHECK([whether sendfile works], [ac_cv_so_sendfile_works], @@ -144,7 +144,7 @@ fi ;; *) - AC_MSG_WARN([won't look for sendfile() on $host]) + AC_MSG_WARN([won't look for sendfile() on $target]) ;; esac @@ -178,13 +178,13 @@ [enable_kqueue=yes]) if test "$enable_kqueue" = yes; then - case $host in + case $target in *-*-freebsd* | *-*-darwin9* ) AC_CHECK_FUNCS([kqueue]) ;; *-*-bsd*) # No other BSD has a sufficiently recent implementation - AC_MSG_WARN([won't look for kqueue() on $host]) + AC_MSG_WARN([won't look for kqueue() on $target]) ac_cv_func_kqueue=no ;; esac @@ -330,7 +330,7 @@ if test "$ac_cv_env_VCC_CC_set" = "set"; then VCC_CC="$ac_cv_env_VCC_CC_value" else - case $host in + case $target in *-*-solaris*) VCC_CC="cc -Kpic -G -o %o %s" ;; @@ -353,7 +353,7 @@ JEMALLOC_SUBDIR=libjemalloc JEMALLOC_LDADD='$(top_builddir)/lib/libjemalloc/libjemalloc_mt.la' fi], -[case $host in #( +[case $target in #( *-*-linux*) JEMALLOC_SUBDIR=libjemalloc JEMALLOC_LDADD='$(top_builddir)/lib/libjemalloc/libjemalloc_mt.la' From des at projects.linpro.no Mon Oct 20 18:40:32 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 20:40:32 +0200 (CEST) Subject: r3335 - trunk/varnish-cache/lib/libvarnish Message-ID: <20081020184032.320591EC7CA@projects.linpro.no> Author: des Date: 2008-10-20 20:40:32 +0200 (Mon, 20 Oct 2008) New Revision: 3335 Modified: trunk/varnish-cache/lib/libvarnish/flopen.c trunk/varnish-cache/lib/libvarnish/vpf.c Log: Sync with FreeBSD Modified: trunk/varnish-cache/lib/libvarnish/flopen.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:33:15 UTC (rev 3334) +++ trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:40:32 UTC (rev 3335) @@ -26,17 +26,17 @@ * * $Id$ * Derived from: - * $FreeBSD: src/lib/libutil/flopen.c,v 1.7 2007/05/23 12:09:33 des Exp $ + * $FreeBSD: head/lib/libutil/flopen.c 184094 2008-10-20 18:11:30Z des $ */ #include "config.h" -#include #include #include #include #include +#include #include #include "config.h" @@ -46,8 +46,8 @@ flopen(const char *path, int flags, ...) { int fd, operation, serrno, trunc; - struct stat sb, fsb; struct flock lock; + struct stat sb, fsb; mode_t mode; #ifdef O_EXLOCK @@ -63,10 +63,9 @@ va_end(ap); } + memset(&lock, 0, sizeof lock); lock.l_type = ((flags & O_ACCMODE) == O_RDONLY) ? F_RDLCK : F_WRLCK; - lock.l_start = 0; lock.l_whence = SEEK_SET; - lock.l_len = 0; operation = (flags & O_NONBLOCK) ? F_SETLK : F_SETLKW; trunc = (flags & O_TRUNC); Modified: trunk/varnish-cache/lib/libvarnish/vpf.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:33:15 UTC (rev 3334) +++ trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:40:32 UTC (rev 3335) @@ -25,7 +25,7 @@ * * $Id$ * Derived from: - * $FreeBSD: src/lib/libutil/pidfile.c,v 1.5 2007/05/11 11:10:05 des Exp $ + * $FreeBSD: head/lib/libutil/pidfile.c 184091 2008-10-20 17:41:08Z des $ */ #include "config.h" @@ -230,14 +230,8 @@ static int _vpf_remove(struct pidfh *pfh, int freeit) { - struct flock lock; int error; - lock.l_type = F_UNLCK; - lock.l_start = 0; - lock.l_whence = SEEK_SET; - lock.l_len = 0; - error = vpf_verify(pfh); if (error != 0) { errno = error; @@ -246,10 +240,6 @@ if (unlink(pfh->pf_path) == -1) error = errno; - if (fcntl(pfh->pf_fd, F_SETLK, &lock) == -1) { - if (error == 0) - error = errno; - } if (close(pfh->pf_fd) == -1) { if (error == 0) error = errno; From des at projects.linpro.no Mon Oct 20 18:47:25 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 20:47:25 +0200 (CEST) Subject: r3336 - in trunk/varnish-cache: bin/varnishadm bin/varnishd bin/varnishhist bin/varnishlog bin/varnishncsa bin/varnishreplay bin/varnishstat bin/varnishtest bin/varnishtop lib/libvarnish lib/libvarnishapi lib/libvcl Message-ID: <20081020184725.05FE31EC815@projects.linpro.no> Author: des Date: 2008-10-20 20:47:24 +0200 (Mon, 20 Oct 2008) New Revision: 3336 Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/storage_file.c trunk/varnish-cache/bin/varnishhist/varnishhist.c trunk/varnish-cache/bin/varnishlog/varnishlog.c trunk/varnish-cache/bin/varnishncsa/varnishncsa.c trunk/varnish-cache/bin/varnishreplay/varnishreplay.c trunk/varnish-cache/bin/varnishstat/varnishstat.c trunk/varnish-cache/bin/varnishtest/vtc.c trunk/varnish-cache/bin/varnishtest/vtc_client.c trunk/varnish-cache/bin/varnishtest/vtc_http.c trunk/varnish-cache/bin/varnishtest/vtc_log.c trunk/varnish-cache/bin/varnishtest/vtc_sema.c trunk/varnish-cache/bin/varnishtest/vtc_server.c trunk/varnish-cache/bin/varnishtest/vtc_varnish.c trunk/varnish-cache/bin/varnishtop/varnishtop.c trunk/varnish-cache/lib/libvarnish/argv.c trunk/varnish-cache/lib/libvarnish/assert.c trunk/varnish-cache/lib/libvarnish/binary_heap.c trunk/varnish-cache/lib/libvarnish/cli_common.c trunk/varnish-cache/lib/libvarnish/flopen.c trunk/varnish-cache/lib/libvarnish/time.c trunk/varnish-cache/lib/libvarnish/vct.c trunk/varnish-cache/lib/libvarnish/version.c trunk/varnish-cache/lib/libvarnish/vlu.c trunk/varnish-cache/lib/libvarnish/vpf.c trunk/varnish-cache/lib/libvarnish/vss.c trunk/varnish-cache/lib/libvarnish/vtmpfile.c trunk/varnish-cache/lib/libvarnishapi/base64.c trunk/varnish-cache/lib/libvarnishapi/instance.c trunk/varnish-cache/lib/libvarnishapi/shmlog.c trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_compile.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_string.c trunk/varnish-cache/lib/libvcl/vcc_token.c trunk/varnish-cache/lib/libvcl/vcc_var.c trunk/varnish-cache/lib/libvcl/vcc_xref.c Log: Revert r3072, which was a no-op. Add "config.h" where it's missing. Modified: trunk/varnish-cache/bin/varnishadm/varnishadm.c =================================================================== --- trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishadm/varnishadm.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -36,7 +36,6 @@ #include #include -#include "config.h" #include "libvarnish.h" #include "vss.h" Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -67,7 +67,6 @@ #include #include -#include "config.h" #ifndef HAVE_SRANDOMDEV #include "compat/srandomdev.h" #endif Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -41,7 +41,6 @@ #include #include -#include "config.h" #include "shmlog.h" #include "vct.h" #include "cache.h" Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -37,7 +37,6 @@ #include #include -#include "config.h" #include "cache.h" #include "cache_backend.h" #include "vcl.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -45,7 +45,6 @@ #include #include -#include "config.h" #ifndef HAVE_SETPROCTITLE #include "compat/setproctitle.h" #endif Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -45,7 +45,6 @@ #include #include -#include "config.h" #ifndef HAVE_VASPRINTF #include "compat/vasprintf.h" #endif Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -43,7 +43,6 @@ #include #include -#include "config.h" #include "cli.h" #include "cli_priv.h" #include "cli_common.h" Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -43,7 +43,6 @@ #include #include -#include "config.h" #ifndef HAVE_ASPRINTF #include "compat/asprintf.h" #endif Modified: trunk/varnish-cache/bin/varnishd/storage_file.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_file.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishd/storage_file.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -38,7 +38,6 @@ #include #include -#include "config.h" #ifdef HAVE_SYS_MOUNT_H #include #endif Modified: trunk/varnish-cache/bin/varnishhist/varnishhist.c =================================================================== --- trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishhist/varnishhist.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -46,7 +46,6 @@ #include #include -#include "config.h" #include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" Modified: trunk/varnish-cache/bin/varnishlog/varnishlog.c =================================================================== --- trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishlog/varnishlog.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -43,7 +43,6 @@ #include #include -#include "config.h" #ifndef HAVE_DAEMON #include "compat/daemon.h" #endif Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -71,7 +71,6 @@ #include #include -#include "config.h" #ifndef HAVE_DAEMON #include "compat/daemon.h" #endif Modified: trunk/varnish-cache/bin/varnishreplay/varnishreplay.c =================================================================== --- trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishreplay/varnishreplay.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -43,7 +43,6 @@ #include #include -#include "config.h" #include "vqueue.h" #include "libvarnish.h" Modified: trunk/varnish-cache/bin/varnishstat/varnishstat.c =================================================================== --- trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishstat/varnishstat.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -46,7 +46,6 @@ #include #include -#include "config.h" #include "libvarnish.h" #include "shmlog.h" #include "varnishapi.h" Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_client.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,9 +26,12 @@ * $Id$ */ +#include "config.h" #include #include +#include +#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_sema.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,8 @@ * $Id$ */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_server.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,7 @@ * $Id$ */ +#include "config.h" #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -26,6 +26,7 @@ * $Id$ */ +#include "config.h" #include Modified: trunk/varnish-cache/bin/varnishtop/varnishtop.c =================================================================== --- trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/bin/varnishtop/varnishtop.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -45,7 +45,6 @@ #include #include -#include "config.h" #include "vqueue.h" #include "vsb.h" Modified: trunk/varnish-cache/lib/libvarnish/argv.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/argv.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/argv.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -45,7 +45,6 @@ #include #include -#include "config.h" #include "libvarnish.h" static int Modified: trunk/varnish-cache/lib/libvarnish/assert.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/assert.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/assert.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -37,7 +37,6 @@ #include #include -#include "config.h" #include "libvarnish.h" static void Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -41,7 +41,6 @@ #include #include -#include "config.h" #include "binary_heap.h" #include "libvarnish.h" Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/cli_common.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -46,7 +46,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "libvarnish.h" Modified: trunk/varnish-cache/lib/libvarnish/flopen.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/flopen.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -39,7 +39,6 @@ #include #include -#include "config.h" #include "flopen.h" int Modified: trunk/varnish-cache/lib/libvarnish/time.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/time.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/time.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -56,7 +56,6 @@ #include #include -#include "config.h" #include "libvarnish.h" double Modified: trunk/varnish-cache/lib/libvarnish/vct.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vct.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/vct.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -30,6 +30,8 @@ * ctype(3) like functions, according to RFC2616 */ +#include "config.h" + #include /* NB: VCT always operate in ASCII, don't replace 0x0d with \r etc. */ Modified: trunk/varnish-cache/lib/libvarnish/version.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/version.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/version.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -35,7 +35,6 @@ #include -#include "config.h" #include "libvarnish.h" void Modified: trunk/varnish-cache/lib/libvarnish/vlu.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vlu.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/vlu.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -29,6 +29,8 @@ * a function on each. */ +#include "config.h" + #include #include #include Modified: trunk/varnish-cache/lib/libvarnish/vpf.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/vpf.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -41,7 +41,6 @@ #include #include -#include "config.h" #ifndef HAVE_STRLCPY #include "compat/strlcpy.h" #endif Modified: trunk/varnish-cache/lib/libvarnish/vss.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vss.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/vss.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -44,7 +44,6 @@ #include #include -#include "config.h" #ifndef HAVE_STRLCPY #include "compat/strlcpy.h" #endif Modified: trunk/varnish-cache/lib/libvarnish/vtmpfile.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vtmpfile.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnish/vtmpfile.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -36,7 +36,6 @@ #include #include -#include "config.h" #include "libvarnish.h" int Modified: trunk/varnish-cache/lib/libvarnishapi/base64.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/base64.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnishapi/base64.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -10,7 +10,6 @@ #include #include -#include "config.h" #include "varnishapi.h" static const char *b64 = Modified: trunk/varnish-cache/lib/libvarnishapi/instance.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnishapi/instance.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -34,7 +34,6 @@ #include #include -#include "config.h" #include "varnishapi.h" int Modified: trunk/varnish-cache/lib/libvarnishapi/shmlog.c =================================================================== --- trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvarnishapi/shmlog.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -45,7 +45,6 @@ #include #include -#include "config.h" #include "shmlog.h" #include "miniobj.h" #include "varnishapi.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -41,7 +41,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "vrt.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -33,7 +33,6 @@ #include -#include "config.h" #include "vsb.h" #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -60,7 +60,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -73,7 +73,6 @@ #include #include -#include "config.h" #include "vqueue.h" #include "vsb.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -9,7 +9,6 @@ #include "config.h" #include #include -#include "config.h" #include "vcc_priv.h" #include "vsb.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -34,7 +34,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_string.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -34,7 +34,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_token.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -36,7 +36,6 @@ #include #include -#include "config.h" #include "vqueue.h" #include "vsb.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -34,7 +34,6 @@ #include #include -#include "config.h" #include "vsb.h" #include "vcc_priv.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-10-20 18:40:32 UTC (rev 3335) +++ trunk/varnish-cache/lib/libvcl/vcc_xref.c 2008-10-20 18:47:24 UTC (rev 3336) @@ -43,7 +43,6 @@ #include -#include "config.h" #include "vsb.h" #include "libvarnish.h" From phk at projects.linpro.no Mon Oct 20 19:57:27 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 21:57:27 +0200 (CEST) Subject: r3337 - trunk/varnish-cache/lib/libvcl Message-ID: <20081020195727.990391EC7CA@projects.linpro.no> Author: phk Date: 2008-10-20 21:57:27 +0200 (Mon, 20 Oct 2008) New Revision: 3337 Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Regen to get Ids right Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 18:47:24 UTC (rev 3336) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 19:57:27 UTC (rev 3337) @@ -9,6 +9,7 @@ #include "config.h" #include #include +#include "config.h" #include "vcc_priv.h" #include "vsb.h" @@ -166,8 +167,8 @@ /* ../../include/vcl.h */ - vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3098 2008-08-18 08"); - vsb_cat(sb, ":18:43Z phk $\n *\n * NB: This file is machine genera"); + vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3324 2008-10-18 20"); + vsb_cat(sb, ":50:10Z phk $\n *\n * NB: This file is machine genera"); vsb_cat(sb, "ted, DO NOT EDIT!\n *\n * Edit vcc_gen_fixed_token.tcl"); vsb_cat(sb, " instead\n */\n\nstruct sess;\nstruct cli;\n\ntypedef "); vsb_cat(sb, "void vcl_init_f(struct cli *);\ntypedef void vcl_fini_"); @@ -218,7 +219,7 @@ vsb_cat(sb, " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI"); vsb_cat(sb, "SE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFT"); vsb_cat(sb, "WARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH D"); - vsb_cat(sb, "AMAGE.\n *\n * $Id: vrt.h 3234 2008-09-29 07:32:26Z ph"); + vsb_cat(sb, "AMAGE.\n *\n * $Id: vrt.h 3324 2008-10-18 20:50:10Z ph"); vsb_cat(sb, "k $\n *\n * Runtime support for compiled VCL programs."); vsb_cat(sb, "\n *\n * XXX: When this file is changed, lib/libvcl/vc"); vsb_cat(sb, "c_gen_fixed_token.tcl\n * XXX: *MUST* be rerun.\n */\n"); @@ -294,54 +295,54 @@ /* ../../include/vrt_obj.h */ - vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3169 2008-09-08 09:49:01Z "); - vsb_cat(sb, "tfheen $\n *\n * NB: This file is machine generated, "); - vsb_cat(sb, "DO NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n */"); - vsb_cat(sb, "\n\nstruct sockaddr * VRT_r_client_ip(const struct ses"); - vsb_cat(sb, "s *);\nstruct sockaddr * VRT_r_server_ip(struct sess *"); - vsb_cat(sb, ");\nint VRT_r_server_port(struct sess *);\nconst char "); - vsb_cat(sb, "* VRT_r_req_request(const struct sess *);\nvoid VRT_l_"); - vsb_cat(sb, "req_request(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_req_url(const struct sess *);\nvoid"); - vsb_cat(sb, " VRT_l_req_url(const struct sess *, const char *, ...)"); - vsb_cat(sb, ";\nconst char * VRT_r_req_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_proto(const struct sess *, const char *"); - vsb_cat(sb, ", ...);\nvoid VRT_l_req_hash(struct sess *, const char"); - vsb_cat(sb, " *);\nstruct director * VRT_r_req_backend(struct sess "); - vsb_cat(sb, "*);\nvoid VRT_l_req_backend(struct sess *, struct dire"); - vsb_cat(sb, "ctor *);\nint VRT_r_req_restarts(const struct sess *);"); - vsb_cat(sb, "\ndouble VRT_r_req_grace(struct sess *);\nvoid VRT_l_r"); - vsb_cat(sb, "eq_grace(struct sess *, double);\nconst char * VRT_r_r"); - vsb_cat(sb, "eq_xid(struct sess *);\nconst char * VRT_r_bereq_reque"); - vsb_cat(sb, "st(const struct sess *);\nvoid VRT_l_bereq_request(con"); - vsb_cat(sb, "st struct sess *, const char *, ...);\nconst char * VR"); - vsb_cat(sb, "T_r_bereq_url(const struct sess *);\nvoid VRT_l_bereq_"); - vsb_cat(sb, "url(const struct sess *, const char *, ...);\nconst ch"); - vsb_cat(sb, "ar * VRT_r_bereq_proto(const struct sess *);\nvoid VRT"); - vsb_cat(sb, "_l_bereq_proto(const struct sess *, const char *, ...)"); - vsb_cat(sb, ";\nconst char * VRT_r_obj_proto(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_obj_proto(const struct sess *, const char *"); - vsb_cat(sb, ", ...);\nint VRT_r_obj_status(const struct sess *);\nv"); - vsb_cat(sb, "oid VRT_l_obj_status(const struct sess *, int);\nconst"); - vsb_cat(sb, " char * VRT_r_obj_response(const struct sess *);\nvoid"); - vsb_cat(sb, " VRT_l_obj_response(const struct sess *, const char *,"); - vsb_cat(sb, " ...);\nint VRT_r_obj_hits(const struct sess *);\nunsi"); - vsb_cat(sb, "gned VRT_r_obj_cacheable(const struct sess *);\nvoid V"); - vsb_cat(sb, "RT_l_obj_cacheable(const struct sess *, unsigned);\ndo"); - vsb_cat(sb, "uble VRT_r_obj_ttl(const struct sess *);\nvoid VRT_l_o"); - vsb_cat(sb, "bj_ttl(const struct sess *, double);\ndouble VRT_r_obj"); - vsb_cat(sb, "_grace(const struct sess *);\nvoid VRT_l_obj_grace(con"); - vsb_cat(sb, "st struct sess *, double);\ndouble VRT_r_obj_prefetch("); - vsb_cat(sb, "const struct sess *);\nvoid VRT_l_obj_prefetch(const s"); - vsb_cat(sb, "truct sess *, double);\ndouble VRT_r_obj_lastuse(const"); - vsb_cat(sb, " struct sess *);\nconst char * VRT_r_obj_hash(const st"); - vsb_cat(sb, "ruct sess *);\nconst char * VRT_r_resp_proto(const str"); - vsb_cat(sb, "uct sess *);\nvoid VRT_l_resp_proto(const struct sess "); - vsb_cat(sb, "*, const char *, ...);\nint VRT_r_resp_status(const st"); - vsb_cat(sb, "ruct sess *);\nvoid VRT_l_resp_status(const struct ses"); - vsb_cat(sb, "s *, int);\nconst char * VRT_r_resp_response(const str"); - vsb_cat(sb, "uct sess *);\nvoid VRT_l_resp_response(const struct se"); - vsb_cat(sb, "ss *, const char *, ...);\ndouble VRT_r_now(const stru"); - vsb_cat(sb, "ct sess *);\nunsigned VRT_r_req_backend_healthy(const "); - vsb_cat(sb, "struct sess *);\n"); + vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3324 2008-10-18 20:50:10Z "); + vsb_cat(sb, "phk $\n *\n * NB: This file is machine generated, DO "); + vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n */\n\n"); + vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(const struct sess *)"); + vsb_cat(sb, ";\nstruct sockaddr * VRT_r_server_ip(struct sess *);\n"); + vsb_cat(sb, "int VRT_r_server_port(struct sess *);\nconst char * VR"); + vsb_cat(sb, "T_r_req_request(const struct sess *);\nvoid VRT_l_req_"); + vsb_cat(sb, "request(const struct sess *, const char *, ...);\ncons"); + vsb_cat(sb, "t char * VRT_r_req_url(const struct sess *);\nvoid VRT"); + vsb_cat(sb, "_l_req_url(const struct sess *, const char *, ...);\nc"); + vsb_cat(sb, "onst char * VRT_r_req_proto(const struct sess *);\nvoi"); + vsb_cat(sb, "d VRT_l_req_proto(const struct sess *, const char *, ."); + vsb_cat(sb, "..);\nvoid VRT_l_req_hash(struct sess *, const char *)"); + vsb_cat(sb, ";\nstruct director * VRT_r_req_backend(struct sess *);"); + vsb_cat(sb, "\nvoid VRT_l_req_backend(struct sess *, struct directo"); + vsb_cat(sb, "r *);\nint VRT_r_req_restarts(const struct sess *);\nd"); + vsb_cat(sb, "ouble VRT_r_req_grace(struct sess *);\nvoid VRT_l_req_"); + vsb_cat(sb, "grace(struct sess *, double);\nconst char * VRT_r_req_"); + vsb_cat(sb, "xid(struct sess *);\nconst char * VRT_r_bereq_request("); + vsb_cat(sb, "const struct sess *);\nvoid VRT_l_bereq_request(const "); + vsb_cat(sb, "struct sess *, const char *, ...);\nconst char * VRT_r"); + vsb_cat(sb, "_bereq_url(const struct sess *);\nvoid VRT_l_bereq_url"); + vsb_cat(sb, "(const struct sess *, const char *, ...);\nconst char "); + vsb_cat(sb, "* VRT_r_bereq_proto(const struct sess *);\nvoid VRT_l_"); + vsb_cat(sb, "bereq_proto(const struct sess *, const char *, ...);\n"); + vsb_cat(sb, "const char * VRT_r_obj_proto(const struct sess *);\nvo"); + vsb_cat(sb, "id VRT_l_obj_proto(const struct sess *, const char *, "); + vsb_cat(sb, "...);\nint VRT_r_obj_status(const struct sess *);\nvoi"); + vsb_cat(sb, "d VRT_l_obj_status(const struct sess *, int);\nconst c"); + vsb_cat(sb, "har * VRT_r_obj_response(const struct sess *);\nvoid V"); + vsb_cat(sb, "RT_l_obj_response(const struct sess *, const char *, ."); + vsb_cat(sb, "..);\nint VRT_r_obj_hits(const struct sess *);\nunsign"); + vsb_cat(sb, "ed VRT_r_obj_cacheable(const struct sess *);\nvoid VRT"); + vsb_cat(sb, "_l_obj_cacheable(const struct sess *, unsigned);\ndoub"); + vsb_cat(sb, "le VRT_r_obj_ttl(const struct sess *);\nvoid VRT_l_obj"); + vsb_cat(sb, "_ttl(const struct sess *, double);\ndouble VRT_r_obj_g"); + vsb_cat(sb, "race(const struct sess *);\nvoid VRT_l_obj_grace(const"); + vsb_cat(sb, " struct sess *, double);\ndouble VRT_r_obj_prefetch(co"); + vsb_cat(sb, "nst struct sess *);\nvoid VRT_l_obj_prefetch(const str"); + vsb_cat(sb, "uct sess *, double);\ndouble VRT_r_obj_lastuse(const s"); + vsb_cat(sb, "truct sess *);\nconst char * VRT_r_obj_hash(const stru"); + vsb_cat(sb, "ct sess *);\nconst char * VRT_r_resp_proto(const struc"); + vsb_cat(sb, "t sess *);\nvoid VRT_l_resp_proto(const struct sess *,"); + vsb_cat(sb, " const char *, ...);\nint VRT_r_resp_status(const stru"); + vsb_cat(sb, "ct sess *);\nvoid VRT_l_resp_status(const struct sess "); + vsb_cat(sb, "*, int);\nconst char * VRT_r_resp_response(const struc"); + vsb_cat(sb, "t sess *);\nvoid VRT_l_resp_response(const struct sess"); + vsb_cat(sb, " *, const char *, ...);\ndouble VRT_r_now(const struct"); + vsb_cat(sb, " sess *);\nunsigned VRT_r_req_backend_healthy(const st"); + vsb_cat(sb, "ruct sess *);\n"); } From des at projects.linpro.no Mon Oct 20 20:02:48 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 22:02:48 +0200 (CEST) Subject: r3338 - in trunk/varnish-cache: . bin/varnishd Message-ID: <20081020200248.95C463BC028@projects.linpro.no> Author: des Date: 2008-10-20 22:02:48 +0200 (Mon, 20 Oct 2008) New Revision: 3338 Modified: trunk/varnish-cache/bin/varnishd/Makefile.am trunk/varnish-cache/bin/varnishd/cache_pool.c trunk/varnish-cache/bin/varnishd/storage_umem.c trunk/varnish-cache/configure.ac Log: Clean up some of the fallout from the Solaris patch - mostly configure script breakage. In particular, disable the sendfile() check, as Solaris doesn't have a working sendfile() any more than Linux does. Actually, the Solaris sendfile code was never compiled or used, because the #ifdefs in cache_pool.c were all wrong. Modified: trunk/varnish-cache/bin/varnishd/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishd/Makefile.am 2008-10-20 19:57:27 UTC (rev 3337) +++ trunk/varnish-cache/bin/varnishd/Makefile.am 2008-10-20 20:02:48 UTC (rev 3338) @@ -80,7 +80,7 @@ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvcl/libvcl.la \ @JEMALLOC_LDADD@ \ - ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} + ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} ${LIBUMEM} EXTRA_DIST = default.vcl DISTCLEANFILES = default_vcl.h @@ -93,4 +93,3 @@ # Explicitly record dependency mgt_vcc.c: default_vcl.h - Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-10-20 19:57:27 UTC (rev 3337) +++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2008-10-20 20:02:48 UTC (rev 3338) @@ -193,8 +193,7 @@ sendfile(*w->wfd, fd, &off, len) != len) w->werr++; } while (0); -#elif defined(__sun) -#ifdef HAVE_SENDFILEV +#elif defined(__sun) && defined(HAVE_SENDFILEV) do { sendfilevec_t svvec[HTTP_HDR_MAX * 2 + 1]; size_t xferred = 0, expected = 0; @@ -217,13 +216,12 @@ w->liov = 0; w->niov = 0; } while (0); -#else +#elif defined(__sun) && defined(HAVE_SENDFILE) do { if (WRK_Flush(w) == 0 && sendfile(*w->wfd, fd, &off, len) != len) w->werr++; } while (0); -#endif #else #error Unknown sendfile() implementation #endif Modified: trunk/varnish-cache/bin/varnishd/storage_umem.c =================================================================== --- trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-20 19:57:27 UTC (rev 3337) +++ trunk/varnish-cache/bin/varnishd/storage_umem.c 2008-10-20 20:02:48 UTC (rev 3338) @@ -33,7 +33,7 @@ #include "config.h" -#ifdef HAVE_UMEM_H +#ifdef HAVE_LIBUMEM #include Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2008-10-20 19:57:27 UTC (rev 3337) +++ trunk/varnish-cache/configure.ac 2008-10-20 20:02:48 UTC (rev 3338) @@ -70,8 +70,9 @@ AC_HEADER_STDC AC_HEADER_SYS_WAIT AC_HEADER_TIME +AC_CHECK_HEADERS([sys/filio.h]) +AC_CHECK_HEADERS([sys/mount.h]) AC_CHECK_HEADERS([sys/socket.h]) -AC_CHECK_HEADERS([sys/mount.h]) AC_CHECK_HEADERS([sys/statvfs.h]) AC_CHECK_HEADERS([sys/vfs.h]) AC_CHECK_HEADERS([netinet/in.h]) @@ -109,7 +110,8 @@ AC_CHECK_FUNCS([pthread_mutex_isowned_np]) LIBS="${save_LIBS}" -## This one is tricky, there are multiple versions +# sendfile is tricky: there are multiple versions, and most of them +# don't work. case $target in *-*-freebsd*) AC_CACHE_CHECK([whether sendfile works], @@ -125,28 +127,37 @@ [ac_cv_so_sendfile_works=yes], [ac_cv_so_sendfile_works=no]) ]) - if test "$ac_cv_so_sendfile_works" = yes; then - AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works]) - fi - ;; + ;; +#*-*-solaris*) +# save_LIBS="${LIBS}" +# LIBS="${NET_LIBS}" +# AC_CHECK_LIB(sendfile, sendfile) +# AC_CHECK_FUNCS([sendfile]) +# AC_CHECK_FUNCS([sendfilev]) +# NET_LIBS="${LIBS}" +# LIBS="${save_LIBS}" +*) + AC_MSG_WARN([won't look for sendfile() on $target]) + ;; +esac +if test "$ac_cv_so_sendfile_works" = yes; then + AC_DEFINE([SENDFILE_WORKS], [1], [Define if SENDFILE works]) +fi + +# Userland slab allocator, available only on Solaris +case $target in *-*-solaris*) - AC_CHECK_HEADERS([sys/filio.h]) - AC_CHECK_LIB(sendfile, sendfile) - AC_CHECK_LIB(umem, malloc) AC_CHECK_HEADERS([umem.h]) - - if test "$ac_cv_lib_sendfile_sendfile" = yes; then + if test "$ac_cv_have_umem_h" = yes; then save_LIBS="${LIBS}" - LIBS="${NET_LIBS}" - AC_CHECK_FUNCS([sendfile]) - AC_CHECK_FUNCS([sendfilev]) + LIBS="" + AC_CHECK_LIB(umem, umem_alloc) + LIBUMEM="${LIBS}" LIBS="${save_LIBS}" fi ;; -*) - AC_MSG_WARN([won't look for sendfile() on $target]) - ;; esac +AC_SUBST(LIBUMEM) # These functions are provided by libcompat on platforms where they # are not available From phk at projects.linpro.no Mon Oct 20 20:05:26 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 22:05:26 +0200 (CEST) Subject: r3339 - trunk/varnish-cache/lib/libvcl Message-ID: <20081020200526.1E3F01EC7CA@projects.linpro.no> Author: phk Date: 2008-10-20 22:05:25 +0200 (Mon, 20 Oct 2008) New Revision: 3339 Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl Log: Break the encoded .h files up at convenient newlines, to avoid minor edits to bases from generating huge diffs. Modified: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-10-20 20:02:48 UTC (rev 3338) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2008-10-20 20:05:25 UTC (rev 3339) @@ -127,15 +127,15 @@ typedef int vcl_func_f(struct sess *sp); } puts $fo "struct VCL_conf {" -puts $fo { unsigned magic; -#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ +puts $fo { unsigned magic; +#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ - struct director **director; - unsigned ndirector; - struct vrt_ref *ref; - unsigned nref; - unsigned busy; - unsigned discard; + struct director **director; + unsigned ndirector; + struct vrt_ref *ref; + unsigned nref; + unsigned busy; + unsigned discard; unsigned nsrc; const char **srcname; @@ -143,8 +143,8 @@ unsigned nhashcount; - vcl_init_f *init_func; - vcl_fini_f *fini_func; + vcl_init_f *init_func; + vcl_fini_f *fini_func; } foreach m $methods { puts $fo "\tvcl_func_f\t*[lindex $m 0]_func;" @@ -376,7 +376,7 @@ } puts -nonewline $fo "\\n" incr n 2 - if {$n > 53} { + if {$n > 30} { puts $fo "\");" set n 0 } From phk at projects.linpro.no Mon Oct 20 20:06:17 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 20 Oct 2008 22:06:17 +0200 (CEST) Subject: r3340 - in trunk/varnish-cache: include lib/libvcl Message-ID: <20081020200617.3D6E23BC028@projects.linpro.no> Author: phk Date: 2008-10-20 22:06:17 +0200 (Mon, 20 Oct 2008) New Revision: 3340 Modified: trunk/varnish-cache/include/vcl.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Regenerate, and take the huge-diff hit for the last time. Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2008-10-20 20:05:25 UTC (rev 3339) +++ trunk/varnish-cache/include/vcl.h 2008-10-20 20:06:17 UTC (rev 3340) @@ -14,15 +14,15 @@ typedef int vcl_func_f(struct sess *sp); struct VCL_conf { - unsigned magic; -#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ + unsigned magic; +#define VCL_CONF_MAGIC 0x7406c509 /* from /dev/random */ - struct director **director; - unsigned ndirector; - struct vrt_ref *ref; - unsigned nref; - unsigned busy; - unsigned discard; + struct director **director; + unsigned ndirector; + struct vrt_ref *ref; + unsigned nref; + unsigned busy; + unsigned discard; unsigned nsrc; const char **srcname; @@ -30,8 +30,8 @@ unsigned nhashcount; - vcl_init_f *init_func; - vcl_fini_f *fini_func; + vcl_init_f *init_func; + vcl_fini_f *fini_func; vcl_func_f *recv_func; vcl_func_f *pipe_func; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 20:05:25 UTC (rev 3339) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-20 20:06:17 UTC (rev 3340) @@ -167,182 +167,199 @@ /* ../../include/vcl.h */ - vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3324 2008-10-18 20"); - vsb_cat(sb, ":50:10Z phk $\n *\n * NB: This file is machine genera"); + vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 3339 2008-10-20 20"); + vsb_cat(sb, ":05:25Z phk $\n *\n * NB: This file is machine genera"); vsb_cat(sb, "ted, DO NOT EDIT!\n *\n * Edit vcc_gen_fixed_token.tcl"); - vsb_cat(sb, " instead\n */\n\nstruct sess;\nstruct cli;\n\ntypedef "); - vsb_cat(sb, "void vcl_init_f(struct cli *);\ntypedef void vcl_fini_"); - vsb_cat(sb, "f(struct cli *);\ntypedef int vcl_func_f(struct sess *"); - vsb_cat(sb, "sp);\n\nstruct VCL_conf {\n\tunsigned magic;\n#"); - vsb_cat(sb, "define VCL_CONF_MAGIC 0x7406c509 /* from /dev/ra"); - vsb_cat(sb, "ndom */\n\n struct director **director;\n "); - vsb_cat(sb, " unsigned ndirector;\n struct vrt_ref "); - vsb_cat(sb, " *ref;\n unsigned nref;\n unsigne"); - vsb_cat(sb, "d busy;\n unsigned discard;\n\n\t"); - vsb_cat(sb, "unsigned\tnsrc;\n\tconst char\t**srcname;\n\tconst cha"); - vsb_cat(sb, "r\t**srcbody;\n\n\tunsigned\tnhashcount;\n\n vc"); - vsb_cat(sb, "l_init_f *init_func;\n vcl_fini_f *fi"); - vsb_cat(sb, "ni_func;\n\n\tvcl_func_f\t*recv_func;\n\tvcl_func_f\t*"); - vsb_cat(sb, "pipe_func;\n\tvcl_func_f\t*pass_func;\n\tvcl_func_f\t*"); - vsb_cat(sb, "hash_func;\n\tvcl_func_f\t*miss_func;\n\tvcl_func_f\t*"); - vsb_cat(sb, "hit_func;\n\tvcl_func_f\t*fetch_func;\n\tvcl_func_f\t*"); - vsb_cat(sb, "deliver_func;\n\tvcl_func_f\t*prefetch_func;\n\tvcl_fu"); - vsb_cat(sb, "nc_f\t*timeout_func;\n\tvcl_func_f\t*discard_func;\n\t"); - vsb_cat(sb, "vcl_func_f\t*error_func;\n};\n"); + vsb_cat(sb, " instead\n */\n\nstruct sess;\n"); + vsb_cat(sb, "struct cli;\n\ntypedef void vcl_init_f(struct cli *);\n"); + vsb_cat(sb, "typedef void vcl_fini_f(struct cli *);\n"); + vsb_cat(sb, "typedef int vcl_func_f(struct sess *sp);\n"); + vsb_cat(sb, "\nstruct VCL_conf {\n\tunsigned\tmagic;\n"); + vsb_cat(sb, "#define VCL_CONF_MAGIC\t0x7406c509\t/* from /dev/rando"); + vsb_cat(sb, "m */\n\n\tstruct director\t**director;\n"); + vsb_cat(sb, "\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n"); + vsb_cat(sb, "\tunsigned\tnref;\n\tunsigned\tbusy;\n"); + vsb_cat(sb, "\tunsigned\tdiscard;\n\n\tunsigned\tnsrc;\n"); + vsb_cat(sb, "\tconst char\t**srcname;\n\tconst char\t**srcbody;\n"); + vsb_cat(sb, "\n\tunsigned\tnhashcount;\n\n\tvcl_init_f\t*init_func;"); + vsb_cat(sb, "\n\tvcl_fini_f\t*fini_func;\n\n"); + vsb_cat(sb, "\tvcl_func_f\t*recv_func;\n\tvcl_func_f\t*pipe_func;\n"); + vsb_cat(sb, "\tvcl_func_f\t*pass_func;\n\tvcl_func_f\t*hash_func;\n"); + vsb_cat(sb, "\tvcl_func_f\t*miss_func;\n\tvcl_func_f\t*hit_func;\n"); + vsb_cat(sb, "\tvcl_func_f\t*fetch_func;\n\tvcl_func_f\t*deliver_fun"); + vsb_cat(sb, "c;\n\tvcl_func_f\t*prefetch_func;\n"); + vsb_cat(sb, "\tvcl_func_f\t*timeout_func;\n\tvcl_func_f\t*discard_f"); + vsb_cat(sb, "unc;\n\tvcl_func_f\t*error_func;\n"); + vsb_cat(sb, "};\n"); /* ../../include/vrt.h */ - vsb_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n * Copyrig"); - vsb_cat(sb, "ht (c) 2006-2008 Linpro AS\n * All rights reserved.\n "); - vsb_cat(sb, "*\n * Author: Poul-Henning Kamp \n"); - vsb_cat(sb, " *\n * Redistribution and use in source and binary for"); - vsb_cat(sb, "ms, with or without\n * modification, are permitted pr"); - vsb_cat(sb, "ovided that the following conditions\n * are met:\n * "); - vsb_cat(sb, "1. Redistributions of source code must retain the abov"); - vsb_cat(sb, "e copyright\n * notice, this list of conditions and"); - vsb_cat(sb, " the following disclaimer.\n * 2. Redistributions in b"); - vsb_cat(sb, "inary form must reproduce the above copyright\n * n"); - vsb_cat(sb, "otice, this list of conditions and the following discl"); - vsb_cat(sb, "aimer in the\n * documentation and/or other materia"); - vsb_cat(sb, "ls provided with the distribution.\n *\n * THIS SOFTWA"); - vsb_cat(sb, "RE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'"); - vsb_cat(sb, "' AND\n * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING"); - vsb_cat(sb, ", BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF ME"); - vsb_cat(sb, "RCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n *"); - vsb_cat(sb, " ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBU"); - vsb_cat(sb, "TORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTA"); - vsb_cat(sb, "L, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n * DAMAGES (I"); - vsb_cat(sb, "NCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUT"); - vsb_cat(sb, "E GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS"); - vsb_cat(sb, "; OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON "); - vsb_cat(sb, "ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"); + vsb_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n"); + vsb_cat(sb, " * Copyright (c) 2006-2008 Linpro AS\n"); + vsb_cat(sb, " * All rights reserved.\n *\n * Author: Poul-Henning K"); + vsb_cat(sb, "amp \n *\n * Redistribution and us"); + vsb_cat(sb, "e in source and binary forms, with or without\n"); + vsb_cat(sb, " * modification, are permitted provided that the follo"); + vsb_cat(sb, "wing conditions\n * are met:\n * 1. Redistributions of"); + vsb_cat(sb, " source code must retain the above copyright\n"); + vsb_cat(sb, " * notice, this list of conditions and the followin"); + vsb_cat(sb, "g disclaimer.\n * 2. Redistributions in binary form mu"); + vsb_cat(sb, "st reproduce the above copyright\n"); + vsb_cat(sb, " * notice, this list of conditions and the followin"); + vsb_cat(sb, "g disclaimer in the\n * documentation and/or other "); + vsb_cat(sb, "materials provided with the distribution.\n"); + vsb_cat(sb, " *\n * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CON"); + vsb_cat(sb, "TRIBUTORS ``AS IS'' AND\n * ANY EXPRESS OR IMPLIED WAR"); + vsb_cat(sb, "RANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n"); + vsb_cat(sb, " * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS F"); + vsb_cat(sb, "OR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVE"); + vsb_cat(sb, "NT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n"); + vsb_cat(sb, " * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEM"); + vsb_cat(sb, "PLARY, OR CONSEQUENTIAL\n * DAMAGES (INCLUDING, BUT NO"); + vsb_cat(sb, "T LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n"); + vsb_cat(sb, " * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSI"); + vsb_cat(sb, "NESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEOR"); + vsb_cat(sb, "Y OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"); vsb_cat(sb, " * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWI"); vsb_cat(sb, "SE) ARISING IN ANY WAY\n * OUT OF THE USE OF THIS SOFT"); - vsb_cat(sb, "WARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n * SUCH D"); - vsb_cat(sb, "AMAGE.\n *\n * $Id: vrt.h 3324 2008-10-18 20:50:10Z ph"); - vsb_cat(sb, "k $\n *\n * Runtime support for compiled VCL programs."); - vsb_cat(sb, "\n *\n * XXX: When this file is changed, lib/libvcl/vc"); - vsb_cat(sb, "c_gen_fixed_token.tcl\n * XXX: *MUST* be rerun.\n */\n"); - vsb_cat(sb, "\nstruct sess;\nstruct vsb;\nstruct cli;\nstruct direc"); - vsb_cat(sb, "tor;\nstruct VCL_conf;\nstruct sockaddr;\n\n/*\n * A b"); - vsb_cat(sb, "ackend probe specification\n */\n\nextern void *vrt_ma"); - vsb_cat(sb, "gic_string_end;\n\nstruct vrt_backend_probe {\n\tconst"); - vsb_cat(sb, " char\t*url;\n\tconst char\t*request;\n\tdouble\t\ttim"); - vsb_cat(sb, "eout;\n\tdouble\t\tinterval;\n\tunsigned\twindow;\n\tu"); - vsb_cat(sb, "nsigned\tthreshold;\n};\n\n/*\n * A backend is a host+"); - vsb_cat(sb, "port somewhere on the network\n */\nstruct vrt_backend"); - vsb_cat(sb, " {\n\tconst char\t\t\t*vcl_name;\n\tconst char\t\t\t*i"); - vsb_cat(sb, "dent;\n\n\tconst char\t\t\t*hosthdr;\n\n\tconst unsign"); - vsb_cat(sb, "ed char\t\t*ipv4_sockaddr;\n\tconst unsigned char\t\t*"); - vsb_cat(sb, "ipv6_sockaddr;\n\n\tdouble\t\t\t\tconnect_timeout;\n\t"); - vsb_cat(sb, "unsigned\t\t\tmax_connections;\n\tstruct vrt_backend_p"); - vsb_cat(sb, "robe\tprobe;\n};\n\n/*\n * A director with a predictab"); - vsb_cat(sb, "le reply\n */\n\nstruct vrt_dir_simple {\n\tconst char"); - vsb_cat(sb, "\t\t\t\t*name;\n\tconst struct vrt_backend\t\t*host;\n"); - vsb_cat(sb, "};\n\n/*\n * A director with an unpredictable reply\n "); - vsb_cat(sb, "*/\n\nstruct vrt_dir_random_entry {\n\tconst struct vr"); - vsb_cat(sb, "t_backend\t\t*host;\n\tdouble\t\t\t\t\tweight;\n};\n\n"); - vsb_cat(sb, "struct vrt_dir_random {\n\tconst char\t\t\t\t*name;\n\t"); - vsb_cat(sb, "unsigned\t\t\t\tretries;\n\tunsigned\t\t\t\tnmember;\n"); - vsb_cat(sb, "\tconst struct vrt_dir_random_entry\t*members;\n};\n\n"); - vsb_cat(sb, "/*\n * A director with round robin selection\n */\n\ns"); - vsb_cat(sb, "truct vrt_dir_round_robin_entry {\n\tconst struct vrt_"); - vsb_cat(sb, "backend\t\t*host;\n};\n\nstruct vrt_dir_round_robin {\n"); + vsb_cat(sb, "WARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n"); + vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 3324 2008-10-18 20:"); + vsb_cat(sb, "50:10Z phk $\n *\n * Runtime support for compiled VCL "); + vsb_cat(sb, "programs.\n *\n * XXX: When this file is changed, lib/"); + vsb_cat(sb, "libvcl/vcc_gen_fixed_token.tcl\n"); + vsb_cat(sb, " * XXX: *MUST* be rerun.\n */\n"); + vsb_cat(sb, "\nstruct sess;\nstruct vsb;\nstruct cli;\n"); + vsb_cat(sb, "struct director;\nstruct VCL_conf;\n"); + vsb_cat(sb, "struct sockaddr;\n\n/*\n * A backend probe specificati"); + vsb_cat(sb, "on\n */\n\nextern void *vrt_magic_string_end;\n"); + vsb_cat(sb, "\nstruct vrt_backend_probe {\n\tconst char\t*url;\n"); + vsb_cat(sb, "\tconst char\t*request;\n\tdouble\t\ttimeout;\n"); + vsb_cat(sb, "\tdouble\t\tinterval;\n\tunsigned\twindow;\n"); + vsb_cat(sb, "\tunsigned\tthreshold;\n};\n\n/*\n"); + vsb_cat(sb, " * A backend is a host+port somewhere on the network\n"); + vsb_cat(sb, " */\nstruct vrt_backend {\n\tconst char\t\t\t*vcl_name"); + vsb_cat(sb, ";\n\tconst char\t\t\t*ident;\n\n"); + vsb_cat(sb, "\tconst char\t\t\t*hosthdr;\n\n"); + vsb_cat(sb, "\tconst unsigned char\t\t*ipv4_sockaddr;\n"); + vsb_cat(sb, "\tconst unsigned char\t\t*ipv6_sockaddr;\n"); + vsb_cat(sb, "\n\tdouble\t\t\t\tconnect_timeout;\n"); + vsb_cat(sb, "\tunsigned\t\t\tmax_connections;\n"); + vsb_cat(sb, "\tstruct vrt_backend_probe\tprobe;\n"); + vsb_cat(sb, "};\n\n/*\n * A director with a predictable reply\n"); + vsb_cat(sb, " */\n\nstruct vrt_dir_simple {\n"); + vsb_cat(sb, "\tconst char\t\t\t\t*name;\n\tconst struct vrt_backend"); + vsb_cat(sb, "\t\t*host;\n};\n\n/*\n * A director with an unpredicta"); + vsb_cat(sb, "ble reply\n */\n\nstruct vrt_dir_random_entry {\n"); + vsb_cat(sb, "\tconst struct vrt_backend\t\t*host;\n"); + vsb_cat(sb, "\tdouble\t\t\t\t\tweight;\n};\n"); + vsb_cat(sb, "\nstruct vrt_dir_random {\n\tconst char\t\t\t\t*name;\n"); + vsb_cat(sb, "\tunsigned\t\t\t\tretries;\n\tunsigned\t\t\t\tnmember;"); + vsb_cat(sb, "\n\tconst struct vrt_dir_random_entry\t*members;\n"); + vsb_cat(sb, "};\n\n/*\n * A director with round robin selection\n"); + vsb_cat(sb, " */\n\nstruct vrt_dir_round_robin_entry {\n"); + vsb_cat(sb, "\tconst struct vrt_backend\t\t*host;\n"); + vsb_cat(sb, "};\n\nstruct vrt_dir_round_robin {\n"); vsb_cat(sb, "\tconst char\t\t\t\t*name;\n\tunsigned\t\t\t\tnmember;"); vsb_cat(sb, "\n\tconst struct vrt_dir_round_robin_entry\t*members;\n"); vsb_cat(sb, "};\n\n\n/*\n * other stuff.\n * XXX: document when bor"); - vsb_cat(sb, "ed\n */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n\tun"); - vsb_cat(sb, "signed\toffset;\n\tunsigned\tline;\n\tunsigned\tpos;\n"); - vsb_cat(sb, "\tunsigned\tcount;\n\tconst char\t*token;\n};\n\n/* AC"); - vsb_cat(sb, "L related */\n#define VRT_ACL_MAXADDR\t\t16\t/* max(IP"); - vsb_cat(sb, "v4, IPv6) */\n\nvoid VRT_acl_log(const struct sess *, "); - vsb_cat(sb, "const char *msg);\n\n/* Regexp related */\nvoid VRT_re"); - vsb_cat(sb, "_init(void **, const char *, int sub);\nvoid VRT_re_fi"); - vsb_cat(sb, "ni(void *);\nint VRT_re_match(const char *, void *re);"); - vsb_cat(sb, "\nint VRT_re_test(struct vsb *, const char *, int sub)"); - vsb_cat(sb, ";\nconst char *VRT_regsub(const struct sess *sp, int a"); - vsb_cat(sb, "ll, const char *,\n void *, const char *);\n\nvoid "); - vsb_cat(sb, "VRT_panic(struct sess *sp, const char *, ...);\nvoid "); - vsb_cat(sb, "VRT_purge(const char *, int hash);\n\nvoid VRT_count(c"); - vsb_cat(sb, "onst struct sess *, unsigned);\nint VRT_rewrite(const "); - vsb_cat(sb, "char *, const char *);\nvoid VRT_error(struct sess *, "); - vsb_cat(sb, "unsigned, const char *);\nint VRT_switch_config(const "); - vsb_cat(sb, "char *);\n\nenum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ"); - vsb_cat(sb, ", HDR_BEREQ };\nchar *VRT_GetHdr(const struct sess *, "); - vsb_cat(sb, "enum gethdr_e where, const char *);\nvoid VRT_SetHdr(c"); - vsb_cat(sb, "onst struct sess *, enum gethdr_e where, const char *,"); - vsb_cat(sb, "\n const char *, ...);\nvoid VRT_handling(struct se"); - vsb_cat(sb, "ss *sp, unsigned hand);\n\n/* Simple stuff */\nint VRT"); - vsb_cat(sb, "_strcmp(const char *s1, const char *s2);\nvoid VRT_mem"); - vsb_cat(sb, "move(void *dst, const void *src, unsigned len);\n\nvoi"); - vsb_cat(sb, "d VRT_ESI(struct sess *sp);\nvoid VRT_Rollback(struct "); - vsb_cat(sb, "sess *sp);\n\n/* Synthetic pages */\nvoid VRT_synth_pa"); - vsb_cat(sb, "ge(struct sess *sp, unsigned flags, const char *, ...)"); - vsb_cat(sb, ";\n\n/* Backend related */\nvoid VRT_init_dir_simple(s"); - vsb_cat(sb, "truct cli *, struct director **,\n const struct vrt"); - vsb_cat(sb, "_dir_simple *);\nvoid VRT_init_dir_random(struct cli *"); - vsb_cat(sb, ", struct director **,\n const struct vrt_dir_random"); - vsb_cat(sb, " *);\nvoid VRT_init_dir_round_robin(struct cli *, stru"); - vsb_cat(sb, "ct director **,\n const struct vrt_dir_round_robin "); - vsb_cat(sb, "*);\nvoid VRT_fini_dir(struct cli *, struct director *"); - vsb_cat(sb, ");\n\nchar *VRT_IP_string(const struct sess *sp, const"); - vsb_cat(sb, " struct sockaddr *sa);\nchar *VRT_int_string(const str"); - vsb_cat(sb, "uct sess *sp, int);\nchar *VRT_double_string(const str"); - vsb_cat(sb, "uct sess *sp, double);\nconst char *VRT_backend_string"); - vsb_cat(sb, "(struct sess *sp);\n\n#define VRT_done(sp, hand)\t\t\t"); - vsb_cat(sb, "\\\n\tdo {\t\t\t\t\t\\\n\t\tVRT_handling(sp, hand);\t\t"); - vsb_cat(sb, "\\\n\t\treturn (1);\t\t\t\\\n\t} while (0)\n"); + vsb_cat(sb, "ed\n */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n"); + vsb_cat(sb, "\tunsigned\toffset;\n\tunsigned\tline;\n"); + vsb_cat(sb, "\tunsigned\tpos;\n\tunsigned\tcount;\n"); + vsb_cat(sb, "\tconst char\t*token;\n};\n\n/* ACL related */\n"); + vsb_cat(sb, "#define VRT_ACL_MAXADDR\t\t16\t/* max(IPv4, IPv6) */\n"); + vsb_cat(sb, "\nvoid VRT_acl_log(const struct sess *, const char *ms"); + vsb_cat(sb, "g);\n\n/* Regexp related */\nvoid VRT_re_init(void **,"); + vsb_cat(sb, " const char *, int sub);\nvoid VRT_re_fini(void *);\n"); + vsb_cat(sb, "int VRT_re_match(const char *, void *re);\n"); + vsb_cat(sb, "int VRT_re_test(struct vsb *, const char *, int sub);\n"); + vsb_cat(sb, "const char *VRT_regsub(const struct sess *sp, int all,"); + vsb_cat(sb, " const char *,\n void *, const char *);\n"); + vsb_cat(sb, "\nvoid VRT_panic(struct sess *sp, const char *, ...);"); + vsb_cat(sb, "\nvoid VRT_purge(const char *, int hash);\n"); + vsb_cat(sb, "\nvoid VRT_count(const struct sess *, unsigned);\n"); + vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n"); + vsb_cat(sb, "void VRT_error(struct sess *, unsigned, const char *);"); + vsb_cat(sb, "\nint VRT_switch_config(const char *);\n"); + vsb_cat(sb, "\nenum gethdr_e { HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BERE"); + vsb_cat(sb, "Q };\nchar *VRT_GetHdr(const struct sess *, enum gethd"); + vsb_cat(sb, "r_e where, const char *);\nvoid VRT_SetHdr(const struc"); + vsb_cat(sb, "t sess *, enum gethdr_e where, const char *,\n"); + vsb_cat(sb, " const char *, ...);\nvoid VRT_handling(struct sess"); + vsb_cat(sb, " *sp, unsigned hand);\n\n/* Simple stuff */\n"); + vsb_cat(sb, "int VRT_strcmp(const char *s1, const char *s2);\n"); + vsb_cat(sb, "void VRT_memmove(void *dst, const void *src, unsigned "); + vsb_cat(sb, "len);\n\nvoid VRT_ESI(struct sess *sp);\n"); + vsb_cat(sb, "void VRT_Rollback(struct sess *sp);\n"); + vsb_cat(sb, "\n/* Synthetic pages */\nvoid VRT_synth_page(struct se"); + vsb_cat(sb, "ss *sp, unsigned flags, const char *, ...);\n"); + vsb_cat(sb, "\n/* Backend related */\nvoid VRT_init_dir_simple(stru"); + vsb_cat(sb, "ct cli *, struct director **,\n"); + vsb_cat(sb, " const struct vrt_dir_simple *);\n"); + vsb_cat(sb, "void VRT_init_dir_random(struct cli *, struct director"); + vsb_cat(sb, " **,\n const struct vrt_dir_random *);\n"); + vsb_cat(sb, "void VRT_init_dir_round_robin(struct cli *, struct dir"); + vsb_cat(sb, "ector **,\n const struct vrt_dir_round_robin *);\n"); + vsb_cat(sb, "void VRT_fini_dir(struct cli *, struct director *);\n"); + vsb_cat(sb, "\nchar *VRT_IP_string(const struct sess *sp, const str"); + vsb_cat(sb, "uct sockaddr *sa);\nchar *VRT_int_string(const struct "); + vsb_cat(sb, "sess *sp, int);\nchar *VRT_double_string(const struct "); + vsb_cat(sb, "sess *sp, double);\nconst char *VRT_backend_string(str"); + vsb_cat(sb, "uct sess *sp);\n\n#define VRT_done(sp, hand)\t\t\t\\\n"); + vsb_cat(sb, "\tdo {\t\t\t\t\t\\\n\t\tVRT_handling(sp, hand);\t\t\\\n"); + vsb_cat(sb, "\t\treturn (1);\t\t\t\\\n\t} while (0)\n"); /* ../../include/vrt_obj.h */ vsb_cat(sb, "/*\n * $Id: vcc_gen_obj.tcl 3324 2008-10-18 20:50:10Z "); vsb_cat(sb, "phk $\n *\n * NB: This file is machine generated, DO "); - vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n */\n\n"); - vsb_cat(sb, "struct sockaddr * VRT_r_client_ip(const struct sess *)"); - vsb_cat(sb, ";\nstruct sockaddr * VRT_r_server_ip(struct sess *);\n"); - vsb_cat(sb, "int VRT_r_server_port(struct sess *);\nconst char * VR"); - vsb_cat(sb, "T_r_req_request(const struct sess *);\nvoid VRT_l_req_"); - vsb_cat(sb, "request(const struct sess *, const char *, ...);\ncons"); - vsb_cat(sb, "t char * VRT_r_req_url(const struct sess *);\nvoid VRT"); - vsb_cat(sb, "_l_req_url(const struct sess *, const char *, ...);\nc"); - vsb_cat(sb, "onst char * VRT_r_req_proto(const struct sess *);\nvoi"); - vsb_cat(sb, "d VRT_l_req_proto(const struct sess *, const char *, ."); - vsb_cat(sb, "..);\nvoid VRT_l_req_hash(struct sess *, const char *)"); - vsb_cat(sb, ";\nstruct director * VRT_r_req_backend(struct sess *);"); - vsb_cat(sb, "\nvoid VRT_l_req_backend(struct sess *, struct directo"); - vsb_cat(sb, "r *);\nint VRT_r_req_restarts(const struct sess *);\nd"); - vsb_cat(sb, "ouble VRT_r_req_grace(struct sess *);\nvoid VRT_l_req_"); - vsb_cat(sb, "grace(struct sess *, double);\nconst char * VRT_r_req_"); - vsb_cat(sb, "xid(struct sess *);\nconst char * VRT_r_bereq_request("); - vsb_cat(sb, "const struct sess *);\nvoid VRT_l_bereq_request(const "); - vsb_cat(sb, "struct sess *, const char *, ...);\nconst char * VRT_r"); - vsb_cat(sb, "_bereq_url(const struct sess *);\nvoid VRT_l_bereq_url"); - vsb_cat(sb, "(const struct sess *, const char *, ...);\nconst char "); - vsb_cat(sb, "* VRT_r_bereq_proto(const struct sess *);\nvoid VRT_l_"); - vsb_cat(sb, "bereq_proto(const struct sess *, const char *, ...);\n"); - vsb_cat(sb, "const char * VRT_r_obj_proto(const struct sess *);\nvo"); - vsb_cat(sb, "id VRT_l_obj_proto(const struct sess *, const char *, "); - vsb_cat(sb, "...);\nint VRT_r_obj_status(const struct sess *);\nvoi"); - vsb_cat(sb, "d VRT_l_obj_status(const struct sess *, int);\nconst c"); - vsb_cat(sb, "har * VRT_r_obj_response(const struct sess *);\nvoid V"); - vsb_cat(sb, "RT_l_obj_response(const struct sess *, const char *, ."); - vsb_cat(sb, "..);\nint VRT_r_obj_hits(const struct sess *);\nunsign"); - vsb_cat(sb, "ed VRT_r_obj_cacheable(const struct sess *);\nvoid VRT"); - vsb_cat(sb, "_l_obj_cacheable(const struct sess *, unsigned);\ndoub"); - vsb_cat(sb, "le VRT_r_obj_ttl(const struct sess *);\nvoid VRT_l_obj"); - vsb_cat(sb, "_ttl(const struct sess *, double);\ndouble VRT_r_obj_g"); - vsb_cat(sb, "race(const struct sess *);\nvoid VRT_l_obj_grace(const"); - vsb_cat(sb, " struct sess *, double);\ndouble VRT_r_obj_prefetch(co"); - vsb_cat(sb, "nst struct sess *);\nvoid VRT_l_obj_prefetch(const str"); - vsb_cat(sb, "uct sess *, double);\ndouble VRT_r_obj_lastuse(const s"); - vsb_cat(sb, "truct sess *);\nconst char * VRT_r_obj_hash(const stru"); - vsb_cat(sb, "ct sess *);\nconst char * VRT_r_resp_proto(const struc"); - vsb_cat(sb, "t sess *);\nvoid VRT_l_resp_proto(const struct sess *,"); - vsb_cat(sb, " const char *, ...);\nint VRT_r_resp_status(const stru"); - vsb_cat(sb, "ct sess *);\nvoid VRT_l_resp_status(const struct sess "); - vsb_cat(sb, "*, int);\nconst char * VRT_r_resp_response(const struc"); - vsb_cat(sb, "t sess *);\nvoid VRT_l_resp_response(const struct sess"); - vsb_cat(sb, " *, const char *, ...);\ndouble VRT_r_now(const struct"); - vsb_cat(sb, " sess *);\nunsigned VRT_r_req_backend_healthy(const st"); - vsb_cat(sb, "ruct sess *);\n"); + vsb_cat(sb, "NOT EDIT!\n *\n * Edit vcc_gen_obj.tcl instead\n"); + vsb_cat(sb, " */\n\nstruct sockaddr * VRT_r_client_ip(const struct "); + vsb_cat(sb, "sess *);\nstruct sockaddr * VRT_r_server_ip(struct ses"); + vsb_cat(sb, "s *);\nint VRT_r_server_port(struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_req_request(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_request(const struct sess *, const char"); + vsb_cat(sb, " *, ...);\nconst char * VRT_r_req_url(const struct ses"); + vsb_cat(sb, "s *);\nvoid VRT_l_req_url(const struct sess *, const c"); + vsb_cat(sb, "har *, ...);\nconst char * VRT_r_req_proto(const struc"); + vsb_cat(sb, "t sess *);\nvoid VRT_l_req_proto(const struct sess *, "); + vsb_cat(sb, "const char *, ...);\nvoid VRT_l_req_hash(struct sess *"); + vsb_cat(sb, ", const char *);\nstruct director * VRT_r_req_backend("); + vsb_cat(sb, "struct sess *);\nvoid VRT_l_req_backend(struct sess *,"); + vsb_cat(sb, " struct director *);\nint VRT_r_req_restarts(const str"); + vsb_cat(sb, "uct sess *);\ndouble VRT_r_req_grace(struct sess *);\n"); + vsb_cat(sb, "void VRT_l_req_grace(struct sess *, double);\n"); + vsb_cat(sb, "const char * VRT_r_req_xid(struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_bereq_request(const struct sess *);"); + vsb_cat(sb, "\nvoid VRT_l_bereq_request(const struct sess *, const "); + vsb_cat(sb, "char *, ...);\nconst char * VRT_r_bereq_url(const stru"); + vsb_cat(sb, "ct sess *);\nvoid VRT_l_bereq_url(const struct sess *,"); + vsb_cat(sb, " const char *, ...);\nconst char * VRT_r_bereq_proto(c"); + vsb_cat(sb, "onst struct sess *);\nvoid VRT_l_bereq_proto(const str"); + vsb_cat(sb, "uct sess *, const char *, ...);\n"); + vsb_cat(sb, "const char * VRT_r_obj_proto(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_proto(const struct sess *, const char *"); + vsb_cat(sb, ", ...);\nint VRT_r_obj_status(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_status(const struct sess *, int);\n"); + vsb_cat(sb, "const char * VRT_r_obj_response(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_response(const struct sess *, const cha"); + vsb_cat(sb, "r *, ...);\nint VRT_r_obj_hits(const struct sess *);\n"); + vsb_cat(sb, "unsigned VRT_r_obj_cacheable(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_cacheable(const struct sess *, unsigned"); + vsb_cat(sb, ");\ndouble VRT_r_obj_ttl(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_ttl(const struct sess *, double);\n"); + vsb_cat(sb, "double VRT_r_obj_grace(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_grace(const struct sess *, double);\n"); + vsb_cat(sb, "double VRT_r_obj_prefetch(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_obj_prefetch(const struct sess *, double);\n"); + vsb_cat(sb, "double VRT_r_obj_lastuse(const struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_obj_hash(const struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_resp_proto(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_resp_proto(const struct sess *, const char "); + vsb_cat(sb, "*, ...);\nint VRT_r_resp_status(const struct sess *);\n"); + vsb_cat(sb, "void VRT_l_resp_status(const struct sess *, int);\n"); + vsb_cat(sb, "const char * VRT_r_resp_response(const struct sess *);"); + vsb_cat(sb, "\nvoid VRT_l_resp_response(const struct sess *, const "); + vsb_cat(sb, "char *, ...);\ndouble VRT_r_now(const struct sess *);\n"); + vsb_cat(sb, "unsigned VRT_r_req_backend_healthy(const struct sess *"); + vsb_cat(sb, ");\n"); } From des at projects.linpro.no Mon Oct 20 20:09:51 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 22:09:51 +0200 (CEST) Subject: r3341 - trunk/varnish-cache Message-ID: <20081020200951.61C561EC7CA@projects.linpro.no> Author: des Date: 2008-10-20 22:09:51 +0200 (Mon, 20 Oct 2008) New Revision: 3341 Modified: trunk/varnish-cache/autogen.des Log: config-cache is more trouble than it's worth. Modified: trunk/varnish-cache/autogen.des =================================================================== --- trunk/varnish-cache/autogen.des 2008-10-20 20:06:17 UTC (rev 3340) +++ trunk/varnish-cache/autogen.des 2008-10-20 20:09:51 UTC (rev 3341) @@ -11,7 +11,6 @@ export CONFIG_SHELL=/bin/sh ./configure \ - --config-cache \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ From des at projects.linpro.no Mon Oct 20 20:11:16 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 22:11:16 +0200 (CEST) Subject: r3342 - in trunk/varnish-cache: bin/varnishd bin/varnishtest etc lib/libjemalloc lib/libvarnish man Message-ID: <20081020201116.B0ACD1EC45F@projects.linpro.no> Author: des Date: 2008-10-20 22:11:16 +0200 (Mon, 20 Oct 2008) New Revision: 3342 Modified: trunk/varnish-cache/bin/varnishd/ trunk/varnish-cache/bin/varnishtest/ trunk/varnish-cache/etc/ trunk/varnish-cache/lib/libjemalloc/ trunk/varnish-cache/lib/libvarnish/ trunk/varnish-cache/man/ Log: svn:ignore Property changes on: trunk/varnish-cache/bin/varnishd ___________________________________________________________________ Name: svn:ignore - .deps .libs Makefile Makefile.in varnishd + .deps .libs Makefile Makefile.in default_vcl.h varnishd Property changes on: trunk/varnish-cache/bin/varnishtest ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in varnishtest Property changes on: trunk/varnish-cache/etc ___________________________________________________________________ Name: svn:ignore - Makefile Makefile.in + Makefile Makefile.in default.vcl Property changes on: trunk/varnish-cache/lib/libjemalloc ___________________________________________________________________ Name: svn:ignore + .deps .libs Makefile Makefile.in Property changes on: trunk/varnish-cache/lib/libvarnish ___________________________________________________________________ Name: svn:ignore - .deps .libs Makefile Makefile.in + .deps .libs Makefile Makefile.in num_c_test Property changes on: trunk/varnish-cache/man ___________________________________________________________________ Name: svn:ignore - Makefile Makefile.in + Makefile Makefile.in default.vcl vcl.7 From des at projects.linpro.no Mon Oct 20 20:18:10 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 22:18:10 +0200 (CEST) Subject: r3343 - trunk/varnish-cache/lib/libjemalloc Message-ID: <20081020201810.6626A1EC99D@projects.linpro.no> Author: des Date: 2008-10-20 22:18:10 +0200 (Mon, 20 Oct 2008) New Revision: 3343 Modified: trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c Log: Fix warnings on Linux Modified: trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c =================================================================== --- trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c 2008-10-20 20:11:16 UTC (rev 3342) +++ trunk/varnish-cache/lib/libjemalloc/jemalloc_linux.c 2008-10-20 20:18:10 UTC (rev 3343) @@ -2029,6 +2029,7 @@ { void *ret; + (void)zero; /* XXX */ assert(size != 0); assert((size & chunksize_mask) == 0); @@ -3045,6 +3046,7 @@ { void *ret; + (void)arena; /* XXX */ assert(run->magic == ARENA_RUN_MAGIC); assert(run->nfree > 0); From des at projects.linpro.no Mon Oct 20 20:19:12 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Mon, 20 Oct 2008 22:19:12 +0200 (CEST) Subject: r3344 - trunk/varnish-cache/bin/varnishncsa Message-ID: <20081020201912.A931C1EC815@projects.linpro.no> Author: des Date: 2008-10-20 22:19:12 +0200 (Mon, 20 Oct 2008) New Revision: 3344 Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c Log: Use a proper format string. Modified: trunk/varnish-cache/bin/varnishncsa/varnishncsa.c =================================================================== --- trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-20 20:18:10 UTC (rev 3343) +++ trunk/varnish-cache/bin/varnishncsa/varnishncsa.c 2008-10-20 20:19:12 UTC (rev 3344) @@ -441,7 +441,7 @@ if (lp->df_Host) { if (strncmp(lp->df_Host, "http://", 7) != 0) fprintf(fo, "http://"); - fprintf(fo, lp->df_Host); + fprintf(fo, "%s", lp->df_Host); } fprintf(fo, "%s ", lp->df_Uq); fprintf(fo, "%s\" ", lp->df_H); From des at projects.linpro.no Wed Oct 22 11:33:58 2008 From: des at projects.linpro.no (des at projects.linpro.no) Date: Wed, 22 Oct 2008 13:33:58 +0200 (CEST) Subject: r3345 - in trunk/varnish-cache/lib: libvarnish libvarnishcompat Message-ID: <20081022113358.39ADC1EC45F@projects.linpro.no> Author: des Date: 2008-10-22 13:33:58 +0200 (Wed, 22 Oct 2008) New Revision: 3345 Modified: trunk/varnish-cache/lib/libvarnish/tcp.c trunk/varnish-cache/lib/libvarnish/vsb.c trunk/varnish-cache/lib/libvarnishcompat/strndup.c Log: Get rid of . Modified: trunk/varnish-cache/lib/libvarnish/tcp.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/tcp.c 2008-10-20 20:19:12 UTC (rev 3344) +++ trunk/varnish-cache/lib/libvarnish/tcp.c 2008-10-22 11:33:58 UTC (rev 3345) @@ -102,7 +102,7 @@ struct accept_filter_arg afa; int i; - bzero(&afa, sizeof(afa)); + memset(&afa, 0, sizeof(afa)); strcpy(afa.af_name, "httpready"); errno = 0; i = setsockopt(sock, SOL_SOCKET, SO_ACCEPTFILTER, Modified: trunk/varnish-cache/lib/libvarnish/vsb.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/vsb.c 2008-10-20 20:19:12 UTC (rev 3344) +++ trunk/varnish-cache/lib/libvarnish/vsb.c 2008-10-22 11:33:58 UTC (rev 3345) @@ -36,7 +36,6 @@ #include #include #include -#include #include "libvarnish.h" #include "vsb.h" @@ -137,7 +136,7 @@ newbuf = (char *)SBMALLOC(newsize); if (newbuf == NULL) return (-1); - bcopy(s->s_buf, newbuf, s->s_size); + memcpy(newbuf, s->s_buf, s->s_size); if (VSB_ISDYNAMIC(s)) SBFREE(s->s_buf); else @@ -165,12 +164,12 @@ s = (struct vsb *)SBMALLOC(sizeof *s); if (s == NULL) return (NULL); - bzero(s, sizeof *s); + memset(s, 0, sizeof *s); s->s_flags = flags; s->s_magic = VSB_MAGIC; VSB_SETFLAG(s, VSB_DYNSTRUCT); } else { - bzero(s, sizeof *s); + memset(s, 0, sizeof *s); s->s_flags = flags; s->s_magic = VSB_MAGIC; } @@ -466,7 +465,7 @@ if (VSB_ISDYNAMIC(s)) SBFREE(s->s_buf); isdyn = VSB_ISDYNSTRUCT(s); - bzero(s, sizeof *s); + memset(s, 0, sizeof *s); if (isdyn) SBFREE(s); } Modified: trunk/varnish-cache/lib/libvarnishcompat/strndup.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/strndup.c 2008-10-20 20:19:12 UTC (rev 3344) +++ trunk/varnish-cache/lib/libvarnishcompat/strndup.c 2008-10-22 11:33:58 UTC (rev 3345) @@ -36,7 +36,6 @@ #include #include -#include #ifndef HAVE_STRLCPY #include "compat/strlcpy.h" From phk at projects.linpro.no Thu Oct 23 07:49:20 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Thu, 23 Oct 2008 09:49:20 +0200 (CEST) Subject: r3346 - trunk/varnish-cache/lib/libvcl Message-ID: <20081023074920.293211EC7C4@projects.linpro.no> Author: phk Date: 2008-10-23 09:49:19 +0200 (Thu, 23 Oct 2008) New Revision: 3346 Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c Log: Don't quote the entire inlined C source in the index table, just show C{ Spotted by: nkallen Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-22 11:33:58 UTC (rev 3345) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.c 2008-10-23 07:49:19 UTC (rev 3346) @@ -285,8 +285,12 @@ pos++; } - Fc(tl, 0, " [%3u] = { %d, %8u, %4u, %3u, 0, \"%.*s\" },\n", - t->cnt, sp->idx, t->b - sp->b, lin, pos + 1, PF(t)); + Fc(tl, 0, " [%3u] = { %d, %8u, %4u, %3u, 0, ", + t->cnt, sp->idx, t->b - sp->b, lin, pos + 1); + if (t->tok == CSRC) + Fc(tl, 0, " \"C{\"},\n"); + else + Fc(tl, 0, " \"%.*s\" },\n", PF(t)); } Fc(tl, 0, "};\n"); } From sky at projects.linpro.no Sun Oct 26 18:07:12 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Sun, 26 Oct 2008 19:07:12 +0100 (CET) Subject: r3347 - branches Message-ID: <20081026180712.7EA8D1EC405@projects.linpro.no> Author: sky Date: 2008-10-26 19:07:12 +0100 (Sun, 26 Oct 2008) New Revision: 3347 Removed: branches/nuke/ Log: rebasing it on released version From sky at projects.linpro.no Sun Oct 26 18:12:47 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Sun, 26 Oct 2008 19:12:47 +0100 (CET) Subject: r3348 - branches Message-ID: <20081026181247.7B8531EC2A4@projects.linpro.no> Author: sky Date: 2008-10-26 19:12:47 +0100 (Sun, 26 Oct 2008) New Revision: 3348 Added: branches/nuke/ Log: implementing nuke option for purging Copied: branches/nuke (from rev 3347, tags/varnish-2.0.1) From sky at projects.linpro.no Sun Oct 26 18:48:32 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Sun, 26 Oct 2008 19:48:32 +0100 (CET) Subject: r3349 - branches/nuke/varnish-cache/bin/varnishtest Message-ID: <20081026184832.7E39E1EC2A4@projects.linpro.no> Author: sky Date: 2008-10-26 19:48:32 +0100 (Sun, 26 Oct 2008) New Revision: 3349 Modified: branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c Log: there are tests with failing DNS lookups, on OSX that takes more than 10 seconds, makes v00017.vtc pass Modified: branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-26 18:12:47 UTC (rev 3348) +++ branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-26 18:48:32 UTC (rev 3349) @@ -93,7 +93,7 @@ assert(i == strlen(cmd)); i = write(v->cli_fd, "\n", 1); assert(i == 1); - i = cli_readres(v->cli_fd, &retval, &r, 10.0); + i = cli_readres(v->cli_fd, &retval, &r, 60.0); assert(i == 0); vtc_dump(v->vl, 4, "CLI RX", r); vtc_log(v->vl, 3, "CLI STATUS %u", retval); From sky at projects.linpro.no Sun Oct 26 19:04:52 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Sun, 26 Oct 2008 20:04:52 +0100 (CET) Subject: r3350 - in branches/nuke/varnish-cache/bin/varnishtest: . tests Message-ID: <20081026190452.2F77F1EC216@projects.linpro.no> Author: sky Date: 2008-10-26 20:04:51 +0100 (Sun, 26 Oct 2008) New Revision: 3350 Modified: branches/nuke/varnish-cache/bin/varnishtest/tests/v00017.vtc branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c Log: my bad, the problem is an excessive search list on my laptop; appending a . to the domain name terminates that search; reverting #3349 Modified: branches/nuke/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- branches/nuke/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-26 18:48:32 UTC (rev 3349) +++ branches/nuke/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-26 19:04:51 UTC (rev 3350) @@ -34,7 +34,7 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } - acl a { "en.lille.nisse.rejste"; } + acl a { "en.lille.nisse.rejste."; } sub vcl_recv { if (client.ip ~ a) { pass; } } } @@ -60,8 +60,8 @@ backend b { .host = "127.0.0.1"; } acl a { ! "10.1.3"; - ("en.lille.nisse.rejste" / 22); - (!"en.lille.nisse.rejste"); + ("en.lille.nisse.rejste." / 22); + (!"en.lille.nisse.rejste."); } sub vcl_recv { if (client.ip ~ a) { pass; } } } Modified: branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-26 18:48:32 UTC (rev 3349) +++ branches/nuke/varnish-cache/bin/varnishtest/vtc_varnish.c 2008-10-26 19:04:51 UTC (rev 3350) @@ -93,7 +93,7 @@ assert(i == strlen(cmd)); i = write(v->cli_fd, "\n", 1); assert(i == 1); - i = cli_readres(v->cli_fd, &retval, &r, 60.0); + i = cli_readres(v->cli_fd, &retval, &r, 10.0); assert(i == 0); vtc_dump(v->vl, 4, "CLI RX", r); vtc_log(v->vl, 3, "CLI STATUS %u", retval); From sky at projects.linpro.no Mon Oct 27 00:22:38 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Mon, 27 Oct 2008 01:22:38 +0100 (CET) Subject: r3351 - in branches/nuke/varnish-cache: bin/varnishd bin/varnishtest/tests include lib/libvcl Message-ID: <20081027002238.B9B2A1EC2A4@projects.linpro.no> Author: sky Date: 2008-10-27 01:22:38 +0100 (Mon, 27 Oct 2008) New Revision: 3351 Added: branches/nuke/varnish-cache/bin/varnishtest/tests/c00019.vtc Modified: branches/nuke/varnish-cache/bin/varnishd/cache.h branches/nuke/varnish-cache/bin/varnishd/cache_hash.c branches/nuke/varnish-cache/bin/varnishd/cache_vrt.c branches/nuke/varnish-cache/include/shmlog_tags.h branches/nuke/varnish-cache/include/stat_field.h branches/nuke/varnish-cache/include/vrt.h branches/nuke/varnish-cache/lib/libvcl/vcc_action.c branches/nuke/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: This implements a nuke() option. It will mangle the hash string of an object header, thus making it impossible to find. Eventually it will expire or LRU will get the better of it. It takes a variable arglist of strings, which it will use to create a hash with. nuke("/url","host"); generates url#hash# which is the default hashstring Modified: branches/nuke/varnish-cache/bin/varnishd/cache.h =================================================================== --- branches/nuke/varnish-cache/bin/varnishd/cache.h 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/bin/varnishd/cache.h 2008-10-27 00:22:38 UTC (rev 3351) @@ -453,6 +453,7 @@ int HSH_Compare(const struct sess *sp, const struct objhead *o); void HSH_Copy(const struct sess *sp, const struct objhead *o); struct object *HSH_Lookup(struct sess *sp); +int HSH_Nuke(struct sess *sp); void HSH_Unbusy(const struct sess *sp); void HSH_Ref(struct object *o); void HSH_Deref(struct object *o); Modified: branches/nuke/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- branches/nuke/varnish-cache/bin/varnishd/cache_hash.c 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/bin/varnishd/cache_hash.c 2008-10-27 00:22:38 UTC (rev 3351) @@ -184,6 +184,21 @@ assert(b <= obj->hash + obj->hashlen); } +int +HSH_Nuke(struct sess *sp) +{ + struct objhead *oh = hash->lookup(sp, NULL); + if (oh) { + VSL_stats->n_nuke_hit++; + oh->hash[0] = "\n"; + hash->deref(oh); + return 1; + } else { + VSL_stats->n_nuke_miss++; + return 0; + } +} + struct object * HSH_Lookup(struct sess *sp) { @@ -223,7 +238,7 @@ } if (!o->cacheable) continue; - if (o->ttl == 0) + if (o->ttl == 0) continue; if (BAN_CheckObject(o, h->hd[HTTP_HDR_URL].b, oh->hash)) { o->ttl = 0; Modified: branches/nuke/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- branches/nuke/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-27 00:22:38 UTC (rev 3351) @@ -723,6 +723,54 @@ (void)BAN_Add(NULL, regexp, hash); } + +/*--------------------------------------------------------------------*/ + +int +VRT_nuke(struct sess *sp, const char *str, ...) +{ + int retval; + va_list ap; + struct object *obj = sp->obj; + struct objhead *objhead = sp->objhead; + struct objhead *oh; + const char *vp; + char *p; + uintptr_t u; + + sp->obj = NULL; + sp->objhead = NULL; + + /* code lifted from cnt_lookup -- should probably be a common function */ + /* Allocate the pointers we need, align properly. */ + sp->lhashptr = 1; /* space for NUL */ + sp->ihashptr = 0; + sp->nhashptr = sp->vcl->nhashcount * 2; + p = WS_Alloc(sp->http->ws, + sizeof(const char *) * (sp->nhashptr + 1)); + XXXAN(p); + /* Align pointer properly (?) */ + u = (uintptr_t)p; + u &= sizeof(const char *) - 1; + if (u) + p += sizeof(const char *) - u; + sp->hashptr = (void*)p; + + VRT_l_req_hash(sp, str); + + va_start(ap, str); + vp = va_arg(ap, const char *); + while (vp != vrt_magic_string_end) { + VRT_l_req_hash(sp, vp); + vp = va_arg(ap, const char *); + } + + retval = HSH_Nuke(sp); + sp->obj = obj; + sp->objhead = objhead; + return retval; +} + /*-------------------------------------------------------------------- * Simple stuff */ Added: branches/nuke/varnish-cache/bin/varnishtest/tests/c00019.vtc =================================================================== --- branches/nuke/varnish-cache/bin/varnishtest/tests/c00019.vtc (rev 0) +++ branches/nuke/varnish-cache/bin/varnishtest/tests/c00019.vtc 2008-10-27 00:22:38 UTC (rev 3351) @@ -0,0 +1,32 @@ +# $Id: c00006.vtc 2906 2008-07-08 10:29:07Z phk $ + +test "Test explicit nuking a url from out of vcl_fetch" + +server s1 { + rxreq + expect req.url == "/foo" + txresp -body "1111\n" + rxreq + expect req.url == "/foo" + txresp -body "11111\n" +} -start + +varnish v1 -vcl+backend { sub vcl_fetch { nuke("/foo","127.0.0.1"); } } -start + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 + expect resp.http.content-length == 5 +} + +client c1 -run + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 + expect resp.http.content-length == 6 +} + +client c1 -run Modified: branches/nuke/varnish-cache/include/shmlog_tags.h =================================================================== --- branches/nuke/varnish-cache/include/shmlog_tags.h 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/include/shmlog_tags.h 2008-10-27 00:22:38 UTC (rev 3351) @@ -92,6 +92,7 @@ SLTM(ExpBan) SLTM(ExpPick) SLTM(ExpKill) +SLTM(ExpNuked) SLTM(WorkThread) SLTM(Terminate) Modified: branches/nuke/varnish-cache/include/stat_field.h =================================================================== --- branches/nuke/varnish-cache/include/stat_field.h 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/include/stat_field.h 2008-10-27 00:22:38 UTC (rev 3351) @@ -124,3 +124,6 @@ MAC_STAT(n_purge_retire, uint64_t, 'a', "N old purges deleted") MAC_STAT(n_purge_obj_test, uint64_t, 'a', "N objects tested") MAC_STAT(n_purge_re_test, uint64_t, 'a', "N regexps tested against") + +MAC_STAT(n_nuke_hit, uint64_t, 'a', "N object headers marked as nuked") +MAC_STAT(n_nuke_miss, uint64_t, 'a', "N object headers not in cache") Modified: branches/nuke/varnish-cache/include/vrt.h =================================================================== --- branches/nuke/varnish-cache/include/vrt.h 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/include/vrt.h 2008-10-27 00:22:38 UTC (rev 3351) @@ -141,6 +141,7 @@ void VRT_panic(struct sess *sp, const char *, ...); void VRT_purge(const char *, int hash); +int VRT_nuke(struct sess *sp,const char *, ...); void VRT_count(const struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Modified: branches/nuke/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- branches/nuke/varnish-cache/lib/libvcl/vcc_action.c 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/lib/libvcl/vcc_action.c 2008-10-27 00:22:38 UTC (rev 3351) @@ -379,6 +379,39 @@ } static void +parse_nuke(struct tokenlist *tl) +{ + + vcc_NextToken(tl); + + Fb(tl, 1, "VRT_nuke(sp, "); + + vcc_NextToken(tl); + + if (!vcc_StringVal(tl)) { + vcc_ExpectedStringval(tl); + return; + } + + + while (tl->t->tok == ',') { + vcc_NextToken(tl); + Fb(tl, 0, ", "); + if (!vcc_StringVal(tl)) { + vcc_ExpectedStringval(tl); + return; + } + } + + Expect(tl, ')'); + vcc_NextToken(tl); + Fb(tl, 0, ", vrt_magic_string_end);\n"); +} + + + + +static void parse_esi(struct tokenlist *tl) { @@ -440,6 +473,7 @@ /* Keep list sorted from here */ { "call", parse_call }, { "esi", parse_esi }, + { "nuke", parse_nuke }, { "panic", parse_panic }, { "purge_hash", parse_purge_hash }, { "purge_url", parse_purge_url }, Modified: branches/nuke/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/nuke/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-26 19:04:51 UTC (rev 3350) +++ branches/nuke/varnish-cache/lib/libvcl/vcc_fixed_token.c 2008-10-27 00:22:38 UTC (rev 3351) @@ -421,6 +421,7 @@ vsb_cat(sb, "\n"); vsb_cat(sb, "void VRT_panic(struct sess *sp, const char *, ...);\n"); vsb_cat(sb, "void VRT_purge(const char *, int hash);\n"); + vsb_cat(sb, "int VRT_nuke(struct sess *sp,const char *, ...);\n"); vsb_cat(sb, "\n"); vsb_cat(sb, "void VRT_count(const struct sess *, unsigned);\n"); vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n"); From sky at projects.linpro.no Mon Oct 27 00:36:05 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Mon, 27 Oct 2008 01:36:05 +0100 (CET) Subject: r3352 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: <20081027003605.017411EC2AE@projects.linpro.no> Author: sky Date: 2008-10-27 01:36:04 +0100 (Mon, 27 Oct 2008) New Revision: 3352 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc Log: merge #3350 into trunk -- make tests fail if you have a long and correct search list; which my laptop has Modified: trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-27 00:22:38 UTC (rev 3351) +++ trunk/varnish-cache/bin/varnishtest/tests/v00017.vtc 2008-10-27 00:36:04 UTC (rev 3352) @@ -34,7 +34,7 @@ varnish v1 -badvcl { backend b { .host = "127.0.0.1"; } - acl a { "en.lille.nisse.rejste"; } + acl a { "en.lille.nisse.rejste."; } sub vcl_recv { if (client.ip ~ a) { pass; } } } @@ -60,8 +60,8 @@ backend b { .host = "127.0.0.1"; } acl a { ! "10.1.3"; - ("en.lille.nisse.rejste" / 22); - (!"en.lille.nisse.rejste"); + ("en.lille.nisse.rejste." / 22); + (!"en.lille.nisse.rejste."); } sub vcl_recv { if (client.ip ~ a) { pass; } } } From sky at projects.linpro.no Tue Oct 28 12:21:15 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Tue, 28 Oct 2008 13:21:15 +0100 (CET) Subject: r3353 - trunk/varnish-cache/bin/varnishd Message-ID: <20081028122115.7DAE21EC2A4@projects.linpro.no> Author: sky Date: 2008-10-28 13:21:15 +0100 (Tue, 28 Oct 2008) New Revision: 3353 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: resp.status was returning obj.status Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-27 00:36:04 UTC (rev 3352) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-28 12:21:15 UTC (rev 3353) @@ -287,7 +287,7 @@ { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); - return (atoi(sp->obj->http->hd[HTTP_HDR_STATUS].b)); + return (atoi(sp->http->hd[HTTP_HDR_STATUS].b)); } /*--------------------------------------------------------------------*/ From sky at projects.linpro.no Tue Oct 28 12:33:20 2008 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Tue, 28 Oct 2008 13:33:20 +0100 (CET) Subject: r3354 - trunk/varnish-cache/bin/varnishd Message-ID: <20081028123320.1D2A11EC215@projects.linpro.no> Author: sky Date: 2008-10-28 13:33:19 +0100 (Tue, 28 Oct 2008) New Revision: 3354 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: thanks mithrandir -- check the right magic Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-28 12:21:15 UTC (rev 3353) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2008-10-28 12:33:19 UTC (rev 3354) @@ -286,7 +286,7 @@ VRT_r_resp_status(const struct sess *sp) { CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); + CHECK_OBJ_NOTNULL(sp->http, HTTP_MAGIC); return (atoi(sp->http->hd[HTTP_HDR_STATUS].b)); } From phk at projects.linpro.no Tue Oct 28 13:22:30 2008 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 28 Oct 2008 14:22:30 +0100 (CET) Subject: r3355 - in trunk/varnish-cache: bin/varnishd include Message-ID: <20081028132230.1107A1EC0D8@projects.linpro.no> Author: phk Date: 2008-10-28 14:22:29 +0100 (Tue, 28 Oct 2008) New Revision: 3355 Added: trunk/varnish-cache/include/http_response.h Modified: trunk/varnish-cache/bin/varnishd/cache_http.c Log: Factor the HTTP responsecodes into a file where we can find them. Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-28 12:33:19 UTC (rev 3354) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2008-10-28 13:22:29 UTC (rev 3355) @@ -98,46 +98,8 @@ unsigned nbr; const char *txt; } http_msg[] = { - { 101, "Switching Protocols" }, - { 200, "OK" }, - { 201, "Created" }, - { 202, "Accepted" }, - { 203, "Non-Authoritative Information" }, - { 204, "No Content" }, - { 205, "Reset Content" }, - { 206, "Partial Content" }, - { 300, "Multiple Choices" }, - { 301, "Moved Permanently" }, - { 302, "Found" }, - { 303, "See Other" }, - { 304, "Not Modified" }, - { 305, "Use Proxy" }, - { 306, "(Unused)" }, - { 307, "Temporary Redirect" }, - { 400, "Bad Request" }, - { 401, "Unauthorized" }, - { 402, "Payment Required" }, - { 403, "Forbidden" }, - { 404, "Not Found" }, - { 405, "Method Not Allowed" }, - { 406, "Not Acceptable" }, - { 407, "Proxy Authentication Required" }, - { 408, "Request Timeout" }, - { 409, "Conflict" }, - { 410, "Gone" }, - { 411, "Length Required" }, - { 412, "Precondition Failed" }, - { 413, "Request Entity Too Large" }, - { 414, "Request-URI Too Long" }, - { 415, "Unsupported Media Type" }, - { 416, "Requested Range Not Satisfiable" }, - { 417, "Expectation Failed" }, - { 500, "Internal Server Error" }, - { 501, "Not Implemented" }, - { 502, "Bad Gateway" }, - { 503, "Service Unavailable" }, - { 504, "Gateway Timeout" }, - { 505, "HTTP Version Not Supported" }, +#define HTTP_RESP(n, t) { n, t}, +#include "http_response.h" { 0, NULL } }; Added: trunk/varnish-cache/include/http_response.h =================================================================== --- trunk/varnish-cache/include/http_response.h (rev 0) +++ trunk/varnish-cache/include/http_response.h 2008-10-28 13:22:29 UTC (rev 3355) @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2008 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $Id$ + */ + +HTTP_RESP(101, "Switching Protocols") +HTTP_RESP(200, "OK") +HTTP_RESP(201, "Created") +HTTP_RESP(202, "Accepted") +HTTP_RESP(203, "Non-Authoritative Information") +HTTP_RESP(204, "No Content") +HTTP_RESP(205, "Reset Content") +HTTP_RESP(206, "Partial Content") +HTTP_RESP(300, "Multiple Choices") +HTTP_RESP(301, "Moved Permanently") +HTTP_RESP(302, "Found") +HTTP_RESP(303, "See Other") +HTTP_RESP(304, "Not Modified") +HTTP_RESP(305, "Use Proxy") +HTTP_RESP(306, "(Unused)") +HTTP_RESP(307, "Temporary Redirect") +HTTP_RESP(400, "Bad Request") +HTTP_RESP(401, "Unauthorized") +HTTP_RESP(402, "Payment Required") +HTTP_RESP(403, "Forbidden") +HTTP_RESP(404, "Not Found") +HTTP_RESP(405, "Method Not Allowed") +HTTP_RESP(406, "Not Acceptable") +HTTP_RESP(407, "Proxy Authentication Required") +HTTP_RESP(408, "Request Timeout") +HTTP_RESP(409, "Conflict") +HTTP_RESP(410, "Gone") +HTTP_RESP(411, "Length Required") +HTTP_RESP(412, "Precondition Failed") +HTTP_RESP(413, "Request Entity Too Large") +HTTP_RESP(414, "Request-URI Too Long") +HTTP_RESP(415, "Unsupported Media Type") +HTTP_RESP(416, "Requested Range Not Satisfiable") +HTTP_RESP(417, "Expectation Failed") +HTTP_RESP(500, "Internal Server Error") +HTTP_RESP(501, "Not Implemented") +HTTP_RESP(502, "Bad Gateway") +HTTP_RESP(503, "Service Unavailable") +HTTP_RESP(504, "Gateway Timeout") +HTTP_RESP(505, "HTTP Version Not Supported") From ssm at projects.linpro.no Wed Oct 29 06:55:40 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Wed, 29 Oct 2008 07:55:40 +0100 (CET) Subject: r3356 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081029065540.661551EC2A4@projects.linpro.no> Author: ssm Date: 2008-10-29 07:55:40 +0100 (Wed, 29 Oct 2008) New Revision: 3356 Added: trunk/varnish-cache/bin/varnishtest/varnishtest.1 Modified: trunk/varnish-cache/bin/varnishtest/Makefile.am Log: Add a varnishtest man page Modified: trunk/varnish-cache/bin/varnishtest/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtest/Makefile.am 2008-10-28 13:22:29 UTC (rev 3355) +++ trunk/varnish-cache/bin/varnishtest/Makefile.am 2008-10-29 06:55:40 UTC (rev 3356) @@ -9,6 +9,8 @@ bin_PROGRAMS = varnishtest +dist_man_MANS = varnishtest.1 + varnishtest_SOURCES = \ vtc.c \ vtc.h \ Added: trunk/varnish-cache/bin/varnishtest/varnishtest.1 =================================================================== --- trunk/varnish-cache/bin/varnishtest/varnishtest.1 (rev 0) +++ trunk/varnish-cache/bin/varnishtest/varnishtest.1 2008-10-29 06:55:40 UTC (rev 3356) @@ -0,0 +1,220 @@ +.\"- +.\" Copyright (c) 2006-2008 Linpro AS +.\" All rights reserved. +.\" +.\" Author: Stig Sandbeck Mathisen +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $Id$ +.\" +.Dd October 29, 2008 +.Dt VARNISHTEST 1 +.Os +.Sh NAME +.Nm varnishtest +.Nd Test program for Varnish +.Sh SYNOPSIS +.Nm +.Op Fl n Ar iter +.Op Fl q +.Op Fl v +.Ar file +.Op Ar file ... +.Sh DESCRIPTION +The +.Nm +program is a script driven program used to test the varnish HTTP +accelerator. +.Pp +The +.Nm +program, when started and given one or more script files, can create a +number of threads representing backends, some threads representing +clients, and a varnishd process. +.Pp +The following options are available: +.Bl -tag -width Fl +.It Fl n Ar iter +Run +.Ar iter +number of iterations. +.It Fl q +Be quiet. +.It Fl v +Be verbose. +.It Ar file +File to use as a script +.El +.Sh SCRIPTS +.Ss Example script +.Bd -literal -offset 4n +# Start a varnish instance called "v1" +varnish v1 -arg "-b localhost:9080" -start + +# Create a server thread called "s1" +server s1 { + # Receive a request + rxreq + # Send a standard response + txresp -hdr "Connection: close" -body "012345\\n" +} + +# Start the server thread +server s1 -start + +# Create a client thread called "c1" +client c1 { + # Send a request + txreq -url "/" + # Wait for a response + rxresp + # Insist that it be a success + expect resp.status == 200 +} + +# Run the client +client c1 -run + +# Wait for the server to die +server s1 -wait + +# (Forcefully) Stop the varnish instance. +varnish v1 -stop +.Ed + +.Ss Example script output +The output, running this script looks as follows. +.Pp +The "bargraph" at the beginning of the line is an indication of the +level of detail in the line. +.Pp +The second field where the message comes from +.Pp +The rest of the line is anyones guess :-) +.Bd -literal -offset 4n +# TEST tests/b00000.vtc starting +### v1 CMD: cd ../varnishd && ./varnishd -d -d -n v1 -a :9081 -T :9001 -b localhost:9080 +### v1 opening CLI connection +#### v1 debug| NB: Storage size limited to 2GB on 32 bit architecture,\\n +#### v1 debug| NB: otherwise we could run out of address space.\\n +#### v1 debug| storage_file: filename: ./varnish.Shkoq5 (unlinked) size 2047 MB.\\n +### v1 CLI connection fd = 3 +#### v1 CLI TX| start +#### v1 debug| Using old SHMFILE\\n +#### v1 debug| Notice: locking SHMFILE in core failed: Operation not permitted\\n +#### v1 debug| bind(): Address already in use\\n +#### v1 debug| rolling(1)... +#### v1 debug| \\n +#### v1 debug| rolling(2)...\\n +#### v1 debug| Debugging mode, enter "start" to start child\\n +### v1 CLI 200 +## s1 Starting server +### s1 listen on :9080 (fd 6) +## c1 Starting client +## c1 Waiting for client +## s1 started on :9080 +## c1 started +### c1 connect to :9081 +### c1 connected to :9081 fd is 8 +#### c1 | GET / HTTP/1.1\\r\\n +#### c1 | \\r\\n +### c1 rxresp +#### s1 Accepted socket 7 +### s1 rxreq +#### s1 | GET / HTTP/1.1\\r\\n +#### s1 | X-Varnish: 422080121\\r\\n +#### s1 | X-Forwarded-For: 127.0.0.1\\r\\n +#### s1 | Host: localhost\\r\\n +#### s1 | \\r\\n +#### s1 http[ 0] | GET +#### s1 http[ 1] | / +#### s1 http[ 2] | HTTP/1.1 +#### s1 http[ 3] | X-Varnish: 422080121 +#### s1 http[ 4] | X-Forwarded-For: 127.0.0.1 +#### s1 http[ 5] | Host: localhost +#### s1 | HTTP/1.1 200 Ok\\r\\n +#### s1 | Connection: close\\r\\n +#### s1 | \\r\\n +#### s1 | 012345\\n +#### s1 | \\r\\n +## s1 ending +#### c1 | HTTP/1.1 200 Ok\\r\\n +#### c1 | Content-Length: 9\\r\\n +#### c1 | Date: Mon, 16 Jun 2008 22:16:55 GMT\\r\\n +#### c1 | X-Varnish: 422080121\\r\\n +#### c1 | Age: 0\\r\\n +#### c1 | Via: 1.1 varnish\\r\\n +#### c1 | Connection: keep-alive\\r\\n +#### c1 | \\r\\n +#### c1 http[ 0] | HTTP/1.1 +#### c1 http[ 1] | 200 +#### c1 http[ 2] | Ok +#### c1 http[ 3] | Content-Length: 9 +#### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:16:55 GMT +#### c1 http[ 5] | X-Varnish: 422080121 +#### c1 http[ 6] | Age: 0 +#### c1 http[ 7] | Via: 1.1 varnish +#### c1 http[ 8] | Connection: keep-alive +#### c1 EXPECT resp.status (200) == 200 (200) match +## c1 ending +## s1 Waiting for server +#### v1 CLI TX| stop +### v1 CLI 200 +# TEST tests/b00000.vtc completed +.Ed +.Pp +If instead of 200 we had expected 201 with the line: +.Bd -literal -offset 4n +expect resp.status == 201 +.Ed +.Pp +The output would have ended with: +.Bd -literal -offset 4n +#### c1 http[ 0] | HTTP/1.1 +#### c1 http[ 1] | 200 +#### c1 http[ 2] | Ok +#### c1 http[ 3] | Content-Length: 9 +#### c1 http[ 4] | Date: Mon, 16 Jun 2008 22:26:35 GMT +#### c1 http[ 5] | X-Varnish: 648043653 648043652 +#### c1 http[ 6] | Age: 6 +#### c1 http[ 7] | Via: 1.1 varnish +#### c1 http[ 8] | Connection: keep-alive +---- c1 EXPECT resp.status (200) == 201 (201) failed +.Ed +.Sh SEE ALSO +.Xr varnishlog 1 , +.Xr varnishhist 1 , +.Xr varnishncsa 1 , +.Xr varnishstat 1 , +.Xr varnishtop 1 , +.Xr vcl 7 +.Sh HISTORY +The +.Nm +program was developed by +.An Poul-Henning Kamp Aq phk at phk.freebsd.dk +in cooperation with Verdens Gang AS and Linpro AS. This manual page +was written by +.An Stig Sandbeck Mathisen Aq ssm at linpro.no +using examples by +.An Poul-Henning Kamp Aq phk at phk.freebsd.dk From ssm at projects.linpro.no Thu Oct 30 07:00:00 2008 From: ssm at projects.linpro.no (ssm at projects.linpro.no) Date: Thu, 30 Oct 2008 08:00:00 +0100 (CET) Subject: r3357 - trunk/varnish-cache/bin/varnishtest Message-ID: <20081030070000.B361E1EC213@projects.linpro.no> Author: ssm Date: 2008-10-30 08:00:00 +0100 (Thu, 30 Oct 2008) New Revision: 3357 Modified: trunk/varnish-cache/bin/varnishtest/varnishtest.1 Log: varnishtest man page: whitespace fix Modified: trunk/varnish-cache/bin/varnishtest/varnishtest.1 =================================================================== --- trunk/varnish-cache/bin/varnishtest/varnishtest.1 2008-10-29 06:55:40 UTC (rev 3356) +++ trunk/varnish-cache/bin/varnishtest/varnishtest.1 2008-10-30 07:00:00 UTC (rev 3357) @@ -55,7 +55,7 @@ The following options are available: .Bl -tag -width Fl .It Fl n Ar iter -Run +Run .Ar iter number of iterations. .It Fl q @@ -74,13 +74,13 @@ # Create a server thread called "s1" server s1 { # Receive a request - rxreq + rxreq # Send a standard response txresp -hdr "Connection: close" -body "012345\\n" } # Start the server thread -server s1 -start +server s1 -start # Create a client thread called "c1" client c1 { @@ -101,7 +101,6 @@ # (Forcefully) Stop the varnish instance. varnish v1 -stop .Ed - .Ss Example script output The output, running this script looks as follows. .Pp