From phk at varnish-cache.org Wed Apr 7 13:26:31 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 7 Apr 2010 15:26:31 +0200 Subject: r4646 - trunk/varnish-cache/lib/libvarnish Message-ID: Author: phk Date: 2010-04-07 15:26:30 +0200 (Wed, 07 Apr 2010) New Revision: 4646 Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c Log: Turn the binary heap into a "B-heap" to reduce the number of pagefaults by roughly a factor 9. Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-03-30 11:10:16 UTC (rev 4645) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-04-07 13:26:30 UTC (rev 4646) @@ -43,7 +43,7 @@ #include "binary_heap.h" #include "libvarnish.h" -/* Paramters ---------------------------------------------------------*/ +/* Parameters --------------------------------------------------------*/ /* * The number of elements in a row has to be a compromise between @@ -81,12 +81,78 @@ unsigned rows; unsigned length; unsigned next; + unsigned page_size; + unsigned page_mask; + unsigned page_shift; }; -#define PARENT(u) ((u) / 2) -/*lint -emacro(835, CHILD) 0 right of + */ -#define CHILD(u,n) ((u) * 2 + (n)) +#define VM_AWARE +#ifdef VM_AWARE + +static unsigned +parent(const struct binheap *bh, unsigned u) +{ + unsigned po; + unsigned v; + + po = u & bh->page_mask; + + if (u < bh->page_size || po > 3) { + v = (u & ~bh->page_mask) | (po >> 1); + } else if (po < 2) { + v = (u - bh->page_size) >> bh->page_shift; + v += v & ~(bh->page_mask >> 1); + v |= bh->page_size / 2; + } else { + v = u - 2; + } + return (v); +} + +static void +child(const struct binheap *bh, unsigned u, unsigned *a, unsigned *b) +{ + + if (u > bh->page_mask && (u & (bh->page_mask - 1)) == 0) { + /* First two elements are magical except on the first page */ + *a = *b = u + 2; + } else if (u & (bh->page_size >> 1)) { + /* The bottom row is even more magical */ + *a = (u & ~bh->page_mask) >> 1; + *a |= u & (bh->page_mask >> 1); + *a += 1; + *a <<= bh->page_shift; + *b = *a + 1; + } else { + /* The rest is as usual, only inside the page */ + *a = u + (u & bh->page_mask); + *b += 1; + } +} + + +#else + +static unsigned +parent(const struct binheap *bh, unsigned u) +{ + + (void)bh; + return (u / 2); +} + +static void +child(const struct binheap *bh, unsigned u, unsigned *a, unsigned *b) +{ + + (void)bh; + *a = u * 2; + *b = *a + 1; +} + +#endif + /* Implementation ----------------------------------------------------*/ static void @@ -114,11 +180,21 @@ binheap_new(void *priv, binheap_cmp_t *cmp_f, binheap_update_t *update_f) { struct binheap *bh; + unsigned u; bh = calloc(sizeof *bh, 1); if (bh == NULL) return (bh); bh->priv = priv; + + bh->page_size = (unsigned)getpagesize() / sizeof (void *); + bh->page_mask = bh->page_size - 1; + assert(!(bh->page_size & bh->page_mask)); /* power of two */ + for (u = 1; (1U << u) != bh->page_size; u++) + ; + bh->page_shift = u; + assert(bh->page_size <= (sizeof(**bh->array) * ROW_WIDTH)); + bh->cmp = cmp_f; bh->update = update_f; bh->next = ROOT_IDX; @@ -164,7 +240,7 @@ assert(bh->magic == BINHEAP_MAGIC); while (u > ROOT_IDX) { - v = PARENT(u); + v = parent(bh, u); if (!bh->cmp(bh->priv, A(bh, u), A(bh, v))) break; binhead_swap(bh, u, v); @@ -180,10 +256,9 @@ assert(bh->magic == BINHEAP_MAGIC); while (1) { - v1 = CHILD(u, 0); + child(bh, u, &v1, &v2); if (v1 >= bh->next) return; - v2 = CHILD(u, 1); if (v2 < bh->next && bh->cmp(bh->priv, A(bh, v2), A(bh, v1))) v1 = v2; if (bh->cmp(bh->priv, A(bh, u), A(bh, v1))) @@ -280,84 +355,14 @@ /* Test driver -------------------------------------------------------*/ #include -#if 1 - -#define N 23 - -static int -cmp(void *priv, void *a, void *b) -{ - - return (*(unsigned *)a < *(unsigned *)b); -} - -void -update(void *priv, void *a, unsigned u) -{ - printf("%p is now %u\n", a, u); -} - -static void -dump(struct binheap *bh, const char *what, unsigned ptr) -{ - FILE *f; - unsigned u, *up; - - printf("dump\n"); - f = popen("dot -Tps >> /tmp/_.ps 2>/dev/null", "w"); - assert(f != NULL); - fprintf(f, "digraph binheap {\n"); - fprintf(f, "size=\"7,10\"\n"); - fprintf(f, "ptr [label=\"%s\"]\n", what); - fprintf(f, "ptr -> node_%u\n", ptr); - for (u = 1; u < bh->next; u++) { - up = A(bh, u); - fprintf(f, "node_%u [label=\"%u\"];\n", u, *up); - if (u > 0) - fprintf(f, "node_%u -> node_%u\n", PARENT(u), u); - } - fprintf(f, "}\n"); - pclose(f); -} - -int -main(int argc, char **argv) -{ - struct binheap *bh; - unsigned l[N], u, *up, lu; - - system("echo %! > /tmp/_.ps"); - bh = binheap_new(NULL, cmp, update); - for (u = 0; u < N; u++) { - l[u] = random() % 1000; - binheap_insert(bh, &l[u]); - if (1) - dump(bh, "Insert", 0); - } - printf("Inserts done\n"); - lu = 0; - while(1) { - up = binheap_root(bh); - if (up == NULL) - break; - assert(*up >= lu); - lu = *up; - u = (random() % (bh->next - 1)) + 1; - binheap_delete(bh, u); - if (1) - dump(bh, "Delete", u); - } - printf("Deletes done\n"); - return (0); -} -#else struct foo { unsigned idx; unsigned key; }; -#define M 1311191 -#define N 1311 +#define M 31011091 /* Number of operations */ +#define N 10313102 /* Number of items */ +#define R -1 /* Random modulus */ struct foo ff[N]; @@ -383,31 +388,23 @@ void chk(struct binheap *bh) { - unsigned u, v, nb = 0; + unsigned u, v; struct foo *fa, *fb; for (u = 2; u < bh->next; u++) { - v = PARENT(u); + v = parent(bh, u); fa = A(bh, u); fb = A(bh, v); - assert(fa->key > fb->key); - continue; - printf("[%2u/%2u] %10u > [%2u/%2u] %10u %s\n", - u, fa - ff, fa->key, - v, fb - ff, fb->key, - fa->key > fb->key ? "OK" : "BAD"); - if (fa->key <= fb->key) - nb++; + assert(fa->key >= fb->key); } - if (nb) - exit(0); } int main(int argc, char **argv) { struct binheap *bh; - unsigned u, v; + unsigned u, v, lr; + struct foo *fp; if (0) { srandomdev(); @@ -416,25 +413,59 @@ srandom(u); } bh = binheap_new(NULL, cmp, update); + + /* First insert our N elements */ + for (u = 0; u < N; u++) { + lr = random() % R; + ff[u].key = lr; + binheap_insert(bh, &ff[u]); + + fp = binheap_root(bh); + assert(fp->idx == 1); + assert(fp->key <= lr); + } + fprintf(stderr, "%d inserts OK\n", N); + /* For M cycles, pick the root, insert new */ for (u = 0; u < M; u++) { + fp = binheap_root(bh); + assert(fp->idx == 1); + + /* It cannot possibly be larger than the last value we added */ + assert(fp->key <= lr); + binheap_delete(bh, fp->idx); + + lr = random() % R; + fp->key = lr; + binheap_insert(bh, fp); + } + fprintf(stderr, "%d replacements OK\n", M); + /* The remove everything */ + lr = 0; + for (u = 0; u < N; u++) { + fp = binheap_root(bh); + assert(fp->idx == 1); + assert(fp->key >= lr); + lr = fp->key; + binheap_delete(bh, fp->idx); + } + fprintf(stderr, "%d removes OK\n", N); + + for (u = 0; u < M; u++) { v = random() % N; if (ff[v].idx > 0) { - if (0) - printf("Delete [%u] %'u\n", v, ff[v].key); - else - printf("-%u", v); + assert(ff[v].idx != 0); binheap_delete(bh, ff[v].idx); + assert(ff[v].idx == 0); } else { - ff[v].key = random(); - if (0) - printf("Insert [%u] %'u\n", v, ff[v].key); - else - printf("+%u", v); + assert(ff[v].idx == 0); + ff[v].key = random() % R; binheap_insert(bh, &ff[v]); + assert(ff[v].idx != 0); } - chk(bh); + if (0) + chk(bh); } + fprintf(stderr, "%d updates OK\n", M); return (0); } #endif -#endif From phk at varnish-cache.org Thu Apr 8 07:35:23 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 09:35:23 +0200 Subject: r4647 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-08 09:35:23 +0200 (Thu, 08 Apr 2010) New Revision: 4647 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: After check reading the -S argument file during startup, we forgot to close the file descriptor, but this causes no trouble apart from a wasted filedescriptor in the parent process. But closing it is better :-) Fixes: #675 Spotted & Patch by: Edmondas Girkantas Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-07 13:26:30 UTC (rev 4646) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-08 07:35:23 UTC (rev 4647) @@ -517,6 +517,7 @@ fprintf(stderr, "Can not read secret-file \"%s\"\n", S_arg); exit (2); } + AZ(close(fd)); secret_file = S_arg; } From phk at varnish-cache.org Thu Apr 8 08:09:44 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 10:09:44 +0200 Subject: r4648 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-08 10:09:43 +0200 (Thu, 08 Apr 2010) New Revision: 4648 Modified: trunk/varnish-cache/bin/varnishd/mgt.h trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/mgt_cli.c trunk/varnish-cache/bin/varnishd/mgt_vcc.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: We clean the child process of unwanted open filedescriptors, but this can take time if there are hundreds of thousands of possible filedescriptors. Instead do it once, right at startup in the manager process, and then keep track of the fd's we use there, and have the child clean only up to the max seen, with an allowance for filedescriptors held by libraries (syslog, resolver, pidfiles etc) Fixes #699 Modified: trunk/varnish-cache/bin/varnishd/mgt.h =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt.h 2010-04-08 07:35:23 UTC (rev 4647) +++ trunk/varnish-cache/bin/varnishd/mgt.h 2010-04-08 08:09:43 UTC (rev 4648) @@ -46,6 +46,7 @@ extern pid_t child_pid; void MGT_Run(void); void mgt_stop_child(void); +void mgt_got_fd(int fd); /* mgt_cli.c */ Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-04-08 07:35:23 UTC (rev 4647) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-04-08 08:09:43 UTC (rev 4648) @@ -71,6 +71,7 @@ pid_t child_pid = -1; + static struct vbitmap *fd_map; static int child_cli_in = -1; @@ -98,6 +99,33 @@ static struct vlu *vlu; /*-------------------------------------------------------------------- + * Track the highest file descriptor the parent knows is being used. + * + * This allows the child process to clean/close only a small fraction + * of the possible file descriptors after exec(2). + * + * This is likely to a bit on the low side, as libc and other libraries + * has a tendency to cache file descriptors (syslog, resolver, etc.) + * so we add a margin of 100 fds. + */ + +static int mgt_max_fd; + +#define CLOSE_FD_UP_TO (mgt_max_fd + 100) + +void +mgt_got_fd(int fd) +{ + /* + * Assert > 0, to catch bogus opens, we know where stdin goes + * in the master process. + */ + assert(fd > 0); + if (fd > mgt_max_fd) + mgt_max_fd = fd; +} + +/*-------------------------------------------------------------------- * A handy little function */ @@ -270,7 +298,7 @@ unsigned u; char *p; struct vev *e; - int i, j, cp[2]; + int i, cp[2]; if (child_state != CH_STOPPED && child_state != CH_DIED) return; @@ -337,13 +365,10 @@ /* Close anything we shouldn't know about */ closelog(); - printf("Closed fds:"); - j = getdtablesize(); - for (i = STDERR_FILENO + 1; i < j; i++) { + for (i = STDERR_FILENO + 1; i < CLOSE_FD_UP_TO; i++) { if (vbit_test(fd_map, i)) continue; - if (close(i) == 0) - printf(" %d", i); + (void)(close(i) == 0); } printf("\n"); Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-08 07:35:23 UTC (rev 4647) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-08 08:09:43 UTC (rev 4648) @@ -301,6 +301,7 @@ cli_result(cli, CLIS_CANT); return; } + mgt_got_fd(fd); CLI_response(fd, cli->challenge, buf); AZ(close(fd)); if (strcasecmp(buf, av[2])) { @@ -488,6 +489,7 @@ if (i < 0) return (0); + mgt_got_fd(i); tn = telnet_new(i); vsb = sock_id("telnet", i); mgt_cli_setup(i, i, 0, vsb_data(vsb), telnet_close, tn); @@ -508,6 +510,7 @@ fprintf(stderr, "Can not open secret-file \"%s\"\n", S_arg); exit (2); } + mgt_got_fd(fd); i = read(fd, buf, sizeof buf); if (i == 0) { fprintf(stderr, "Empty secret-file \"%s\"\n", S_arg); @@ -623,6 +626,8 @@ if (s < 0) return (0); + mgt_got_fd(s); + M_conn = vev_new(); AN(M_conn); M_conn->callback = Marg_poker; Modified: trunk/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2010-04-08 07:35:23 UTC (rev 4647) +++ trunk/varnish-cache/bin/varnishd/mgt_vcc.c 2010-04-08 08:09:43 UTC (rev 4648) @@ -164,6 +164,7 @@ fprintf(stderr, "Cannot open %s", vp->sf); exit (1); } + mgt_got_fd(fd); l = strlen(csrc); i = write(fd, csrc, l); if (i != l) { Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2010-04-08 07:35:23 UTC (rev 4647) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2010-04-08 08:09:43 UTC (rev 4648) @@ -424,6 +424,15 @@ struct pidfh *pfh = NULL; char dirname[1024]; + /* + * Start out by closing all unwanted file descriptors we might + * have inherited from sloppy process control daemons. + */ + for (o = getdtablesize(); o > STDERR_FILENO; o--) + (void)close(o); + + mgt_got_fd(STDERR_FILENO); + setbuf(stdout, NULL); setbuf(stderr, NULL); From phk at varnish-cache.org Thu Apr 8 10:35:22 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 12:35:22 +0200 Subject: r4649 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-08 12:35:22 +0200 (Thu, 08 Apr 2010) New Revision: 4649 Modified: 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_backend_util.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_parse.c Log: Add a SkipToken() macro which does a ExpectErr() + vcc_NextToken(). Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -309,10 +309,8 @@ vcc_NextToken(tl); } - if (ae->para) { - ExpectErr(tl, ')'); - vcc_NextToken(tl); - } + if (ae->para) + SkipToken(tl, ')'); if (!vcc_acl_try_netnotation(tl, ae)) { ERRCHK(tl); @@ -504,17 +502,14 @@ vcc_AddDef(tl, an, R_ACL); bprintf(acln, "%.*s", PF(an)); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); while (tl->t->tok != '}') { vcc_acl_entry(tl); ERRCHK(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } - ExpectErr(tl, '}'); - vcc_NextToken(tl); + SkipToken(tl, '}'); vcc_acl_emit(tl, acln, 0); } Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -232,8 +232,7 @@ Fb(tl, 0, ");\n"); break; case HASH: - ExpectErr(tl, T_INCR); - vcc_NextToken(tl); + SkipToken(tl, T_INCR); if (!vcc_StringVal(tl)) { ERRCHK(tl); vcc_ExpectedStringval(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -259,8 +259,7 @@ "?initial", NULL); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); window = 0; threshold = 0; @@ -334,8 +333,7 @@ return; } - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } if (t_threshold != NULL || t_window != NULL) { @@ -376,8 +374,7 @@ if (status > 0) Fb(tl, 0, "\t\t.exp_status = %u,\n", status); Fb(tl, 0, "\t},\n"); - ExpectErr(tl, '}'); - vcc_NextToken(tl); + SkipToken(tl, '}'); } /*-------------------------------------------------------------------- @@ -415,8 +412,7 @@ NULL); t_first = tl->t; - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); vsb = vsb_newauto(); AN(vsb); @@ -451,49 +447,42 @@ assert(tl->t->dec != NULL); t_host = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "port")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_port = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "host_header")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_hosthdr = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { Fb(tl, 0, "\t.connect_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { Fb(tl, 0, "\t.first_byte_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { Fb(tl, 0, "\t.between_bytes_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); vcc_NextToken(tl); ERRCHK(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); Fb(tl, 0, "\t.max_connections = %u,\n", u); } else if (vcc_IdIs(t_field, "saintmode_threshold")) { u = vcc_UintVal(tl); @@ -510,8 +499,7 @@ vcc_NextToken(tl); ERRCHK(tl); saint = u; - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "probe")) { vcc_ParseProbe(tl); ERRCHK(tl); @@ -616,8 +604,7 @@ } vcc_AddRef(tl, h->name, R_BACKEND); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); *nm = h->vgcname; } else if (tl->t->tok == '{') { t = tl->t; @@ -721,13 +708,10 @@ vcc_ErrWhere(tl, tl->t_policy); return; } - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); dl->func(tl); - if (!tl->err) { - ExpectErr(tl, '}'); - vcc_NextToken(tl); - } + if (!tl->err) + SkipToken(tl, '}'); Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"%.*s\",\n", PF(tl->t_policy)); Modified: trunk/varnish-cache/lib/libvcl/vcc_backend_util.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend_util.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_backend_util.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -98,14 +98,12 @@ { struct token *t_field; - ExpectErr(tl, '.'); - vcc_NextToken(tl); + SkipToken(tl, '.'); ExpectErr(tl, ID); t_field = tl->t; *t = t_field; vcc_NextToken(tl); - ExpectErr(tl, '='); - vcc_NextToken(tl); + SkipToken(tl, '='); for (; fs->name != NULL; fs++) { if (!vcc_IdIs(t_field, fs->name + 1)) Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-08 10:35:22 UTC (rev 4649) @@ -242,4 +242,7 @@ #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) #define ErrInternal(tl) vcc__ErrInternal(tl, __func__, __LINE__) #define Expect(a, b) vcc__Expect(a, b, __LINE__) -#define ExpectErr(a, b) do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0) +#define ExpectErr(a, b) \ + do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0) +#define SkipToken(a, b) \ + do { vcc__Expect(a, b, __LINE__); ERRCHK(a); vcc_NextToken(a); } while (0) Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_random.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -70,8 +70,7 @@ retries = vcc_UintVal(tl); ERRCHK(tl); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else { ErrInternal(tl); } @@ -88,8 +87,7 @@ t_be = tl->t; vcc_ResetFldSpec(mfs); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ @@ -116,8 +114,7 @@ } Fc(tl, 0, "%s .weight = %u", first, u); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else { ErrInternal(tl); } Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -67,8 +67,7 @@ t_be = tl->t; vcc_ResetFldSpec(fs); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-08 08:09:43 UTC (rev 4648) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-08 10:35:22 UTC (rev 4649) @@ -344,8 +344,7 @@ if (tl->t->tok == '(') { vcc_NextToken(tl); Cond_0(tl); - ExpectErr(tl, ')'); - vcc_NextToken(tl); + SkipToken(tl, ')'); } else if (tl->t->tok == VAR) { vp = vcc_FindVar(tl, tl->t, vcc_vars); ERRCHK(tl); @@ -412,14 +411,12 @@ Conditional(struct tokenlist *tl) { - ExpectErr(tl, '('); - vcc_NextToken(tl); + SkipToken(tl, '('); Fb(tl, 1, "(\n"); L(tl, Cond_0(tl)); ERRCHK(tl); Fb(tl, 1, ")\n"); - ExpectErr(tl, ')'); - vcc_NextToken(tl); + SkipToken(tl, ')'); } /*--------------------------------------------------------------------*/ @@ -428,9 +425,8 @@ IfStmt(struct tokenlist *tl) { - ExpectErr(tl, T_IF); + SkipToken(tl, T_IF); Fb(tl, 1, "if \n"); - vcc_NextToken(tl); L(tl, Conditional(tl)); ERRCHK(tl); L(tl, Compound(tl)); @@ -469,11 +465,10 @@ { int i; - ExpectErr(tl, '{'); + SkipToken(tl, '{'); Fb(tl, 1, "{\n"); tl->indent += INDENT; C(tl, ";"); - vcc_NextToken(tl); while (1) { ERRCHK(tl); switch (tl->t->tok) { @@ -503,8 +498,7 @@ i = vcc_ParseAction(tl); ERRCHK(tl); if (i) { - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); break; } /* FALLTHROUGH */ From phk at varnish-cache.org Thu Apr 8 16:19:22 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 18:19:22 +0200 Subject: r4650 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-08 18:19:22 +0200 (Thu, 08 Apr 2010) New Revision: 4650 Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_esi.c trunk/varnish-cache/bin/varnishd/cache_http.c trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: Add a HTTP_Copy() function and use it for the "rollback" copy of req.* This was forgotten when number of HTTP headers was made dynamic. The lack of this function may have made ESI includes weird. Should be merged to 2.1 Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2010-04-08 10:35:22 UTC (rev 4649) +++ trunk/varnish-cache/bin/varnishd/cache.h 2010-04-08 16:19:22 UTC (rev 4650) @@ -135,6 +135,7 @@ HTTP_Obj = 3 }; +/* NB: remember to update http_Copy() if you add fields */ struct http { unsigned magic; #define HTTP_MAGIC 0x6428b5c9 @@ -514,6 +515,7 @@ /* cache_http.c */ unsigned HTTP_estimate(unsigned nhttp); +void HTTP_Copy(struct http *to, const struct http * const fm); struct http *HTTP_create(void *p, unsigned nhttp); const char *http_StatusMessage(unsigned); unsigned http_EstimateWS(const struct http *fm, unsigned how, unsigned *nhd); Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-08 10:35:22 UTC (rev 4649) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-08 16:19:22 UTC (rev 4650) @@ -1132,7 +1132,7 @@ sp->ws_req = WS_Snapshot(sp->ws); /* Catch original request, before modification */ - *sp->http0 = *sp->http; + HTTP_Copy(sp->http0, sp->http); if (done != 0) { sp->err_code = done; Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_esi.c 2010-04-08 10:35:22 UTC (rev 4649) +++ trunk/varnish-cache/bin/varnishd/cache_esi.c 2010-04-08 16:19:22 UTC (rev 4650) @@ -896,7 +896,7 @@ http_save = *sp->http; /* Reset request to status before we started messing with it */ - *sp->http = *sp->http0; + HTTP_Copy(sp->http, sp->http0); /* Take a workspace snapshot */ ws_wm = WS_Snapshot(sp->ws); Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2010-04-08 10:35:22 UTC (rev 4649) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2010-04-08 16:19:22 UTC (rev 4650) @@ -894,6 +894,22 @@ /*--------------------------------------------------------------------*/ +void +HTTP_Copy(struct http *to, const struct http * const fm) +{ + + to->conds = fm->conds; + to->logtag = fm->logtag; + to->status = fm->status; + to->protover = fm->protover; + to->nhd = fm->nhd; + assert(fm->nhd <= to->shd); + memcpy(to->hd, fm->hd, fm->nhd * sizeof *to->hd); + memcpy(to->hdf, fm->hdf, fm->nhd * sizeof *to->hdf); +} + +/*--------------------------------------------------------------------*/ + unsigned http_Write(struct worker *w, const struct http *hp, int resp) { Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-08 10:35:22 UTC (rev 4649) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-08 16:19:22 UTC (rev 4650) @@ -867,7 +867,7 @@ VRT_Rollback(struct sess *sp) { - *sp->http = *sp->http0; + HTTP_Copy(sp->http, sp->http0); WS_Reset(sp->ws, sp->ws_req); } From phk at varnish-cache.org Thu Apr 8 16:21:16 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 18:21:16 +0200 Subject: r4651 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-08 18:21:16 +0200 (Thu, 08 Apr 2010) New Revision: 4651 Modified: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc trunk/varnish-cache/bin/varnishtest/tests/c00024.vtc trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc trunk/varnish-cache/bin/varnishtest/tests/c00029.vtc trunk/varnish-cache/bin/varnishtest/tests/c00030.vtc trunk/varnish-cache/bin/varnishtest/tests/r00365.vtc trunk/varnish-cache/bin/varnishtest/tests/r00412.vtc trunk/varnish-cache/bin/varnishtest/tests/s00003.vtc trunk/varnish-cache/bin/varnishtest/tests/v00023.vtc Log: change "restart;" to "return(restart);" Modified: trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/b00019.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -19,7 +19,7 @@ varnish v1 -vcl+backend { sub vcl_fetch { - restart; + return (restart); } sub vcl_error { Modified: trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/c00009.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -25,7 +25,7 @@ sub vcl_fetch { if (beresp.status != 200) { - restart; + return (restart); } } } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/c00024.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00024.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/c00024.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -26,7 +26,7 @@ } sub vcl_error { if (req.restarts < 1) { - restart; + return (restart); } else { set obj.status = 201; } Modified: trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/c00028.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -11,7 +11,7 @@ set req.backend = bad; } sub vcl_error { - restart; + return (restart); } } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/c00029.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00029.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/c00029.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -36,7 +36,7 @@ sub vcl_fetch { if (beresp.http.X-Saint == "yes") { set beresp.saintmode = 20s; - restart; + return(restart); } set beresp.grace = 1h; set beresp.ttl = 1s; Modified: trunk/varnish-cache/bin/varnishtest/tests/c00030.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00030.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/c00030.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -43,7 +43,7 @@ sub vcl_fetch { if (beresp.http.X-Saint == "yes") { set beresp.saintmode = 20s; - restart; + return (restart); } set beresp.grace = 1h; set beresp.ttl = 1s; Modified: trunk/varnish-cache/bin/varnishtest/tests/r00365.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00365.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/r00365.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -14,7 +14,7 @@ varnish v1 -vcl+backend { sub vcl_hit { set obj.cacheable = false; - restart; + return (restart); } } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/r00412.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00412.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/r00412.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -18,13 +18,13 @@ set beresp.ttl = 60 s; set beresp.http.X-Magic-Redirect = "1"; set req.url = beresp.http.Location; - restart; + return (restart); } } sub vcl_hit { if (obj.http.X-Magic-Redirect == "1") { set req.url = obj.http.Location; - restart; + return (restart); } } } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/s00003.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/s00003.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/s00003.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -24,7 +24,7 @@ if (beresp.http.foo == "2") { set beresp.saintmode = 2s; - restart; + return (restart); } return(deliver); } Modified: trunk/varnish-cache/bin/varnishtest/tests/v00023.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00023.vtc 2010-04-08 16:19:22 UTC (rev 4650) +++ trunk/varnish-cache/bin/varnishtest/tests/v00023.vtc 2010-04-08 16:21:16 UTC (rev 4651) @@ -14,7 +14,7 @@ varnish v1 -vcl+backend { sub vcl_hit { set obj.ttl = 0s; - restart; + return (restart); } } -start From phk at varnish-cache.org Thu Apr 8 16:32:24 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 18:32:24 +0200 Subject: r4652 - in trunk/varnish-cache: bin/varnishtest/tests lib/libvcl Message-ID: Author: phk Date: 2010-04-08 18:32:24 +0200 (Thu, 08 Apr 2010) New Revision: 4652 Added: trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc Modified: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc trunk/varnish-cache/lib/libvcl/vcc_action.c Log: Make "rollback" its own action, it can be used anywhere. Make "restart" require "return(restart)" like all other terminating actions. Added: trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc 2010-04-08 16:32:24 UTC (rev 4652) @@ -0,0 +1,36 @@ +# $Id$ + +test "Test Rollback" + + +server s1 { + rxreq + expect req.url == "/foo" + expect req.http.foobar == "harck-coff" + txresp -status 400 + rxreq + expect req.url == "/bar" + expect req.http.foobar == "snark" + txresp -bodylen 5 +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + if (req.url == "/foo") { + set req.http.foobar = "harck-coff"; + } + } + + sub vcl_fetch { + if (beresp.status == 400) { + rollback; + set req.url = "/bar"; + return (restart); + } + } +} -start + +client c1 { + txreq -url "/foo" -hdr "foobar: snark" + rxresp +} -run Modified: trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc 2010-04-08 16:21:16 UTC (rev 4651) +++ trunk/varnish-cache/bin/varnishtest/tests/v00018.vtc 2010-04-08 16:32:24 UTC (rev 4652) @@ -4,15 +4,10 @@ varnish v1 -vcl { backend b { .host = "127.0.0.1"; } - sub vcl_hit { restart ; } - sub vcl_miss { restart rollback; } + sub vcl_hit { return (restart) ; } + sub vcl_miss { rollback; return (restart); } } -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 beresp.status ; } Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 16:21:16 UTC (rev 4651) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 16:32:24 UTC (rev 4652) @@ -47,27 +47,6 @@ /*--------------------------------------------------------------------*/ static void -parse_restart(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"); - vcc_NextToken(tl); - } else if (t1->tok != ';') { - vsb_printf(tl->sb, "Expected \"rollback\" or semicolon.\n"); - vcc_ErrWhere(tl, t1); - ERRCHK(tl); - } - Fb(tl, 1, "VRT_done(sp, VCL_RET_RESTART);\n"); - vcc_ProcAction(tl->curproc, VCL_RET_RESTART, tl->t); - vcc_NextToken(tl); -} - -/*--------------------------------------------------------------------*/ - -static void parse_call(struct tokenlist *tl) { @@ -239,11 +218,6 @@ return; } Fb(tl, 0, ");\n"); - /* - * We count the number of operations on the req.hash - * variable, so that varnishd can preallocate the worst case - * number of slots for composing the hash string. - */ break; case STRING: if (tl->t->tok != '=') { @@ -443,6 +417,17 @@ /*--------------------------------------------------------------------*/ static void +parse_new_syntax(struct tokenlist *tl) +{ + + vsb_printf(tl->sb, "Please change \"%.*s\" to \"return(%.*s)\".\n", + PF(tl->t), PF(tl->t)); + vcc_ErrWhere(tl, tl->t); +} + +/*--------------------------------------------------------------------*/ + +static void parse_panic(struct tokenlist *tl) { vcc_NextToken(tl); @@ -510,24 +495,12 @@ /*--------------------------------------------------------------------*/ -static void -parse_new_syntax(struct tokenlist *tl) -{ - - vsb_printf(tl->sb, "Please change \"%.*s\" to \"return(%.*s)\".\n", - PF(tl->t), PF(tl->t)); - vcc_ErrWhere(tl, tl->t); -} - -/*--------------------------------------------------------------------*/ - typedef void action_f(struct tokenlist *tl); static struct action_table { const char *name; action_f *func; } action_table[] = { - { "restart", parse_restart }, { "error", parse_error }, #define VCL_RET_MAC(l, U) \ @@ -542,10 +515,11 @@ { "purge", parse_purge }, { "purge_url", parse_purge_url }, { "remove", parse_unset }, /* backward compatibility */ + { "return", parse_return }, + { "rollback", parse_rollback }, { "set", parse_set }, { "synthetic", parse_synthetic }, { "unset", parse_unset }, - { "return", parse_return }, { NULL, NULL } }; From phk at varnish-cache.org Thu Apr 8 16:42:20 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 8 Apr 2010 18:42:20 +0200 Subject: r4653 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-08 18:42:20 +0200 (Thu, 08 Apr 2010) New Revision: 4653 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c Log: The rollback function fell out, stuff it in here once more. Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 16:32:24 UTC (rev 4652) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-08 16:42:20 UTC (rev 4653) @@ -478,6 +478,16 @@ /*--------------------------------------------------------------------*/ static void +parse_rollback(struct tokenlist *tl) +{ + + vcc_NextToken(tl); + Fb(tl, 1, "VRT_Rollback(sp);\n"); +} + +/*--------------------------------------------------------------------*/ + +static void parse_synthetic(struct tokenlist *tl) { vcc_NextToken(tl); From phk at varnish-cache.org Mon Apr 12 07:38:05 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 12 Apr 2010 09:38:05 +0200 Subject: r4654 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-12 09:38:05 +0200 (Mon, 12 Apr 2010) New Revision: 4654 Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c Log: Reject "auth" command if no -S argument given. Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-08 16:42:20 UTC (rev 4653) +++ trunk/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-12 07:38:05 UTC (rev 4654) @@ -293,7 +293,11 @@ AN(av[2]); (void)priv; - AN(secret_file); + if (secret_file == NULL) { + cli_out(cli, "Secret file not configured\n"); + cli_result(cli, CLIS_CANT); + return; + } fd = open(secret_file, O_RDONLY); if (fd < 0) { cli_out(cli, "Cannot open secret file (%s)\n", From phk at varnish-cache.org Tue Apr 13 07:41:09 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 09:41:09 +0200 Subject: r4655 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-13 09:41:08 +0200 (Tue, 13 Apr 2010) New Revision: 4655 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_backend.c trunk/varnish-cache/lib/libvcl/vcc_compile.h trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_var.c Log: Polish the variable/type system a little bit, to make life easier for Kristian, and to eliminate some code duplication. Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-12 07:38:05 UTC (rev 4654) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-13 07:41:08 UTC (rev 4655) @@ -156,23 +156,8 @@ case T_INCR: case T_DECR: case '=': - if (vp->fmt == TIME) - vcc_TimeVal(tl); - else if (vp->fmt == RTIME) - vcc_RTimeVal(tl); - else if (vp->fmt == SIZE) - vcc_SizeVal(tl); - else if (vp->fmt == FLOAT) - Fb(tl, 0, "%g", vcc_DoubleVal(tl)); - else if (vp->fmt == INT) { - Fb(tl, 0, "%u", vcc_UintVal(tl)); - vcc_NextToken(tl); - } else { - vsb_printf(tl->sb, - "Cannot assign this variable type.\n"); - vcc_ErrWhere(tl, vt); - return; - } + vcc_VarVal(tl, vp, vt); + ERRCHK(tl); break; default: vsb_printf(tl->sb, "Invalid assignment operator.\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-12 07:38:05 UTC (rev 4654) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-13 07:41:08 UTC (rev 4655) @@ -247,6 +247,7 @@ struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL; struct token *t_initial = NULL; unsigned window, threshold, initial, status; + double t; fs = vcc_FldSpec(tl, "?url", @@ -292,14 +293,14 @@ Fb(tl, 0, "\t\t\t\"\\r\\n\",\n"); } else if (vcc_IdIs(t_field, "timeout")) { Fb(tl, 0, "\t\t.timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "interval")) { Fb(tl, 0, "\t\t.interval = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "window")) { t_window = tl->t; window = vcc_UintVal(tl); @@ -396,6 +397,7 @@ struct fld_spec *fs; struct vsb *vsb; unsigned u; + double t; Fh(tl, 1, "\n#define VGC_backend_%s %d\n", vgcname, tl->ndirector); @@ -462,21 +464,21 @@ SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { Fb(tl, 0, "\t.connect_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { Fb(tl, 0, "\t.first_byte_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { Fb(tl, 0, "\t.between_bytes_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-12 07:38:05 UTC (rev 4654) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-13 07:41:08 UTC (rev 4655) @@ -196,9 +196,9 @@ /* vcc_parse.c */ void vcc_Parse(struct tokenlist *tl); -void vcc_RTimeVal(struct tokenlist *tl); -void vcc_TimeVal(struct tokenlist *tl); -void vcc_SizeVal(struct tokenlist *tl); +void vcc_RTimeVal(struct tokenlist *tl, double *); +void vcc_TimeVal(struct tokenlist *tl, double *); +void vcc_SizeVal(struct tokenlist *tl, double *); unsigned vcc_UintVal(struct tokenlist *tl); double vcc_DoubleVal(struct tokenlist *tl); @@ -226,6 +226,8 @@ /* vcc_var.c */ struct var *vcc_FindVar(struct tokenlist *tl, const struct token *t, struct var *vl); +void vcc_VarVal(struct tokenlist *tl, const struct var *vp, + const struct token *vt); /* vcc_xref.c */ void vcc_AddDef(struct tokenlist *tl, struct token *t, enum ref_type type); Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-12 07:38:05 UTC (rev 4654) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-13 07:41:08 UTC (rev 4655) @@ -123,6 +123,7 @@ /*-------------------------------------------------------------------- * Recognize and convert { CNUM } to unsigned value + * The tokenizer made sure we only get digits. */ unsigned @@ -141,6 +142,7 @@ /*-------------------------------------------------------------------- * Recognize and convert { CNUM [ '.' [ CNUM ] ] } to double value + * The tokenizer made sure we only get digits and a '.' */ double @@ -171,7 +173,7 @@ /*--------------------------------------------------------------------*/ void -vcc_RTimeVal(struct tokenlist *tl) +vcc_RTimeVal(struct tokenlist *tl, double *d) { double v, sc; int sign = 1; @@ -184,11 +186,13 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = TimeUnit(tl); - Fb(tl, 0, "(%d * %g * %g)", sign, v, sc); + *d = sign * v * sc; } +/*--------------------------------------------------------------------*/ + void -vcc_TimeVal(struct tokenlist *tl) +vcc_TimeVal(struct tokenlist *tl, double *d) { double v, sc; @@ -196,11 +200,13 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = TimeUnit(tl); - Fb(tl, 0, "(%g * %g)", v, sc); + *d = v * sc; } +/*--------------------------------------------------------------------*/ + void -vcc_SizeVal(struct tokenlist *tl) +vcc_SizeVal(struct tokenlist *tl, double *d) { double v, sc; @@ -208,7 +214,7 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = SizeUnit(tl); - Fb(tl, 0, "(%g * %g)", v, sc); + *d = v * sc; } /*--------------------------------------------------------------------*/ @@ -261,28 +267,8 @@ case '<': Fb(tl, 0, "%.*s ", PF(tl->t)); vcc_NextToken(tl); - switch(vp->fmt) { - case TIME: - vcc_TimeVal(tl); - break; - case RTIME: - vcc_RTimeVal(tl); - break; - case INT: - ExpectErr(tl, CNUM); - Fb(tl, 0, "%.*s ", PF(tl->t)); - vcc_NextToken(tl); - break; - case SIZE: - vcc_SizeVal(tl); - break; - default: - vsb_printf(tl->sb, - "No conditions available for variable '%s'\n", - vp->name); - vcc_ErrWhere(tl, tl->t); - return; - } + vcc_VarVal(tl, vp, NULL); + ERRCHK(tl); Fb(tl, 0, "\n"); break; default: Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-12 07:38:05 UTC (rev 4654) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-13 07:41:08 UTC (rev 4655) @@ -110,3 +110,35 @@ return (NULL); } +/*--------------------------------------------------------------------*/ + +void +vcc_VarVal(struct tokenlist *tl, const struct var *vp, const struct token *vt) +{ + double d; + + if (vp->fmt == TIME) { + vcc_TimeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == RTIME) { + vcc_RTimeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == SIZE) { + vcc_SizeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == FLOAT) { + Fb(tl, 0, "%g", vcc_DoubleVal(tl)); + } else if (vp->fmt == INT) { + Fb(tl, 0, "%u", vcc_UintVal(tl)); + vcc_NextToken(tl); + } else { + AN(vt); + vsb_printf(tl->sb, + "Variable has incompatible type.\n"); + vcc_ErrWhere(tl, vt); + return; + } +} From phk at varnish-cache.org Tue Apr 13 09:06:37 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 11:06:37 +0200 Subject: r4656 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-13 11:06:37 +0200 (Tue, 13 Apr 2010) New Revision: 4656 Modified: 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_dir_random.c trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_var.c Log: Make vcc_UintVal() behave like the other ..Val() functions and consume its token. Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -306,7 +306,6 @@ ae->t_mask = tl->t; ExpectErr(tl, CNUM); ae->mask = vcc_UintVal(tl); - vcc_NextToken(tl); } if (ae->para) Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -80,7 +80,6 @@ } } else if (tl->t->tok == CNUM) { Fb(tl, 1, "VRT_error(sp, %u", vcc_UintVal(tl)); - vcc_NextToken(tl); } else Fb(tl, 1, "VRT_error(sp, 0"); if (tl->t->tok == CSTR) { Modified: trunk/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -304,12 +304,10 @@ } else if (vcc_IdIs(t_field, "window")) { t_window = tl->t; window = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "initial")) { t_initial = tl->t; initial = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "expected_response")) { status = vcc_UintVal(tl); @@ -320,12 +318,10 @@ vcc_ErrWhere(tl, tl->t); return; } - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "threshold")) { t_threshold = tl->t; threshold = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else { vcc_ErrToken(tl, t_field); @@ -482,7 +478,6 @@ SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); SkipToken(tl, ';'); Fb(tl, 0, "\t.max_connections = %u,\n", u); @@ -498,7 +493,6 @@ vsb_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); } - vcc_NextToken(tl); ERRCHK(tl); saint = u; SkipToken(tl, ';'); Modified: trunk/varnish-cache/lib/libvcl/vcc_dir_random.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -69,7 +69,6 @@ ExpectErr(tl, CNUM); retries = vcc_UintVal(tl); ERRCHK(tl); - vcc_NextToken(tl); SkipToken(tl, ';'); } else { ErrInternal(tl); @@ -113,7 +112,6 @@ return; } Fc(tl, 0, "%s .weight = %u", first, u); - vcc_NextToken(tl); SkipToken(tl, ';'); } else { ErrInternal(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -137,6 +137,7 @@ d *= 10; d += *p - '0'; } + vcc_NextToken(tl); return (d); } Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-13 07:41:08 UTC (rev 4655) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-13 09:06:37 UTC (rev 4656) @@ -133,7 +133,6 @@ Fb(tl, 0, "%g", vcc_DoubleVal(tl)); } else if (vp->fmt == INT) { Fb(tl, 0, "%u", vcc_UintVal(tl)); - vcc_NextToken(tl); } else { AN(vt); vsb_printf(tl->sb, From phk at varnish-cache.org Tue Apr 13 21:05:12 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 23:05:12 +0200 Subject: r4657 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-13 23:05:11 +0200 (Tue, 13 Apr 2010) New Revision: 4657 Modified: trunk/varnish-cache/bin/varnishd/cache.h Log: Add some semi-magic functions to align pointers with. Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2010-04-13 09:06:37 UTC (rev 4656) +++ trunk/varnish-cache/bin/varnishd/cache.h 2010-04-13 21:05:11 UTC (rev 4657) @@ -95,6 +95,15 @@ #define DIGEST_LEN 32 +/*-------------------------------------------------------------------- + * Pointer aligment magic + */ + +#define PALGN (sizeof(void *) - 1) +#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) +#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) +#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) + /*--------------------------------------------------------------------*/ typedef struct { From phk at varnish-cache.org Tue Apr 13 21:06:16 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 23:06:16 +0200 Subject: r4658 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-13 23:06:16 +0200 (Tue, 13 Apr 2010) New Revision: 4658 Modified: trunk/varnish-cache/bin/varnishd/cache_http.c Log: Round up estimate of HTTP header space to alow for alignment of allocations in workspace. Modified: trunk/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_http.c 2010-04-13 21:05:11 UTC (rev 4657) +++ trunk/varnish-cache/bin/varnishd/cache_http.c 2010-04-13 21:06:16 UTC (rev 4658) @@ -679,7 +679,7 @@ continue; #include "http_headers.h" #undef HTTPH - l += Tlen(fm->hd[u]) + 1; + l += PRNDUP(Tlen(fm->hd[u]) + 1); (*nhd)++; // fm->hdf[u] |= HDF_COPY; } From phk at varnish-cache.org Tue Apr 13 21:07:02 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 23:07:02 +0200 Subject: r4659 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-13 23:07:01 +0200 (Tue, 13 Apr 2010) New Revision: 4659 Modified: trunk/varnish-cache/bin/varnishd/stevedore.c Log: Align pointers in allocated objects to pointer boundaries. Modified: trunk/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-13 21:06:16 UTC (rev 4658) +++ trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-13 21:07:01 UTC (rev 4659) @@ -95,6 +95,9 @@ memset(o, 0, sizeof *o); o->magic = OBJECT_MAGIC; + assert(PAOK(wsl)); + assert(PAOK(lhttp)); + o->http = HTTP_create(o + 1, nhttp); WS_Init(o->ws_o, "obj", (char *)(o + 1) + lhttp, wsl); WS_Assert(o->ws_o); @@ -118,8 +121,10 @@ (void)ttl; assert(l > 0); + l = PRNDUP(l); lh = HTTP_estimate(nhttp); + lh = PRNDUP(lh); if (!sp->wrk->cacheable) { o = malloc(sizeof *o + l + lh); @@ -135,7 +140,10 @@ o = (void *)st->ptr; /* XXX: align ? */ - STV_InitObj(sp, o, st->space - (sizeof *o + lh), lh, nhttp); + l = PRNDDN(st->space - (sizeof *o + lh)); + + + STV_InitObj(sp, o, l, lh, nhttp); o->objstore = st; return (o); } From phk at varnish-cache.org Tue Apr 13 21:07:39 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 13 Apr 2010 23:07:39 +0200 Subject: r4660 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-13 23:07:39 +0200 (Tue, 13 Apr 2010) New Revision: 4660 Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c Log: Align all workspace allocations on pointer boundaries. Add plenty of asserts until we see that the world don't end. Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2010-04-13 21:07:01 UTC (rev 4659) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2010-04-13 21:07:39 UTC (rev 4660) @@ -57,13 +57,17 @@ ws->r == NULL ? 0 : pdiff(ws->f, ws->r), pdiff(ws->s, ws->e)); assert(ws->s != NULL); + // assert(PAOK(ws->s)); assert(ws->e != NULL); + // assert(PAOK(ws->e)); assert(ws->s < ws->e); assert(ws->f >= ws->s); assert(ws->f <= ws->e); + // assert(PAOK(ws->f)); if (ws->r) { assert(ws->r > ws->s); assert(ws->r <= ws->e); + // assert(PAOK(ws->r)); } } @@ -77,7 +81,9 @@ memset(ws, 0, sizeof *ws); ws->magic = WS_MAGIC; ws->s = space; + assert(PAOK(space)); ws->e = ws->s + len; + assert(PAOK(len)); ws->f = ws->s; ws->id = id; WS_Assert(ws); @@ -101,6 +107,7 @@ assert(p < ws->e); ws->f = p; } + WS_Assert(ws); } char * @@ -109,14 +116,18 @@ char *r; WS_Assert(ws); + bytes = PRNDUP(bytes); + assert(ws->r == NULL); if (ws->f + bytes > ws->e) { ws->overflow++; + WS_Assert(ws); return(NULL); } r = ws->f; ws->f += bytes; DSL(0x02, SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r); + WS_Assert(ws); return (r); } @@ -126,11 +137,13 @@ unsigned l; char *p; + WS_Assert(ws); l = strlen(s) + 1; p = WS_Alloc(ws, l); if (p != NULL) memcpy(p, s, l); DSL(0x02, SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p); + WS_Assert(ws); return (p); } @@ -155,16 +168,20 @@ unsigned WS_Reserve(struct ws *ws, unsigned bytes) { - unsigned b2 = bytes; + unsigned b2; WS_Assert(ws); assert(ws->r == NULL); if (bytes == 0) b2 = ws->e - ws->f; + else + b2 = bytes; + // b2 = PRNDND(b2); xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", ws, b2, bytes, pdiff(ws->f, ws->r)); + WS_Assert(ws); return (pdiff(ws->f, ws->r)); } @@ -172,12 +189,14 @@ WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); + // bytes = PRNDUP(bytes); assert(bytes <= ws->e - ws->f); DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); assert(ws->f + bytes <= ws->r); ws->f += bytes; ws->r = NULL; + WS_Assert(ws); } void @@ -188,8 +207,10 @@ assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); - ws->f = ptr; + // ws->f += PRNDUP(ptr - ws->f); + ws->f += (ptr - ws->f); ws->r = NULL; + WS_Assert(ws); } #if 0 From phk at varnish-cache.org Thu Apr 15 07:13:51 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 15 Apr 2010 09:13:51 +0200 Subject: r4661 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-15 09:13:51 +0200 (Thu, 15 Apr 2010) New Revision: 4661 Modified: trunk/varnish-cache/bin/varnishd/common.h trunk/varnish-cache/bin/varnishd/shmlog.c trunk/varnish-cache/bin/varnishd/varnishd.c Log: We need to update the master-process pid in the shmlog after we daemon()'ize. Spotted by: Mark Moseley Modified: trunk/varnish-cache/bin/varnishd/common.h =================================================================== --- trunk/varnish-cache/bin/varnishd/common.h 2010-04-13 21:07:39 UTC (rev 4660) +++ trunk/varnish-cache/bin/varnishd/common.h 2010-04-15 07:13:51 UTC (rev 4661) @@ -43,6 +43,7 @@ /* shmlog.c */ void VSL_MgtInit(const char *fn, unsigned size); +void VSL_MgtPid(void); extern struct varnish_stats *VSL_stats; /* varnishd.c */ Modified: trunk/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- trunk/varnish-cache/bin/varnishd/shmlog.c 2010-04-13 21:07:39 UTC (rev 4660) +++ trunk/varnish-cache/bin/varnishd/shmlog.c 2010-04-15 07:13:51 UTC (rev 4661) @@ -413,3 +413,10 @@ *pp = *params; params = pp; } + +void +VSL_MgtPid(void) +{ + + loghead->master_pid = getpid(); +} Modified: trunk/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.c 2010-04-13 21:07:39 UTC (rev 4660) +++ trunk/varnish-cache/bin/varnishd/varnishd.c 2010-04-15 07:13:51 UTC (rev 4661) @@ -674,6 +674,8 @@ if (!d_flag && !F_flag) AZ(varnish_daemon(1, 0)); + VSL_MgtPid(); + if (pfh != NULL && vpf_write(pfh)) fprintf(stderr, "NOTE: Could not write PID file\n"); From phk at varnish-cache.org Thu Apr 15 07:33:45 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 15 Apr 2010 09:33:45 +0200 Subject: r4662 - in trunk/varnish-cache/bin: varnishd varnishtest varnishtest/tests Message-ID: Author: phk Date: 2010-04-15 09:33:44 +0200 (Thu, 15 Apr 2010) New Revision: 4662 Added: trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc trunk/varnish-cache/bin/varnishtest/vtc_http.c Log: We converted HEAD to GET in vcl_recv{}, that is far too early, since it also affects pipe and pass processing. Move the HEAD->GET override to vcl_miss{} and do it on the bereq.* so we do not tamper with the original request. Fixes: #679 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-15 07:13:51 UTC (rev 4661) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-15 07:33:44 UTC (rev 4662) @@ -866,6 +866,7 @@ sp->wrk->bereq = sp->wrk->http[0]; http_Setup(sp->wrk->bereq, sp->wrk->ws); http_FilterHeader(sp, HTTPH_R_FETCH); + http_ForceGet(sp->wrk->bereq); sp->wrk->connect_timeout = 0; sp->wrk->first_byte_timeout = 0; sp->wrk->between_bytes_timeout = 0; @@ -1050,10 +1051,9 @@ assert(sp->handling == VCL_RET_HASH); SHA256_Final(sp->digest, sp->wrk->sha256ctx); - if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) { + if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) sp->wantbody = 0; - http_ForceGet(sp->http); - } else + else sp->wantbody = 1; sp->sendbody = 0; Modified: trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-15 07:13:51 UTC (rev 4661) +++ trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-15 07:33:44 UTC (rev 4662) @@ -11,6 +11,8 @@ varnish v1 -arg "-smalloc,1m" -vcl+backend {} -start +varnish v1 -cliok "param.set diag_bitmap 0x2" + varnish v1 -expect n_object == 0 varnish v1 -expect client_conn == 0 varnish v1 -expect client_req == 0 Added: trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc 2010-04-15 07:33:44 UTC (rev 4662) @@ -0,0 +1,16 @@ +# $Id$ + +test "pass + HEAD" + +server s1 { + rxreq + expect req.request == "HEAD" + txresp +} -start + +varnish v1 -vcl+backend {} -start + +client c1 { + txreq -req HEAD -hdr "Cookie: foo=bar" + rxresp -no_obj +} -run Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-15 07:13:51 UTC (rev 4661) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-15 07:33:44 UTC (rev 4662) @@ -467,6 +467,7 @@ cmd_http_rxresp(CMD_ARGS) { struct http *hp; + int has_obj = 1; (void)cmd; (void)vl; @@ -476,11 +477,17 @@ av++; for(; *av != NULL; av++) - vtc_log(hp->vl, 0, "Unknown http rxresp spec: %s\n", *av); + if (!strcmp(*av, "-no_obj")) + has_obj = 0; + else + vtc_log(hp->vl, 0, + "Unknown http rxresp spec: %s\n", *av); vtc_log(hp->vl, 3, "rxresp"); http_rxhdr(hp); http_splitheader(hp, 0); - if (!strcmp(hp->resp[1], "200")) + if (!has_obj) + ; + else if (!strcmp(hp->resp[1], "200")) http_swallow_body(hp, hp->resp, 1); else http_swallow_body(hp, hp->resp, 0); From kristian at varnish-cache.org Thu Apr 15 12:01:56 2010 From: kristian at varnish-cache.org (kristian at varnish-cache.org) Date: Thu, 15 Apr 2010 14:01:56 +0200 Subject: r4663 - in trunk/varnish-cache: . bin bin/varnishsizes Message-ID: Author: kristian Date: 2010-04-15 14:01:56 +0200 (Thu, 15 Apr 2010) New Revision: 4663 Added: trunk/varnish-cache/bin/varnishsizes/ trunk/varnish-cache/bin/varnishsizes/Makefile.am trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 trunk/varnish-cache/bin/varnishsizes/varnishsizes.c Modified: trunk/varnish-cache/bin/Makefile.am trunk/varnish-cache/configure.ac Log: Add varnishsizes, which is varnishhist for the Length-header Though it works fine, varnishhist and *sizes should probably be merged together at some point. Modified: trunk/varnish-cache/bin/Makefile.am =================================================================== --- trunk/varnish-cache/bin/Makefile.am 2010-04-15 07:33:44 UTC (rev 4662) +++ trunk/varnish-cache/bin/Makefile.am 2010-04-15 12:01:56 UTC (rev 4663) @@ -3,5 +3,5 @@ SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay varnishtest if HAVE_CURSES -SUBDIRS += varnishhist varnishstat varnishtop +SUBDIRS += varnishhist varnishstat varnishtop varnishsizes endif Added: trunk/varnish-cache/bin/varnishsizes/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishsizes/Makefile.am (rev 0) +++ trunk/varnish-cache/bin/varnishsizes/Makefile.am 2010-04-15 12:01:56 UTC (rev 4663) @@ -0,0 +1,16 @@ +# $Id$ + +INCLUDES = -I$(top_srcdir)/include + +bin_PROGRAMS = varnishsizes + +dist_man_MANS = varnishsizes.1 + +varnishsizes_SOURCES = varnishsizes.c + +varnishsizes_LDADD = \ + $(top_builddir)/lib/libvarnish/libvarnish.la \ + $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ + $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ + -lm \ + ${CURSES_LIBS} ${PTHREAD_LIBS} Added: trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 =================================================================== --- trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 (rev 0) +++ trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 2010-04-15 12:01:56 UTC (rev 4663) @@ -0,0 +1,151 @@ +.\"- +.\" Copyright (c) 2006 Verdens Gang AS +.\" Copyright (c) 2006-2009 Linpro AS +.\" All rights reserved. +.\" +.\" Author: Dag-Erling Sm?rgrav +.\" +.\" 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 June 28, 2007 +.Dt VARNISHSIZES 1 +.Os +.Sh NAME +.Nm varnishsizes +.Nd Varnish request histogram +.Sh SYNOPSIS +.Nm +.Op Fl b +.Op Fl C +.Op Fl c +.Op Fl d +.Op Fl I Ar regex +.Op Fl i Ar tag +.Op Fl n Ar varnish_name +.Op Fl r Ar file +.Op Fl V +.Op Fl w Ar delay +.Op Fl X Ar regex +.Op Fl x Ar tag +.Sh DESCRIPTION +The +.Nm +utility reads +.Xr varnishd 1 +shared memory logs and presents a continuously updated histogram +showing the distribution of the last +.Va N +requests by their processing. +The value of +.Va N +and the vertical scale are displayed in the top left corner. +The horizontal scale is logarithmic. +Hits are marked with a pipe character ("|"), and misses are marked +with a hash character ("#"). +.Pp +The following options are available: +.Bl -tag -width Fl +.It Fl b +Include log entries which result from communication with a backend +server. +If neither +.Fl b +nor +.Fl c +is specified, +.Nm +acts as if they both were. +.It Fl C +Ignore case when matching regular expressions. +.It Fl c +Include log entries which result from communication with a client. +If neither +.Fl b +nor +.Fl c +is specified, +.Nm +acts as if they both were. +.It Fl d +Process old log entries on startup. +Normally, +.Nm +will only process entries which are written to the log after it +starts. +.It Fl I Ar regex +Include log entries which match the specified regular expression. +If neither +.Fl I +nor +.Fl i +is specified, all log entries are included. +.It Fl i Ar tag +Include log entries with the specified tag. +If neither +.Fl I +nor +.Fl i +is specified, all log entries are included. +.It Fl n +Specifies the name of the +.Nm varnishd +instance to get logs from. +If +.Fl n +is not specified, the host name is used. +.It Fl r Ar file +Read log entries from +.Ar file +instead of shared memory. +.It Fl V +Display the version number and exit. +.It Fl w Ar delay +Wait at least +.Ar delay +seconds between each update. +The default is 1. +.Ar file +instead of displaying them. +The file will be overwritten unless the +.Fl a +option was specified. +.It Fl X Ar regex +Exclude log entries which match the specified regular expression. +.It Fl x Ar tag +Exclude log entries with the specified tag. +.El +.Sh SEE ALSO +.Xr varnishd 1 , +.Xr varnishlog 1 , +.Xr varnishncsa 1 , +.Xr varnishstat 1 , +.Xr varnishtop 1 +.Sh SIZESORY +The +.Nm +utility 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 Dag-Erling Sm\(/orgrav Aq des at des.no . Added: trunk/varnish-cache/bin/varnishsizes/varnishsizes.c =================================================================== --- trunk/varnish-cache/bin/varnishsizes/varnishsizes.c (rev 0) +++ trunk/varnish-cache/bin/varnishsizes/varnishsizes.c 2010-04-15 12:01:56 UTC (rev 4663) @@ -0,0 +1,353 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2009 Linpro AS + * All rights reserved. + * + * Author: Poul-Henning Kamp + * Author: Dag-Erling Sm?rgrav + * + * 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. + * + * Log tailer for Varnish + */ + +#include "config.h" + +#include "svnid.h" +SVNID("$Id$") + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "libvarnish.h" +#include "shmlog.h" +#include "varnishapi.h" + +#define HIST_N 2000 /* how far back we remember */ +#define HIST_LOW 1 /* low end of log range */ +#define HIST_HIGH 8 /* high end of log range */ +#define HIST_RANGE (HIST_HIGH - HIST_LOW) +#define HIST_RES 100 /* bucket resolution */ +#define HIST_BUCKETS (HIST_RANGE * HIST_RES) + +static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER; + +static int delay = 1; +static unsigned rr_hist[HIST_N]; +static unsigned nhist; +static unsigned next_hist; +static unsigned bucket_miss[HIST_BUCKETS]; +static unsigned bucket_hit[HIST_BUCKETS]; +static unsigned char hh[FD_SETSIZE]; + +static double log_ten; + +static int scales[] = { + 1, + 2, + 3, + 4, + 5, + 10, + 15, + 20, + 25, + 50, + 100, + 250, + 500, + 1000, + 2500, + 5000, + 10000, + 25000, + 50000, + 100000, + INT_MAX +}; + +static void +update(void) +{ + int w = COLS / HIST_RANGE; + int n = w * HIST_RANGE; + unsigned bm[n], bh[n]; + unsigned max; + int i, j, scale; + + erase(); + + /* Draw horizontal axis */ + w = COLS / HIST_RANGE; + n = w * HIST_RANGE; + for (i = 0; i < n; ++i) + mvaddch(LINES - 2, i, '-'); + for (i = 0, j = HIST_LOW; i < HIST_RANGE; ++i, ++j) { + mvaddch(LINES - 2, w * i, '+'); + mvprintw(LINES - 1, w * i, "|1e%d", j); + } + + mvprintw(0, 0, "%*s", COLS - 1, VSL_Name()); + + /* count our flock */ + for (i = 0; i < n; ++i) + bm[i] = bh[i] = 0; + for (i = 0, max = 1; i < HIST_BUCKETS; ++i) { + j = i * n / HIST_BUCKETS; + bm[j] += bucket_miss[i]; + bh[j] += bucket_hit[i]; + if (bm[j] + bh[j] > max) + max = bm[j] + bh[j]; + } + + /* scale */ + for (i = 0; max / scales[i] > LINES - 3; ++i) + /* nothing */ ; + scale = scales[i]; + + mvprintw(0, 0, "1:%d, n = %d", scale, nhist); + + /* show them */ + for (i = 0; i < n; ++i) { + for (j = 0; j < bm[i] / scale; ++j) + mvaddch(LINES - 3 - j, i, '#'); + for (; j < (bm[i] + bh[i]) / scale; ++j) + mvaddch(LINES - 3 - j, i, '|'); + } + + refresh(); +} + +static int +h_hist(void *priv, enum shmlogtag tag, unsigned fd, unsigned len, + unsigned spec, const char *ptr) +{ + double b; + int i, j, tmp; + + (void)priv; + (void)len; + (void)spec; + + if (fd >= FD_SETSIZE) + /* oops */ + return (0); + + if (tag == SLT_Hit) { + hh[fd] = 1; + return (0); + } + if (tag != SLT_Length) + return (0); + + /* determine processing time */ + i = sscanf(ptr, "%d", &tmp); + assert(i == 1); + + /* Typically 304s and tend to throw the scaling off */ + if (tmp == 0) + return 0; + + b = tmp; + /* select bucket */ + i = HIST_RES * (log(b) / log_ten); + if (i < HIST_LOW * HIST_RES) + i = HIST_LOW * HIST_RES; + if (i >= HIST_HIGH * HIST_RES) + i = HIST_HIGH * HIST_RES - 1; + i -= HIST_LOW * HIST_RES; + assert(i >= 0); + assert(i < HIST_BUCKETS); + + pthread_mutex_lock(&mtx); + + /* phase out old data */ + if (nhist == HIST_N) { + j = rr_hist[next_hist]; + if (j < 0) { + assert(bucket_miss[-j] > 0); + bucket_miss[-j]--; + } else { + assert(bucket_hit[j] > 0); + bucket_hit[j]--; + } + } else { + ++nhist; + } + + /* phase in new data */ + if (hh[fd] || i == 0) { + bucket_hit[i]++; + rr_hist[next_hist] = i; + } else { + bucket_miss[i]++; + rr_hist[next_hist] = -i; + } + if (++next_hist == HIST_N) { + next_hist = 0; + } + hh[fd] = 0; + + pthread_mutex_unlock(&mtx); + + return (0); +} + +static void * +accumulate_thread(void *arg) +{ + struct VSL_data *vd = arg; + int i; + + for (;;) { + i = VSL_Dispatch(vd, h_hist, NULL); + if (i < 0) + break; + if (i == 0) + usleep(50000); + } + return (arg); +} + +static void +do_curses(struct VSL_data *vd) +{ + pthread_t thr; + int ch; + + if (pthread_create(&thr, NULL, accumulate_thread, vd) != 0) { + fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); + exit(1); + } + + initscr(); + raw(); + noecho(); + nonl(); + intrflush(stdscr, FALSE); + curs_set(0); + erase(); + for (;;) { + pthread_mutex_lock(&mtx); + update(); + pthread_mutex_unlock(&mtx); + + timeout(delay * 1000); + switch ((ch = getch())) { + case ERR: + break; +#ifdef KEY_RESIZE + case KEY_RESIZE: + erase(); + break; +#endif + case '\014': /* Ctrl-L */ + case '\024': /* Ctrl-T */ + redrawwin(stdscr); + refresh(); + break; + case '\003': /* Ctrl-C */ + raise(SIGINT); + break; + case '\032': /* Ctrl-Z */ + endwin(); + raise(SIGTSTP); + break; + case '\021': /* Ctrl-Q */ + case 'Q': + case 'q': + endwin(); + return; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + delay = 1 << (ch - '0'); + break; + default: + beep(); + break; + } + } +} + +/*--------------------------------------------------------------------*/ + +static void +usage(void) +{ + fprintf(stderr, "usage: varnishsizes " + "%s [-n varnish_name] [-V] [-w delay]\n", VSL_USAGE); + exit(1); +} + +int +main(int argc, char **argv) +{ + int o; + struct VSL_data *vd; + const char *n_arg = NULL; + + vd = VSL_New(); + + while ((o = getopt(argc, argv, VSL_ARGS "n:Vw:")) != -1) { + switch (o) { + case 'n': + n_arg = optarg; + break; + case 'V': + varnish_version("varnishsizes"); + exit(0); + case 'w': + delay = atoi(optarg); + break; + default: + if (VSL_Arg(vd, o, optarg) > 0) + break; + usage(); + } + } + + if (VSL_OpenLog(vd, n_arg)) + exit(1); + + log_ten = log(10.0); + + do_curses(vd); + exit(0); +} Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2010-04-15 07:33:44 UTC (rev 4662) +++ trunk/varnish-cache/configure.ac 2010-04-15 12:01:56 UTC (rev 4663) @@ -449,6 +449,7 @@ bin/varnishncsa/Makefile bin/varnishreplay/Makefile bin/varnishstat/Makefile + bin/varnishsizes/Makefile bin/varnishtest/Makefile bin/varnishtop/Makefile doc/Makefile From ingvar at varnish-cache.org Thu Apr 15 14:04:11 2010 From: ingvar at varnish-cache.org (ingvar at varnish-cache.org) Date: Thu, 15 Apr 2010 16:04:11 +0200 Subject: r4664 - trunk/varnish-cache/redhat Message-ID: Author: ingvar Date: 2010-04-15 16:04:11 +0200 (Thu, 15 Apr 2010) New Revision: 4664 Modified: trunk/varnish-cache/redhat/varnish.spec trunk/varnish-cache/redhat/varnish.sysconfig Log: Added the -S option as default in the redhat package Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2010-04-15 12:01:56 UTC (rev 4663) +++ trunk/varnish-cache/redhat/varnish.spec 2010-04-15 14:04:11 UTC (rev 4664) @@ -1,22 +1,22 @@ Summary: High-performance HTTP accelerator Name: varnish -Version: 2.0.7 -Release: 0.1svn20100201r4527%{?dist} +Version: 2.1.1 +Release: 0.svn20100415%{?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 -#BuildRequires: automake autoconf libtool +BuildRequires: automake autoconf libtool BuildRequires: ncurses-devel libxslt groff pcre-devel pkgconfig Requires: varnish-libs = %{version}-%{release} Requires: logrotate Requires: ncurses +Requires: pcre Requires(pre): shadow-utils -Requires(post): /sbin/chkconfig +Requires(post): /sbin/chkconfig, /usr/bin/mkpasswd Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service Requires(preun): initscripts @@ -61,15 +61,13 @@ #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 -#./autogen.sh +./autogen.sh -#%patch0 - # Hack to get 32- and 64-bits tests run concurrently on the same build machine case `uname -m` in ppc64 | s390x | x86_64 | sparc64 ) @@ -101,6 +99,11 @@ %configure --disable-static --localstatedir=/var/lib %endif +# Have to regenerate the docs because of patched doc/changes-2.0.6-2.1.0.xml +pushd doc/ +make clean +popd + # We have to remove rpath - not allowed in Fedora # (This problem only visible on 64 bit arches) sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g; @@ -144,9 +147,6 @@ %endif %endif -# p class checks are still unstable -rm bin/varnishtest/tests/p*.vtc - 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" @@ -234,6 +234,7 @@ /sbin/chkconfig --add varnish /sbin/chkconfig --add varnishlog /sbin/chkconfig --add varnishncsa +test -f /etc/varnish/secret || (mkpasswd > /etc/varnish/secret && chmod 0600 /etc/varnish/secret) %preun if [ $1 -lt 1 ]; then @@ -250,10 +251,19 @@ %postun libs -p /sbin/ldconfig %changelog -* Mon Jan 25 2010 Ingvar Hagelund - 2.0.7-0.1 -- changes-2.0.6.html works now, so remove fix -- Added pcre-devel and pkgconfig to the build requirements +* Wed Apr 14 2010 Ingvar Hagelund - 2.1.0-2 +- Added a patch from svn that fixes changes-2.0.6-2.1.0.xml +* Tue Apr 06 2010 Ingvar Hagelund - 2.1.0-1 +- New upstream release; note: Configuration changes, see the README +- Removed unneeded patches +- CVE-2009-2936: Added a patch from Debian that adds the -S option + to the varnisdh(1) manpage and to the sysconfig defaults, thus + password-protecting the admin interface port (#579536,#579533) +- Generates that password in the post script, requires mkpasswd +- Added a patch from Robert Scheck for explicit linking to libm +- Requires pcre + * Wed Dec 23 2009 Ingvar Hagelund - 2.0.6-2 - Added a test that enables jemalloc on ppc if the kernel is not a rhel5 kernel (as on redhat builders) Modified: trunk/varnish-cache/redhat/varnish.sysconfig =================================================================== --- trunk/varnish-cache/redhat/varnish.sysconfig 2010-04-15 12:01:56 UTC (rev 4663) +++ trunk/varnish-cache/redhat/varnish.sysconfig 2010-04-15 14:04:11 UTC (rev 4664) @@ -38,6 +38,7 @@ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -u varnish -g varnish \ + -S /etc/varnish/secret \ -s file,/var/lib/varnish/varnish_storage.bin,1G" From phk at varnish-cache.org Fri Apr 16 07:59:28 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 16 Apr 2010 09:59:28 +0200 Subject: r4665 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-16 09:59:28 +0200 (Fri, 16 Apr 2010) New Revision: 4665 Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c Log: Add vcc_ prefixes to a bunch of static functions. Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-15 14:04:11 UTC (rev 4664) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-16 07:59:28 UTC (rev 4665) @@ -43,8 +43,8 @@ /*--------------------------------------------------------------------*/ -static void Compound(struct tokenlist *tl); -static void Cond_0(struct tokenlist *tl); +static void vcc_Compound(struct tokenlist *tl); +static void vcc_Cond_0(struct tokenlist *tl); /*--------------------------------------------------------------------*/ @@ -64,7 +64,7 @@ */ static double -TimeUnit(struct tokenlist *tl) +vcc_TimeUnit(struct tokenlist *tl) { double sc = 1.0; @@ -97,7 +97,7 @@ */ static double -SizeUnit(struct tokenlist *tl) +vcc_SizeUnit(struct tokenlist *tl) { double sc = 1.0; @@ -186,7 +186,7 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = TimeUnit(tl); + sc = vcc_TimeUnit(tl); *d = sign * v * sc; } @@ -200,7 +200,7 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = TimeUnit(tl); + sc = vcc_TimeUnit(tl); *d = v * sc; } @@ -214,14 +214,14 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = SizeUnit(tl); + sc = vcc_SizeUnit(tl); *d = v * sc; } /*--------------------------------------------------------------------*/ static void -Cond_String(const struct var *vp, struct tokenlist *tl) +vcc_Cond_String(const struct var *vp, struct tokenlist *tl) { char *p; @@ -255,7 +255,7 @@ } static void -Cond_Int(const struct var *vp, struct tokenlist *tl) +vcc_Cond_Int(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s ", vp->rname); @@ -284,14 +284,14 @@ } static void -Cond_Bool(const struct var *vp, const struct tokenlist *tl) +vcc_Cond_Bool(const struct var *vp, const struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); } static void -Cond_Backend(const struct var *vp, struct tokenlist *tl) +vcc_Cond_Backend(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); @@ -317,7 +317,7 @@ } static void -Cond_2(struct tokenlist *tl) +vcc_Cond_2(struct tokenlist *tl) { struct var *vp; @@ -330,7 +330,7 @@ } if (tl->t->tok == '(') { vcc_NextToken(tl); - Cond_0(tl); + vcc_Cond_0(tl); SkipToken(tl, ')'); } else if (tl->t->tok == VAR) { vp = vcc_FindVar(tl, tl->t, vcc_vars); @@ -338,14 +338,14 @@ assert(vp != NULL); vcc_NextToken(tl); switch (vp->fmt) { - case INT: L(tl, Cond_Int(vp, tl)); break; - case SIZE: L(tl, Cond_Int(vp, tl)); break; - case BOOL: L(tl, Cond_Bool(vp, tl)); break; + case INT: L(tl, vcc_Cond_Int(vp, tl)); break; + case SIZE: L(tl, vcc_Cond_Int(vp, tl)); break; + case BOOL: L(tl, vcc_Cond_Bool(vp, tl)); break; case IP: L(tl, vcc_Cond_Ip(vp, tl)); break; - case STRING: L(tl, Cond_String(vp, tl)); break; - case TIME: L(tl, Cond_Int(vp, tl)); break; - case RTIME: L(tl, Cond_Int(vp, tl)); break; - case BACKEND: L(tl, Cond_Backend(vp, tl)); break; + case STRING: L(tl, vcc_Cond_String(vp, tl)); break; + case TIME: L(tl, vcc_Cond_Int(vp, tl)); break; + case RTIME: L(tl, vcc_Cond_Int(vp, tl)); break; + case BACKEND: L(tl, vcc_Cond_Backend(vp, tl)); break; default: vsb_printf(tl->sb, "Variable '%s'" @@ -367,40 +367,40 @@ } static void -Cond_1(struct tokenlist *tl) +vcc_Cond_1(struct tokenlist *tl) { Fb(tl, 1, "(\n"); - L(tl, Cond_2(tl)); + L(tl, vcc_Cond_2(tl)); while (tl->t->tok == T_CAND) { vcc_NextToken(tl); Fb(tl, 1, ") && (\n"); - L(tl, Cond_2(tl)); + L(tl, vcc_Cond_2(tl)); } Fb(tl, 1, ")\n"); } static void -Cond_0(struct tokenlist *tl) +vcc_Cond_0(struct tokenlist *tl) { Fb(tl, 1, "(\n"); - L(tl, Cond_1(tl)); + L(tl, vcc_Cond_1(tl)); while (tl->t->tok == T_COR) { vcc_NextToken(tl); Fb(tl, 1, ") || (\n"); - L(tl, Cond_1(tl)); + L(tl, vcc_Cond_1(tl)); } Fb(tl, 1, ")\n"); } static void -Conditional(struct tokenlist *tl) +vcc_Conditional(struct tokenlist *tl) { SkipToken(tl, '('); Fb(tl, 1, "(\n"); - L(tl, Cond_0(tl)); + L(tl, vcc_Cond_0(tl)); ERRCHK(tl); Fb(tl, 1, ")\n"); SkipToken(tl, ')'); @@ -409,14 +409,14 @@ /*--------------------------------------------------------------------*/ static void -IfStmt(struct tokenlist *tl) +vcc_IfStmt(struct tokenlist *tl) { SkipToken(tl, T_IF); Fb(tl, 1, "if \n"); - L(tl, Conditional(tl)); + L(tl, vcc_Conditional(tl)); ERRCHK(tl); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); while (1) { switch (tl->t->tok) { @@ -424,7 +424,7 @@ vcc_NextToken(tl); if (tl->t->tok != T_IF) { Fb(tl, 1, "else \n"); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); return; } @@ -433,9 +433,9 @@ case T_ELSIF: Fb(tl, 1, "else if \n"); vcc_NextToken(tl); - L(tl, Conditional(tl)); + L(tl, vcc_Conditional(tl)); ERRCHK(tl); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); break; default: @@ -448,7 +448,7 @@ /*--------------------------------------------------------------------*/ static void -Compound(struct tokenlist *tl) +vcc_Compound(struct tokenlist *tl) { int i; @@ -460,10 +460,10 @@ ERRCHK(tl); switch (tl->t->tok) { case '{': - Compound(tl); + vcc_Compound(tl); break; case T_IF: - IfStmt(tl); + vcc_IfStmt(tl); break; case '}': vcc_NextToken(tl); @@ -502,7 +502,7 @@ /*--------------------------------------------------------------------*/ static void -Function(struct tokenlist *tl) +vcc_Function(struct tokenlist *tl) { int m; @@ -534,7 +534,7 @@ vcc_NextToken(tl); tl->indent += INDENT; Fb(tl, 1, "{\n"); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); if (m == -1) { /* * non-method subroutines must have an explicit non-action @@ -564,7 +564,7 @@ parse_f *func; } toplev[] = { { "acl", vcc_Acl }, - { "sub", Function }, + { "sub", vcc_Function }, { "backend", vcc_ParseDirector }, { "director", vcc_ParseDirector }, { NULL, NULL } From phk at varnish-cache.org Fri Apr 16 09:40:54 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 16 Apr 2010 11:40:54 +0200 Subject: r4666 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-16 11:40:54 +0200 (Fri, 16 Apr 2010) New Revision: 4666 Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c Log: Oops: Last commit to this file didn't actually get the changes it advertized: Align all WS allocations. Modified: trunk/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_ws.c 2010-04-16 07:59:28 UTC (rev 4665) +++ trunk/varnish-cache/bin/varnishd/cache_ws.c 2010-04-16 09:40:54 UTC (rev 4666) @@ -57,17 +57,17 @@ ws->r == NULL ? 0 : pdiff(ws->f, ws->r), pdiff(ws->s, ws->e)); assert(ws->s != NULL); - // assert(PAOK(ws->s)); + assert(PAOK(ws->s)); assert(ws->e != NULL); - // assert(PAOK(ws->e)); + assert(PAOK(ws->e)); assert(ws->s < ws->e); assert(ws->f >= ws->s); assert(ws->f <= ws->e); - // assert(PAOK(ws->f)); + assert(PAOK(ws->f)); if (ws->r) { assert(ws->r > ws->s); assert(ws->r <= ws->e); - // assert(PAOK(ws->r)); + assert(PAOK(ws->r)); } } @@ -176,7 +176,7 @@ b2 = ws->e - ws->f; else b2 = bytes; - // b2 = PRNDND(b2); + b2 = PRNDDN(b2); xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", @@ -189,7 +189,7 @@ WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); - // bytes = PRNDUP(bytes); + bytes = PRNDUP(bytes); assert(bytes <= ws->e - ws->f); DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); @@ -207,8 +207,7 @@ assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); - // ws->f += PRNDUP(ptr - ws->f); - ws->f += (ptr - ws->f); + ws->f += PRNDUP(ptr - ws->f); ws->r = NULL; WS_Assert(ws); } From phk at varnish-cache.org Fri Apr 16 09:58:02 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 16 Apr 2010 11:58:02 +0200 Subject: r4667 - in trunk/varnish-cache: bin/varnishd include lib/libvcl Message-ID: Author: phk Date: 2010-04-16 11:58:02 +0200 (Fri, 16 Apr 2010) New Revision: 4667 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/bin/varnishd/hash_slinger.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_obj.c Log: Carry out a bit of internal renaming, and recognize that it was a really bad idea to call "bans" for "purges" some places. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-16 09:58:02 UTC (rev 4667) @@ -937,7 +937,7 @@ /*--------------------------------------------------------------------*/ void -VRT_purge(struct sess *sp, char *cmds, ...) +VRT_ban(struct sess *sp, char *cmds, ...) { char *a1, *a2, *a3; va_list ap; @@ -972,7 +972,7 @@ /*--------------------------------------------------------------------*/ void -VRT_purge_string(struct sess *sp, const char *str, ...) +VRT_ban_string(struct sess *sp, const char *str, ...) { char *p, *a1, *a2, *a3; char **av; Modified: trunk/varnish-cache/bin/varnishd/hash_slinger.h =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_slinger.h 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/bin/varnishd/hash_slinger.h 2010-04-16 09:58:02 UTC (rev 4667) @@ -64,6 +64,7 @@ void HSH_DerefObjCore(struct sess *sp); void HSH_FindBan(struct sess *sp, struct objcore **oc); struct objcore *HSH_Insert(const struct sess *sp); +void HSH_Purge(struct sess *, struct objhead *, double ttl, double grace); #ifdef VARNISH_CACHE_CHILD Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/include/vrt.h 2010-04-16 09:58:02 UTC (rev 4667) @@ -136,8 +136,8 @@ void *, const char *); void VRT_panic(struct sess *sp, const char *, ...); -void VRT_purge(struct sess *sp, char *, ...); -void VRT_purge_string(struct sess *sp, const char *, ...); +void VRT_ban(struct sess *sp, char *, ...); +void VRT_ban_string(struct sess *sp, const char *, ...); void VRT_count(const struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-16 09:58:02 UTC (rev 4667) @@ -299,7 +299,7 @@ vcc_NextToken(tl); if (tl->t->tok == VAR) { - Fb(tl, 1, "VRT_purge(sp,\n"); + Fb(tl, 1, "VRT_ban(sp,\n"); tl->indent += INDENT; while (1) { ExpectErr(tl, VAR); @@ -353,7 +353,7 @@ Fb(tl, 1, "0);\n"); tl->indent -= INDENT; } else { - Fb(tl, 1, "VRT_purge_string(sp, "); + Fb(tl, 1, "VRT_ban_string(sp, "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; @@ -378,7 +378,7 @@ Expect(tl, '('); vcc_NextToken(tl); - Fb(tl, 1, "VRT_purge(sp, \"req.url\", \"~\", "); + Fb(tl, 1, "VRT_ban(sp, \"req.url\", \"~\", "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-16 09:58:02 UTC (rev 4667) @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17:38:59Z tfheen $ * * NB: This file is machine generated, DO NOT EDIT! * @@ -159,9 +159,10 @@ /* ../../include/vcl.h */ - vsb_cat(sb, "/*\n * $Id$\n *\n * NB: This file is machine generate"); - vsb_cat(sb, "d, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_tok"); - vsb_cat(sb, "en.tcl instead\n */\n\nstruct sess;\n"); + vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17"); + vsb_cat(sb, ":38:59Z tfheen $\n *\n * NB: This file is machine gen"); + vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe"); + vsb_cat(sb, "d_token.tcl 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"); @@ -226,16 +227,16 @@ 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"); - vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id$\n *\n"); - vsb_cat(sb, " * Runtime support for compiled VCL programs.\n"); - vsb_cat(sb, " *\n * XXX: When this file is changed, lib/libvcl/vcc_"); - vsb_cat(sb, "gen_fixed_token.tcl\n * XXX: *MUST* be rerun.\n"); - vsb_cat(sb, " */\n\nstruct sess;\nstruct vsb;\n"); - vsb_cat(sb, "struct cli;\nstruct director;\n"); - vsb_cat(sb, "struct VCL_conf;\nstruct sockaddr;\n"); - vsb_cat(sb, "\n/*\n * A backend probe specification\n"); - vsb_cat(sb, " */\n\nextern const void * const vrt_magic_string_end;"); - vsb_cat(sb, "\n\nstruct vrt_backend_probe {\n"); + vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4428 2010-01-06 17:"); + vsb_cat(sb, "38:59Z tfheen $\n *\n * Runtime support for compiled V"); + vsb_cat(sb, "CL programs.\n *\n * XXX: When this file is changed, l"); + vsb_cat(sb, "ib/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 const void * const vrt_magic_string_"); + vsb_cat(sb, "end;\n\nstruct vrt_backend_probe {\n"); vsb_cat(sb, "\tconst char\t*url;\n\tconst char\t*request;\n"); vsb_cat(sb, "\tdouble\t\ttimeout;\n\tdouble\t\tinterval;\n"); vsb_cat(sb, "\tunsigned\texp_status;\n\tunsigned\twindow;\n"); @@ -278,10 +279,10 @@ 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 *, ...);\n"); - vsb_cat(sb, "void VRT_purge(struct sess *sp, char *, ...);\n"); - vsb_cat(sb, "void VRT_purge_string(struct sess *sp, const char *, ."); - vsb_cat(sb, "..);\n\nvoid VRT_count(const struct sess *, unsigned);"); - vsb_cat(sb, "\nint VRT_rewrite(const char *, const char *);\n"); + vsb_cat(sb, "void VRT_ban(struct sess *sp, char *, ...);\n"); + vsb_cat(sb, "void VRT_ban_string(struct sess *sp, const char *, ..."); + vsb_cat(sb, ");\n\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"); @@ -311,25 +312,27 @@ /* ../../include/vrt_obj.h */ - vsb_cat(sb, "/*\n * $Id$\n *\n * NB: This file is machine generate"); - vsb_cat(sb, "d, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_tok"); - vsb_cat(sb, "en.tcl instead\n */\n\nstruct sockaddr * VRT_r_client_"); - vsb_cat(sb, "ip(const struct sess *);\nstruct sockaddr * VRT_r_serv"); - vsb_cat(sb, "er_ip(struct sess *);\nconst char * VRT_r_server_hostn"); - vsb_cat(sb, "ame(struct sess *);\nconst char * VRT_r_server_identit"); - vsb_cat(sb, "y(struct sess *);\nint VRT_r_server_port(struct sess *"); - vsb_cat(sb, ");\nconst char * VRT_r_req_request(const struct sess *"); - vsb_cat(sb, ");\nvoid VRT_l_req_request(const struct sess *, const "); - vsb_cat(sb, "char *, ...);\nconst char * VRT_r_req_url(const struct"); - vsb_cat(sb, " sess *);\nvoid VRT_l_req_url(const struct sess *, con"); - vsb_cat(sb, "st char *, ...);\nconst char * VRT_r_req_proto(const s"); - vsb_cat(sb, "truct sess *);\nvoid VRT_l_req_proto(const struct sess"); - vsb_cat(sb, " *, const char *, ...);\nvoid VRT_l_req_hash(struct se"); - vsb_cat(sb, "ss *, const char *);\nstruct director * VRT_r_req_back"); - vsb_cat(sb, "end(struct sess *);\nvoid VRT_l_req_backend(struct ses"); - vsb_cat(sb, "s *, struct director *);\nint VRT_r_req_restarts(const"); - vsb_cat(sb, " struct sess *);\ndouble VRT_r_req_grace(struct sess *"); - vsb_cat(sb, ");\nvoid VRT_l_req_grace(struct sess *, double);\n"); + vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17"); + vsb_cat(sb, ":38:59Z tfheen $\n *\n * NB: This file is machine gen"); + vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe"); + vsb_cat(sb, "d_token.tcl instead\n */\n\nstruct sockaddr * VRT_r_cl"); + vsb_cat(sb, "ient_ip(const struct sess *);\n"); + vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_server_hostname(struct sess *);\n"); + vsb_cat(sb, "const char * VRT_r_server_identity(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"); + 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, "unsigned VRT_r_req_esi(struct sess *);\n"); vsb_cat(sb, "void VRT_l_req_esi(struct sess *, unsigned);\n"); Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-16 09:40:54 UTC (rev 4666) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-16 09:58:02 UTC (rev 4667) @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17:38:59Z tfheen $ * * NB: This file is machine generated, DO NOT EDIT! * From phk at varnish-cache.org Fri Apr 16 10:24:59 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 16 Apr 2010 12:24:59 +0200 Subject: r4668 - in trunk/varnish-cache: bin/varnishd bin/varnishtest/tests include lib/libvcl Message-ID: Author: phk Date: 2010-04-16 12:24:59 +0200 (Fri, 16 Apr 2010) New Revision: 4668 Added: trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_vrt.c trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Add a, for now, unsupported & experimental facility. See test-case for details. Modified: trunk/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_hash.c 2010-04-16 09:58:02 UTC (rev 4667) +++ trunk/varnish-cache/bin/varnishd/cache_hash.c 2010-04-16 10:24:59 UTC (rev 4668) @@ -308,6 +308,8 @@ return (oc); } +/********************************************************************** + */ struct objcore * HSH_Lookup(struct sess *sp, struct objhead **poh) @@ -353,8 +355,8 @@ VTAILQ_FOREACH(oc, &oh->objcs, list) { /* Must be at least our own ref + the objcore we examine */ assert(oh->refcnt > 1); + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->objhead == oh); - CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); if (oc->flags & OC_F_PERSISTENT) SMP_Fixup(sp, oh, oc); @@ -455,6 +457,9 @@ return (oc); } +/********************************************************************** + */ + static void hsh_rush(struct objhead *oh) { @@ -483,6 +488,56 @@ } /********************************************************************** + * Purge an entire objhead + */ + +void +HSH_Purge(struct sess *sp, struct objhead *oh, double ttl, double grace) +{ + struct objcore *oc, **ocp; + unsigned spc, nobj, n; + struct object *o; + + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); + spc = WS_Reserve(sp->wrk->ws, 0); + ocp = (void*)sp->wrk->ws->f; + Lck_Lock(&oh->mtx); + assert(oh->refcnt > 0); + nobj = 0; + VTAILQ_FOREACH(oc, &oh->objcs, list) { + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + assert(oc->objhead == oh); + + if (oc->flags & OC_F_PERSISTENT) + SMP_Fixup(sp, oh, oc); + + xxxassert(spc >= sizeof *ocp); + oc->refcnt++; + spc -= sizeof *ocp; + ocp[nobj++] = oc; + } + Lck_Unlock(&oh->mtx); + + if (ttl <= 0) + ttl = -1; + for (n = 0; n < nobj; n++) { + oc = ocp[n]; + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + o = oc->obj; + if (o == NULL) + continue; + CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); + o->ttl = sp->t_req + ttl; + if (!isnan(grace)) + o->grace = grace; + EXP_Rearm(o); + HSH_Deref(sp->wrk, &o); + } + WS_Release(sp->wrk->ws, 0); +} + + +/********************************************************************** * Kill a busy object we don't need anyway. * There may be sessions on the waiting list, so we cannot just blow * it out of the water. Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-16 09:58:02 UTC (rev 4667) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-16 10:24:59 UTC (rev 4668) @@ -1024,6 +1024,19 @@ } /*-------------------------------------------------------------------- + * "real" purges + */ + +void +VRT_purge(struct sess *sp, double ttl, double grace) +{ + if (sp->cur_method == VCL_MET_HIT) + HSH_Purge(sp, sp->obj->objcore->objhead, ttl, grace); + else if (sp->cur_method == VCL_MET_MISS) + HSH_Purge(sp, sp->objcore->objhead, ttl, grace); +} + +/*-------------------------------------------------------------------- * Simple stuff */ Added: trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc 2010-04-16 10:24:59 UTC (rev 4668) @@ -0,0 +1,89 @@ +# $Id$ + +test "real purges" + +server s1 { + rxreq + txresp -hdr "Vary: foo" -bodylen 1 + rxreq + txresp -hdr "Vary: foo" -bodylen 2 + rxreq + txresp -hdr "Vary: foo" -bodylen 3 + rxreq + txresp -hdr "Vary: foo" -bodylen 4 + rxreq + txresp -hdr "Vary: foo" -bodylen 5 + rxreq + txresp -hdr "Vary: foo" -bodylen 6 +} -start + +varnish v1 -vcl+backend { + + sub vcl_recv { + if (req.request == "PURGE") { + return (lookup); + } + } + + sub vcl_hit { + if (req.request == "PURGE") { + C{ VRT_purge(sp, 0, 0); }C + error 456 "got it"; + } + } + sub vcl_miss { + if (req.request == "PURGE") { + C{ VRT_purge(sp, 0, 0); }C + error 456 "got it"; + } + } +} -start + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 1 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 2 + + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 1 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 2 + + txreq -req "PURGE" -hdr "foo: bar1" + rxresp + expect resp.status == 456 +} -run + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 3 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 4 + + txreq -req "PURGE" -hdr "foo: bar3" + rxresp + expect resp.status == 456 +} -run + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 5 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 6 + +} -run + + Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2010-04-16 09:58:02 UTC (rev 4667) +++ trunk/varnish-cache/include/vrt.h 2010-04-16 10:24:59 UTC (rev 4668) @@ -138,6 +138,7 @@ void VRT_panic(struct sess *sp, const char *, ...); void VRT_ban(struct sess *sp, char *, ...); void VRT_ban_string(struct sess *sp, const char *, ...); +void VRT_purge(struct sess *sp, double ttl, double grace); void VRT_count(const struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-16 09:58:02 UTC (rev 4667) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-16 10:24:59 UTC (rev 4668) @@ -227,10 +227,10 @@ 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"); - vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4428 2010-01-06 17:"); - vsb_cat(sb, "38:59Z tfheen $\n *\n * Runtime support for compiled V"); - vsb_cat(sb, "CL programs.\n *\n * XXX: When this file is changed, l"); - vsb_cat(sb, "ib/libvcl/vcc_gen_fixed_token.tcl\n"); + vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4667 2010-04-16 09:"); + vsb_cat(sb, "58:02Z 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"); @@ -281,8 +281,9 @@ vsb_cat(sb, "\nvoid VRT_panic(struct sess *sp, const char *, ...);\n"); vsb_cat(sb, "void VRT_ban(struct sess *sp, char *, ...);\n"); vsb_cat(sb, "void VRT_ban_string(struct sess *sp, const char *, ..."); - vsb_cat(sb, ");\n\nvoid VRT_count(const struct sess *, unsigned);\n"); - vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n"); + vsb_cat(sb, ");\nvoid VRT_purge(struct sess *sp, double ttl, double"); + vsb_cat(sb, " grace);\n\nvoid VRT_count(const struct sess *, unsign"); + vsb_cat(sb, "ed);\nint 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"); From tfheen at varnish-cache.org Mon Apr 19 06:20:47 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 08:20:47 +0200 Subject: r4669 - trunk/varnish-cache/man Message-ID: Author: tfheen Date: 2010-04-19 08:20:46 +0200 (Mon, 19 Apr 2010) New Revision: 4669 Modified: trunk/varnish-cache/man/vcl.7so Log: Document that TTL is no longer taken into account for beresp.cacheable Modified: trunk/varnish-cache/man/vcl.7so =================================================================== --- trunk/varnish-cache/man/vcl.7so 2010-04-16 10:24:59 UTC (rev 4668) +++ trunk/varnish-cache/man/vcl.7so 2010-04-19 06:20:46 UTC (rev 4669) @@ -586,13 +586,8 @@ .It Va obj.cacheable True if the request resulted in a cacheable response. .\" see cache_center.c and rfc2616.c for details -A response is considered cacheable if it is valid (see above), the -HTTP status code is 200, 203, 300, 301, 302, 404 or 410 and it has a -non-zero time-to-live when -.Cm Expires -and -.Cm Cache-Control -headers are taken into account. +A response is considered cacheable if it is valid (see above), and the +HTTP status code is 200, 203, 300, 301, 302, 404 or 410. .It Va obj.ttl The object's remaining time to live, in seconds. .It Va obj.lastuse From phk at varnish-cache.org Mon Apr 19 09:59:19 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 19 Apr 2010 11:59:19 +0200 Subject: r4670 - trunk/varnish-cache/include Message-ID: Author: phk Date: 2010-04-19 11:59:19 +0200 (Mon, 19 Apr 2010) New Revision: 4670 Modified: trunk/varnish-cache/include/vct.h Log: Add vct_isdigit() Modified: trunk/varnish-cache/include/vct.h =================================================================== --- trunk/varnish-cache/include/vct.h 2010-04-19 06:20:46 UTC (rev 4669) +++ trunk/varnish-cache/include/vct.h 2010-04-19 09:59:19 UTC (rev 4670) @@ -55,6 +55,7 @@ #define vct_iscrlf(x) vct_is(x, VCT_CRLF) #define vct_islws(x) vct_is(x, VCT_LWS) #define vct_isctl(x) vct_is(x, VCT_CTL) +#define vct_isdigit(x) vct_is(x, VCT_DIGIT) #define vct_isalpha(x) vct_is(x, VCT_ALPHA) #define vct_issep(x) vct_is(x, VCT_SEPARATOR) #define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL) From tfheen at varnish-cache.org Mon Apr 19 10:19:46 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 12:19:46 +0200 Subject: r4671 - in branches/2.1: . varnish-cache/bin/varnishadm varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 12:19:46 +0200 (Mon, 19 Apr 2010) New Revision: 4671 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishadm/varnishadm.c branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt_pool.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c Log: Merge r4637: White-space fixups Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4640 + /trunk:4637,4640 Modified: branches/2.1/varnish-cache/bin/varnishadm/varnishadm.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishadm/varnishadm.c 2010-04-19 09:59:19 UTC (rev 4670) +++ branches/2.1/varnish-cache/bin/varnishadm/varnishadm.c 2010-04-19 10:19:46 UTC (rev 4671) @@ -169,7 +169,7 @@ assert(i > 0); if (fds[0].revents & POLLIN) { n = read(fds[0].fd, buf, sizeof buf); - if (n == 0) + if (n == 0) exit (0); if (n < 0) { perror("Read error reading CLI socket"); @@ -241,9 +241,9 @@ assert(T_arg != NULL); sock = cli_sock(T_arg, S_arg); - if (argc > 0) + if (argc > 0) do_args(sock, argc, argv); - else + else pass(sock); exit(0); Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_pool.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_pool.c 2010-04-19 09:59:19 UTC (rev 4670) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_pool.c 2010-04-19 10:19:46 UTC (rev 4671) @@ -68,7 +68,7 @@ } /*-------------------------------------------------------------------- - * This is utterly ridiculous: POSIX does not guarantee that the + * This is utterly ridiculous: POSIX does not guarantee that the * minimum thread stack size is a compile time constant. * XXX: "32" is a magic marker for 32bit systems. */ Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishd/vparam.h:4637 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/include/vct.h:4637 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/include/vev.h:4637 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/lib/libvarnish/vev.c:4637 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 09:59:19 UTC (rev 4670) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 10:19:46 UTC (rev 4671) @@ -569,7 +569,7 @@ /*-------------------------------------------------------------------- * Top level of parser, recognize: - * Inline C-code + * Inline C-code * ACL definitions * Function definitions * Backend & Director definitions From tfheen at varnish-cache.org Mon Apr 19 10:26:23 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 12:26:23 +0200 Subject: r4672 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/doc varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 12:26:23 +0200 (Mon, 19 Apr 2010) New Revision: 4672 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/doc/changes-2.0.6-2.1.0.xml branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4643: Fix syntax errors, add some more changes Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640 + /trunk:4637,4640,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643 Modified: branches/2.1/varnish-cache/doc/changes-2.0.6-2.1.0.xml =================================================================== --- branches/2.1/varnish-cache/doc/changes-2.0.6-2.1.0.xml 2010-04-19 10:19:46 UTC (rev 4671) +++ branches/2.1/varnish-cache/doc/changes-2.0.6-2.1.0.xml 2010-04-19 10:26:23 UTC (rev 4672) @@ -48,7 +48,7 @@ When closing connections, we experimented with sending RST to free up load balancers and free up threads more quickly. This caused some problems with NAT routers and so has been - reverted for now. + reverted for now. @@ -176,7 +176,7 @@ purge.hash is now deprecated and no longer - shown in help listings.. + shown in help listings. @@ -298,11 +298,19 @@ Exit at the end of the file when started with -d. + + + varnishadm -varnishadm: - - timeout support - - secret support - - handle cli banner + + varnishadm can now have a timeout when trying + to connect to the running varnishd. + + + varnishadm now knows how to respond to the + secret from a secured varnishd + + Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637 + /trunk/varnish-cache/include/vct.h:4637,4643 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637 + /trunk/varnish-cache/include/vev.h:4637,4643 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643 From tfheen at varnish-cache.org Mon Apr 19 10:41:52 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 12:41:52 +0200 Subject: r4673 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 12:41:52 +0200 (Mon, 19 Apr 2010) New Revision: 4673 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/e00003.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4644: Add another client cycle, to make sure there is no difference between miss/hit ESI processing Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643 + /trunk:4637,4640,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4644 Modified: branches/2.1/varnish-cache/bin/varnishtest/tests/e00003.vtc =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/e00003.vtc 2010-04-19 10:26:23 UTC (rev 4672) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/e00003.vtc 2010-04-19 10:41:52 UTC (rev 4673) @@ -29,6 +29,11 @@ rxresp expect resp.bodylen == 65 expect resp.status == 200 + # test that there is no difference on miss/hit + txreq + rxresp + expect resp.bodylen == 65 + expect resp.status == 200 } client c1 -run Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643 + /trunk/varnish-cache/include/vct.h:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643 + /trunk/varnish-cache/include/vev.h:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4644 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4644 From tfheen at varnish-cache.org Mon Apr 19 10:47:25 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 12:47:25 +0200 Subject: r4674 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 12:47:25 +0200 (Mon, 19 Apr 2010) New Revision: 4674 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt_param.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4645: Fix formatting mistake, add explanation. 2.1 candidate Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4644 + /trunk:4637,4640,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4644 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4644 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-19 10:41:52 UTC (rev 4673) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-19 10:47:25 UTC (rev 4674) @@ -548,9 +548,11 @@ { "default_grace", tweak_uint, &master.default_grace, 0, UINT_MAX, "Default grace period. We will deliver an object " "this long after it has expired, provided another thread " - "is attempting to get a new copy.", + "is attempting to get a new copy.\n" + "Objects already cached will not be affected by changes " + "made until they are fetched from the backend again.\n", DELAYED_EFFECT, - "10" "seconds" }, + "10", "seconds" }, { "sess_timeout", tweak_timeout, &master.sess_timeout, 0, 0, "Idle timeout for persistent sessions. " "If a HTTP request has not been received in this many " Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4644 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4644 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4644 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4644 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4644 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4644 + /trunk/varnish-cache/include/vct.h:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4644 + /trunk/varnish-cache/include/vev.h:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4644 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4644 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4644 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645 From tfheen at varnish-cache.org Mon Apr 19 10:57:11 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 12:57:11 +0200 Subject: r4675 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 12:57:11 +0200 (Mon, 19 Apr 2010) New Revision: 4675 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4647: After check reading the -S argument file during startup, we forgot to close the file descriptor, but this causes no trouble apart from a wasted filedescriptor in the parent process. But closing it is better :-) Fixes: #675 Spotted & Patch by: Edmondas Girkantas Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645 + /trunk:4637,4640,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 10:47:25 UTC (rev 4674) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 10:57:11 UTC (rev 4675) @@ -517,6 +517,7 @@ fprintf(stderr, "Can not read secret-file \"%s\"\n", S_arg); exit (2); } + AZ(close(fd)); secret_file = S_arg; } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647 From tfheen at varnish-cache.org Mon Apr 19 11:04:19 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:04:19 +0200 Subject: r4676 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:04:19 +0200 (Mon, 19 Apr 2010) New Revision: 4676 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt.h branches/2.1/varnish-cache/bin/varnishd/mgt_child.c branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c branches/2.1/varnish-cache/bin/varnishd/mgt_vcc.c branches/2.1/varnish-cache/bin/varnishd/varnishd.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4648: Keep track of file descriptors We clean the child process of unwanted open filedescriptors, but this can take time if there are hundreds of thousands of possible filedescriptors. Instead do it once, right at startup in the manager process, and then keep track of the fd's we use there, and have the child clean only up to the max seen, with an allowance for filedescriptors held by libraries (syslog, resolver, pidfiles etc) Fixes #699 Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647 + /trunk:4637,4640,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4648 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt.h 2010-04-19 10:57:11 UTC (rev 4675) +++ branches/2.1/varnish-cache/bin/varnishd/mgt.h 2010-04-19 11:04:19 UTC (rev 4676) @@ -46,6 +46,7 @@ extern pid_t child_pid; void MGT_Run(void); void mgt_stop_child(void); +void mgt_got_fd(int fd); /* mgt_cli.c */ Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_child.c 2010-04-19 10:57:11 UTC (rev 4675) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_child.c 2010-04-19 11:04:19 UTC (rev 4676) @@ -71,6 +71,7 @@ pid_t child_pid = -1; + static struct vbitmap *fd_map; static int child_cli_in = -1; @@ -98,6 +99,33 @@ static struct vlu *vlu; /*-------------------------------------------------------------------- + * Track the highest file descriptor the parent knows is being used. + * + * This allows the child process to clean/close only a small fraction + * of the possible file descriptors after exec(2). + * + * This is likely to a bit on the low side, as libc and other libraries + * has a tendency to cache file descriptors (syslog, resolver, etc.) + * so we add a margin of 100 fds. + */ + +static int mgt_max_fd; + +#define CLOSE_FD_UP_TO (mgt_max_fd + 100) + +void +mgt_got_fd(int fd) +{ + /* + * Assert > 0, to catch bogus opens, we know where stdin goes + * in the master process. + */ + assert(fd > 0); + if (fd > mgt_max_fd) + mgt_max_fd = fd; +} + +/*-------------------------------------------------------------------- * A handy little function */ @@ -270,7 +298,7 @@ unsigned u; char *p; struct vev *e; - int i, j, cp[2]; + int i, cp[2]; if (child_state != CH_STOPPED && child_state != CH_DIED) return; @@ -337,13 +365,10 @@ /* Close anything we shouldn't know about */ closelog(); - printf("Closed fds:"); - j = getdtablesize(); - for (i = STDERR_FILENO + 1; i < j; i++) { + for (i = STDERR_FILENO + 1; i < CLOSE_FD_UP_TO; i++) { if (vbit_test(fd_map, i)) continue; - if (close(i) == 0) - printf(" %d", i); + (void)(close(i) == 0); } printf("\n"); Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 10:57:11 UTC (rev 4675) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 11:04:19 UTC (rev 4676) @@ -301,6 +301,7 @@ cli_result(cli, CLIS_CANT); return; } + mgt_got_fd(fd); CLI_response(fd, cli->challenge, buf); AZ(close(fd)); if (strcasecmp(buf, av[2])) { @@ -488,6 +489,7 @@ if (i < 0) return (0); + mgt_got_fd(i); tn = telnet_new(i); vsb = sock_id("telnet", i); mgt_cli_setup(i, i, 0, vsb_data(vsb), telnet_close, tn); @@ -508,6 +510,7 @@ fprintf(stderr, "Can not open secret-file \"%s\"\n", S_arg); exit (2); } + mgt_got_fd(fd); i = read(fd, buf, sizeof buf); if (i == 0) { fprintf(stderr, "Empty secret-file \"%s\"\n", S_arg); @@ -623,6 +626,8 @@ if (s < 0) return (0); + mgt_got_fd(s); + M_conn = vev_new(); AN(M_conn); M_conn->callback = Marg_poker; Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_vcc.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_vcc.c 2010-04-19 10:57:11 UTC (rev 4675) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_vcc.c 2010-04-19 11:04:19 UTC (rev 4676) @@ -164,6 +164,7 @@ fprintf(stderr, "Cannot open %s", vp->sf); exit (1); } + mgt_got_fd(fd); l = strlen(csrc); i = write(fd, csrc, l); if (i != l) { Modified: branches/2.1/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/varnishd.c 2010-04-19 10:57:11 UTC (rev 4675) +++ branches/2.1/varnish-cache/bin/varnishd/varnishd.c 2010-04-19 11:04:19 UTC (rev 4676) @@ -424,6 +424,15 @@ struct pidfh *pfh = NULL; char dirname[1024]; + /* + * Start out by closing all unwanted file descriptors we might + * have inherited from sloppy process control daemons. + */ + for (o = getdtablesize(); o > STDERR_FILENO; o--) + (void)close(o); + + mgt_got_fd(STDERR_FILENO); + setbuf(stdout, NULL); setbuf(stderr, NULL); Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4648 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4648 From tfheen at varnish-cache.org Mon Apr 19 11:10:02 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:10:02 +0200 Subject: r4677 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:10:02 +0200 (Mon, 19 Apr 2010) New Revision: 4677 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c branches/2.1/varnish-cache/lib/libvcl/vcc_action.c branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c Log: Merge r4649: Add a SkipToken() macro which does a ExpectErr() + vcc_NextToken(). Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4648 + /trunk:4637,4640,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4648 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4648 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4648 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4648 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4649 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4648 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4649 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -309,10 +309,8 @@ vcc_NextToken(tl); } - if (ae->para) { - ExpectErr(tl, ')'); - vcc_NextToken(tl); - } + if (ae->para) + SkipToken(tl, ')'); if (!vcc_acl_try_netnotation(tl, ae)) { ERRCHK(tl); @@ -504,17 +502,14 @@ vcc_AddDef(tl, an, R_ACL); bprintf(acln, "%.*s", PF(an)); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); while (tl->t->tok != '}') { vcc_acl_entry(tl); ERRCHK(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } - ExpectErr(tl, '}'); - vcc_NextToken(tl); + SkipToken(tl, '}'); vcc_acl_emit(tl, acln, 0); } Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -232,8 +232,7 @@ Fb(tl, 0, ");\n"); break; case HASH: - ExpectErr(tl, T_INCR); - vcc_NextToken(tl); + SkipToken(tl, T_INCR); if (!vcc_StringVal(tl)) { ERRCHK(tl); vcc_ExpectedStringval(tl); Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -259,8 +259,7 @@ "?initial", NULL); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); window = 0; threshold = 0; @@ -334,8 +333,7 @@ return; } - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } if (t_threshold != NULL || t_window != NULL) { @@ -376,8 +374,7 @@ if (status > 0) Fb(tl, 0, "\t\t.exp_status = %u,\n", status); Fb(tl, 0, "\t},\n"); - ExpectErr(tl, '}'); - vcc_NextToken(tl); + SkipToken(tl, '}'); } /*-------------------------------------------------------------------- @@ -415,8 +412,7 @@ NULL); t_first = tl->t; - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); vsb = vsb_newauto(); AN(vsb); @@ -451,49 +447,42 @@ assert(tl->t->dec != NULL); t_host = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "port")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_port = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "host_header")) { ExpectErr(tl, CSTR); assert(tl->t->dec != NULL); t_hosthdr = tl->t; vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { Fb(tl, 0, "\t.connect_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { Fb(tl, 0, "\t.first_byte_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { Fb(tl, 0, "\t.between_bytes_timeout = "); vcc_TimeVal(tl); ERRCHK(tl); Fb(tl, 0, ",\n"); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); vcc_NextToken(tl); ERRCHK(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); Fb(tl, 0, "\t.max_connections = %u,\n", u); } else if (vcc_IdIs(t_field, "saintmode_threshold")) { u = vcc_UintVal(tl); @@ -510,8 +499,7 @@ vcc_NextToken(tl); ERRCHK(tl); saint = u; - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "probe")) { vcc_ParseProbe(tl); ERRCHK(tl); @@ -616,8 +604,7 @@ } vcc_AddRef(tl, h->name, R_BACKEND); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); *nm = h->vgcname; } else if (tl->t->tok == '{') { t = tl->t; @@ -721,13 +708,10 @@ vcc_ErrWhere(tl, tl->t_policy); return; } - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); dl->func(tl); - if (!tl->err) { - ExpectErr(tl, '}'); - vcc_NextToken(tl); - } + if (!tl->err) + SkipToken(tl, '}'); Fi(tl, 0, "\tVRT_init_dir(cli, VCL_conf.director, \"%.*s\",\n", PF(tl->t_policy)); Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend_util.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -98,14 +98,12 @@ { struct token *t_field; - ExpectErr(tl, '.'); - vcc_NextToken(tl); + SkipToken(tl, '.'); ExpectErr(tl, ID); t_field = tl->t; *t = t_field; vcc_NextToken(tl); - ExpectErr(tl, '='); - vcc_NextToken(tl); + SkipToken(tl, '='); for (; fs->name != NULL; fs++) { if (!vcc_IdIs(t_field, fs->name + 1)) Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-19 11:10:02 UTC (rev 4677) @@ -242,4 +242,7 @@ #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) #define ErrInternal(tl) vcc__ErrInternal(tl, __func__, __LINE__) #define Expect(a, b) vcc__Expect(a, b, __LINE__) -#define ExpectErr(a, b) do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0) +#define ExpectErr(a, b) \ + do { vcc__Expect(a, b, __LINE__); ERRCHK(a);} while (0) +#define SkipToken(a, b) \ + do { vcc__Expect(a, b, __LINE__); ERRCHK(a); vcc_NextToken(a); } while (0) Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -70,8 +70,7 @@ retries = vcc_UintVal(tl); ERRCHK(tl); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else { ErrInternal(tl); } @@ -88,8 +87,7 @@ t_be = tl->t; vcc_ResetFldSpec(mfs); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ @@ -116,8 +114,7 @@ } Fc(tl, 0, "%s .weight = %u", first, u); vcc_NextToken(tl); - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); } else { ErrInternal(tl); } Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4648 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4649 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_dir_round_robin.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -67,8 +67,7 @@ t_be = tl->t; vcc_ResetFldSpec(fs); - ExpectErr(tl, '{'); - vcc_NextToken(tl); + SkipToken(tl, '{'); Fc(tl, 0, "\t{"); while (tl->t->tok != '}') { /* Member fields */ Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:04:19 UTC (rev 4676) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:10:02 UTC (rev 4677) @@ -344,8 +344,7 @@ if (tl->t->tok == '(') { vcc_NextToken(tl); Cond_0(tl); - ExpectErr(tl, ')'); - vcc_NextToken(tl); + SkipToken(tl, ')'); } else if (tl->t->tok == VAR) { vp = vcc_FindVar(tl, tl->t, vcc_vars); ERRCHK(tl); @@ -412,14 +411,12 @@ Conditional(struct tokenlist *tl) { - ExpectErr(tl, '('); - vcc_NextToken(tl); + SkipToken(tl, '('); Fb(tl, 1, "(\n"); L(tl, Cond_0(tl)); ERRCHK(tl); Fb(tl, 1, ")\n"); - ExpectErr(tl, ')'); - vcc_NextToken(tl); + SkipToken(tl, ')'); } /*--------------------------------------------------------------------*/ @@ -428,9 +425,8 @@ IfStmt(struct tokenlist *tl) { - ExpectErr(tl, T_IF); + SkipToken(tl, T_IF); Fb(tl, 1, "if \n"); - vcc_NextToken(tl); L(tl, Conditional(tl)); ERRCHK(tl); L(tl, Compound(tl)); @@ -469,11 +465,10 @@ { int i; - ExpectErr(tl, '{'); + SkipToken(tl, '{'); Fb(tl, 1, "{\n"); tl->indent += INDENT; C(tl, ";"); - vcc_NextToken(tl); while (1) { ERRCHK(tl); switch (tl->t->tok) { @@ -503,8 +498,7 @@ i = vcc_ParseAction(tl); ERRCHK(tl); if (i) { - ExpectErr(tl, ';'); - vcc_NextToken(tl); + SkipToken(tl, ';'); break; } /* FALLTHROUGH */ From tfheen at varnish-cache.org Mon Apr 19 11:16:21 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:16:21 +0200 Subject: r4678 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:16:21 +0200 (Mon, 19 Apr 2010) New Revision: 4678 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache.h branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_center.c branches/2.1/varnish-cache/bin/varnishd/cache_esi.c branches/2.1/varnish-cache/bin/varnishd/cache_http.c branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4650: Add a HTTP_Copy() function and use it for the "rollback" copy of req.* This was forgotten when number of HTTP headers was made dynamic. The lack of this function may have made ESI includes weird. Should be merged to 2.1 Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4649 + /trunk:4637,4640,4643-4645,4647-4650 Modified: branches/2.1/varnish-cache/bin/varnishd/cache.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache.h 2010-04-19 11:10:02 UTC (rev 4677) +++ branches/2.1/varnish-cache/bin/varnishd/cache.h 2010-04-19 11:16:21 UTC (rev 4678) @@ -135,6 +135,7 @@ HTTP_Obj = 3 }; +/* NB: remember to update http_Copy() if you add fields */ struct http { unsigned magic; #define HTTP_MAGIC 0x6428b5c9 @@ -514,6 +515,7 @@ /* cache_http.c */ unsigned HTTP_estimate(unsigned nhttp); +void HTTP_Copy(struct http *to, const struct http * const fm); struct http *HTTP_create(void *p, unsigned nhttp); const char *http_StatusMessage(unsigned); unsigned http_EstimateWS(const struct http *fm, unsigned how, unsigned *nhd); Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 11:10:02 UTC (rev 4677) +++ branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 11:16:21 UTC (rev 4678) @@ -1132,7 +1132,7 @@ sp->ws_req = WS_Snapshot(sp->ws); /* Catch original request, before modification */ - *sp->http0 = *sp->http; + HTTP_Copy(sp->http0, sp->http); if (done != 0) { sp->err_code = done; Modified: branches/2.1/varnish-cache/bin/varnishd/cache_esi.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_esi.c 2010-04-19 11:10:02 UTC (rev 4677) +++ branches/2.1/varnish-cache/bin/varnishd/cache_esi.c 2010-04-19 11:16:21 UTC (rev 4678) @@ -896,7 +896,7 @@ http_save = *sp->http; /* Reset request to status before we started messing with it */ - *sp->http = *sp->http0; + HTTP_Copy(sp->http, sp->http0); /* Take a workspace snapshot */ ws_wm = WS_Snapshot(sp->ws); Modified: branches/2.1/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_http.c 2010-04-19 11:10:02 UTC (rev 4677) +++ branches/2.1/varnish-cache/bin/varnishd/cache_http.c 2010-04-19 11:16:21 UTC (rev 4678) @@ -894,6 +894,22 @@ /*--------------------------------------------------------------------*/ +void +HTTP_Copy(struct http *to, const struct http * const fm) +{ + + to->conds = fm->conds; + to->logtag = fm->logtag; + to->status = fm->status; + to->protover = fm->protover; + to->nhd = fm->nhd; + assert(fm->nhd <= to->shd); + memcpy(to->hd, fm->hd, fm->nhd * sizeof *to->hd); + memcpy(to->hdf, fm->hdf, fm->nhd * sizeof *to->hdf); +} + +/*--------------------------------------------------------------------*/ + unsigned http_Write(struct worker *w, const struct http *hp, int resp) { Modified: branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-19 11:10:02 UTC (rev 4677) +++ branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-19 11:16:21 UTC (rev 4678) @@ -867,7 +867,7 @@ VRT_Rollback(struct sess *sp) { - *sp->http = *sp->http0; + HTTP_Copy(sp->http, sp->http0); WS_Reset(sp->ws, sp->ws_req); } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4649 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4649 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4649 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4649 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4649 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4649 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650 From tfheen at varnish-cache.org Mon Apr 19 11:24:22 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:24:22 +0200 Subject: r4679 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:24:21 +0200 (Mon, 19 Apr 2010) New Revision: 4679 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4654: Reject "auth" command if no -S argument given. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650 + /trunk:4637,4640,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 11:16:21 UTC (rev 4678) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_cli.c 2010-04-19 11:24:21 UTC (rev 4679) @@ -293,7 +293,11 @@ AN(av[2]); (void)priv; - AN(secret_file); + if (secret_file == NULL) { + cli_out(cli, "Secret file not configured\n"); + cli_result(cli, CLIS_CANT); + return; + } fd = open(secret_file, O_RDONLY); if (fd < 0) { cli_out(cli, "Cannot open secret file (%s)\n", Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654 From tfheen at varnish-cache.org Mon Apr 19 11:28:51 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:28:51 +0200 Subject: r4680 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:28:51 +0200 (Mon, 19 Apr 2010) New Revision: 4680 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_action.c branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c branches/2.1/varnish-cache/lib/libvcl/vcc_var.c Log: Merge r4655: Polish the variable/type system a little bit, to make life easier for Kristian, and to eliminate some code duplication. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654 + /trunk:4637,4640,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4655 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4655 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:24:21 UTC (rev 4679) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:28:51 UTC (rev 4680) @@ -177,23 +177,8 @@ case T_INCR: case T_DECR: case '=': - if (vp->fmt == TIME) - vcc_TimeVal(tl); - else if (vp->fmt == RTIME) - vcc_RTimeVal(tl); - else if (vp->fmt == SIZE) - vcc_SizeVal(tl); - else if (vp->fmt == FLOAT) - Fb(tl, 0, "%g", vcc_DoubleVal(tl)); - else if (vp->fmt == INT) { - Fb(tl, 0, "%u", vcc_UintVal(tl)); - vcc_NextToken(tl); - } else { - vsb_printf(tl->sb, - "Cannot assign this variable type.\n"); - vcc_ErrWhere(tl, vt); - return; - } + vcc_VarVal(tl, vp, vt); + ERRCHK(tl); break; default: vsb_printf(tl->sb, "Invalid assignment operator.\n"); Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:24:21 UTC (rev 4679) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:28:51 UTC (rev 4680) @@ -247,6 +247,7 @@ struct token *t_did = NULL, *t_window = NULL, *t_threshold = NULL; struct token *t_initial = NULL; unsigned window, threshold, initial, status; + double t; fs = vcc_FldSpec(tl, "?url", @@ -292,14 +293,14 @@ Fb(tl, 0, "\t\t\t\"\\r\\n\",\n"); } else if (vcc_IdIs(t_field, "timeout")) { Fb(tl, 0, "\t\t.timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "interval")) { Fb(tl, 0, "\t\t.interval = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); } else if (vcc_IdIs(t_field, "window")) { t_window = tl->t; window = vcc_UintVal(tl); @@ -396,6 +397,7 @@ struct fld_spec *fs; struct vsb *vsb; unsigned u; + double t; Fh(tl, 1, "\n#define VGC_backend_%s %d\n", vgcname, tl->ndirector); @@ -462,21 +464,21 @@ SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "connect_timeout")) { Fb(tl, 0, "\t.connect_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "first_byte_timeout")) { Fb(tl, 0, "\t.first_byte_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "between_bytes_timeout")) { Fb(tl, 0, "\t.between_bytes_timeout = "); - vcc_TimeVal(tl); + vcc_TimeVal(tl, &t); ERRCHK(tl); - Fb(tl, 0, ",\n"); + Fb(tl, 0, "%g,\n", t); SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-19 11:24:21 UTC (rev 4679) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-19 11:28:51 UTC (rev 4680) @@ -196,9 +196,9 @@ /* vcc_parse.c */ void vcc_Parse(struct tokenlist *tl); -void vcc_RTimeVal(struct tokenlist *tl); -void vcc_TimeVal(struct tokenlist *tl); -void vcc_SizeVal(struct tokenlist *tl); +void vcc_RTimeVal(struct tokenlist *tl, double *); +void vcc_TimeVal(struct tokenlist *tl, double *); +void vcc_SizeVal(struct tokenlist *tl, double *); unsigned vcc_UintVal(struct tokenlist *tl); double vcc_DoubleVal(struct tokenlist *tl); @@ -226,6 +226,8 @@ /* vcc_var.c */ struct var *vcc_FindVar(struct tokenlist *tl, const struct token *t, struct var *vl); +void vcc_VarVal(struct tokenlist *tl, const struct var *vp, + const struct token *vt); /* vcc_xref.c */ void vcc_AddDef(struct tokenlist *tl, struct token *t, enum ref_type type); Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4655 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:24:21 UTC (rev 4679) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:28:51 UTC (rev 4680) @@ -123,6 +123,7 @@ /*-------------------------------------------------------------------- * Recognize and convert { CNUM } to unsigned value + * The tokenizer made sure we only get digits. */ unsigned @@ -141,6 +142,7 @@ /*-------------------------------------------------------------------- * Recognize and convert { CNUM [ '.' [ CNUM ] ] } to double value + * The tokenizer made sure we only get digits and a '.' */ double @@ -171,7 +173,7 @@ /*--------------------------------------------------------------------*/ void -vcc_RTimeVal(struct tokenlist *tl) +vcc_RTimeVal(struct tokenlist *tl, double *d) { double v, sc; int sign = 1; @@ -184,11 +186,13 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = TimeUnit(tl); - Fb(tl, 0, "(%d * %g * %g)", sign, v, sc); + *d = sign * v * sc; } +/*--------------------------------------------------------------------*/ + void -vcc_TimeVal(struct tokenlist *tl) +vcc_TimeVal(struct tokenlist *tl, double *d) { double v, sc; @@ -196,11 +200,13 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = TimeUnit(tl); - Fb(tl, 0, "(%g * %g)", v, sc); + *d = v * sc; } +/*--------------------------------------------------------------------*/ + void -vcc_SizeVal(struct tokenlist *tl) +vcc_SizeVal(struct tokenlist *tl, double *d) { double v, sc; @@ -208,7 +214,7 @@ ERRCHK(tl); ExpectErr(tl, ID); sc = SizeUnit(tl); - Fb(tl, 0, "(%g * %g)", v, sc); + *d = v * sc; } /*--------------------------------------------------------------------*/ @@ -261,28 +267,8 @@ case '<': Fb(tl, 0, "%.*s ", PF(tl->t)); vcc_NextToken(tl); - switch(vp->fmt) { - case TIME: - vcc_TimeVal(tl); - break; - case RTIME: - vcc_RTimeVal(tl); - break; - case INT: - ExpectErr(tl, CNUM); - Fb(tl, 0, "%.*s ", PF(tl->t)); - vcc_NextToken(tl); - break; - case SIZE: - vcc_SizeVal(tl); - break; - default: - vsb_printf(tl->sb, - "No conditions available for variable '%s'\n", - vp->name); - vcc_ErrWhere(tl, tl->t); - return; - } + vcc_VarVal(tl, vp, NULL); + ERRCHK(tl); Fb(tl, 0, "\n"); break; default: Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 11:24:21 UTC (rev 4679) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 11:28:51 UTC (rev 4680) @@ -110,3 +110,35 @@ return (NULL); } +/*--------------------------------------------------------------------*/ + +void +vcc_VarVal(struct tokenlist *tl, const struct var *vp, const struct token *vt) +{ + double d; + + if (vp->fmt == TIME) { + vcc_TimeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == RTIME) { + vcc_RTimeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == SIZE) { + vcc_SizeVal(tl, &d); + ERRCHK(tl); + Fb(tl, 0, "%g", d); + } else if (vp->fmt == FLOAT) { + Fb(tl, 0, "%g", vcc_DoubleVal(tl)); + } else if (vp->fmt == INT) { + Fb(tl, 0, "%u", vcc_UintVal(tl)); + vcc_NextToken(tl); + } else { + AN(vt); + vsb_printf(tl->sb, + "Variable has incompatible type.\n"); + vcc_ErrWhere(tl, vt); + return; + } +} From tfheen at varnish-cache.org Mon Apr 19 11:33:45 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:33:45 +0200 Subject: r4681 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:33:45 +0200 (Mon, 19 Apr 2010) New Revision: 4681 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c branches/2.1/varnish-cache/lib/libvcl/vcc_action.c branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c branches/2.1/varnish-cache/lib/libvcl/vcc_var.c Log: Merge r4656: Make vcc_UintVal() behave like the other ..Val() functions and consume its token. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4655 + /trunk:4637,4640,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4656 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4656 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -306,7 +306,6 @@ ae->t_mask = tl->t; ExpectErr(tl, CNUM); ae->mask = vcc_UintVal(tl); - vcc_NextToken(tl); } if (ae->para) Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -101,7 +101,6 @@ } } else if (tl->t->tok == CNUM) { Fb(tl, 1, "VRT_error(sp, %u", vcc_UintVal(tl)); - vcc_NextToken(tl); } else Fb(tl, 1, "VRT_error(sp, 0"); if (tl->t->tok == CSTR) { Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_backend.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -304,12 +304,10 @@ } else if (vcc_IdIs(t_field, "window")) { t_window = tl->t; window = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "initial")) { t_initial = tl->t; initial = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "expected_response")) { status = vcc_UintVal(tl); @@ -320,12 +318,10 @@ vcc_ErrWhere(tl, tl->t); return; } - vcc_NextToken(tl); ERRCHK(tl); } else if (vcc_IdIs(t_field, "threshold")) { t_threshold = tl->t; threshold = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); } else { vcc_ErrToken(tl, t_field); @@ -482,7 +478,6 @@ SkipToken(tl, ';'); } else if (vcc_IdIs(t_field, "max_connections")) { u = vcc_UintVal(tl); - vcc_NextToken(tl); ERRCHK(tl); SkipToken(tl, ';'); Fb(tl, 0, "\t.max_connections = %u,\n", u); @@ -498,7 +493,6 @@ vsb_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, tl->t); } - vcc_NextToken(tl); ERRCHK(tl); saint = u; SkipToken(tl, ';'); Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -69,7 +69,6 @@ ExpectErr(tl, CNUM); retries = vcc_UintVal(tl); ERRCHK(tl); - vcc_NextToken(tl); SkipToken(tl, ';'); } else { ErrInternal(tl); @@ -113,7 +112,6 @@ return; } Fc(tl, 0, "%s .weight = %u", first, u); - vcc_NextToken(tl); SkipToken(tl, ';'); } else { ErrInternal(tl); Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4655 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4656 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -137,6 +137,7 @@ d *= 10; d += *p - '0'; } + vcc_NextToken(tl); return (d); } Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 11:28:51 UTC (rev 4680) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 11:33:45 UTC (rev 4681) @@ -133,7 +133,6 @@ Fb(tl, 0, "%g", vcc_DoubleVal(tl)); } else if (vp->fmt == INT) { Fb(tl, 0, "%u", vcc_UintVal(tl)); - vcc_NextToken(tl); } else { AN(vt); vsb_printf(tl->sb, From tfheen at varnish-cache.org Mon Apr 19 11:38:52 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:38:52 +0200 Subject: r4682 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:38:52 +0200 (Mon, 19 Apr 2010) New Revision: 4682 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache.h branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4657: Add some semi-magic functions to align pointers with. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4656 + /trunk:4637,4640,4643-4645,4647-4650,4654-4657 Modified: branches/2.1/varnish-cache/bin/varnishd/cache.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache.h 2010-04-19 11:33:45 UTC (rev 4681) +++ branches/2.1/varnish-cache/bin/varnishd/cache.h 2010-04-19 11:38:52 UTC (rev 4682) @@ -95,6 +95,15 @@ #define DIGEST_LEN 32 +/*-------------------------------------------------------------------- + * Pointer aligment magic + */ + +#define PALGN (sizeof(void *) - 1) +#define PAOK(p) (((uintptr_t)(p) & PALGN) == 0) +#define PRNDDN(p) ((uintptr_t)(p) & ~PALGN) +#define PRNDUP(p) (((uintptr_t)(p) + PALGN) & ~PALGN) + /*--------------------------------------------------------------------*/ typedef struct { Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4657 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4656 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4657 From tfheen at varnish-cache.org Mon Apr 19 11:44:19 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:44:19 +0200 Subject: r4683 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:44:19 +0200 (Mon, 19 Apr 2010) New Revision: 4683 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_http.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4658: Round up estimate of HTTP header space to alow for alignment of allocations in workspace. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4657 + /trunk:4637,4640,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4658 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_http.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_http.c 2010-04-19 11:38:52 UTC (rev 4682) +++ branches/2.1/varnish-cache/bin/varnishd/cache_http.c 2010-04-19 11:44:19 UTC (rev 4683) @@ -679,7 +679,7 @@ continue; #include "http_headers.h" #undef HTTPH - l += Tlen(fm->hd[u]) + 1; + l += PRNDUP(Tlen(fm->hd[u]) + 1); (*nhd)++; // fm->hdf[u] |= HDF_COPY; } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4658 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4657 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4658 From tfheen at varnish-cache.org Mon Apr 19 11:49:37 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:49:37 +0200 Subject: r4684 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:49:37 +0200 (Mon, 19 Apr 2010) New Revision: 4684 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/stevedore.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4659: Align pointers in allocated objects to pointer boundaries. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4658 + /trunk:4637,4640,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4659 Modified: branches/2.1/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/stevedore.c 2010-04-19 11:44:19 UTC (rev 4683) +++ branches/2.1/varnish-cache/bin/varnishd/stevedore.c 2010-04-19 11:49:37 UTC (rev 4684) @@ -95,6 +95,9 @@ memset(o, 0, sizeof *o); o->magic = OBJECT_MAGIC; + assert(PAOK(wsl)); + assert(PAOK(lhttp)); + o->http = HTTP_create(o + 1, nhttp); WS_Init(o->ws_o, "obj", (char *)(o + 1) + lhttp, wsl); WS_Assert(o->ws_o); @@ -118,8 +121,10 @@ (void)ttl; assert(l > 0); + l = PRNDUP(l); lh = HTTP_estimate(nhttp); + lh = PRNDUP(lh); if (!sp->wrk->cacheable) { o = malloc(sizeof *o + l + lh); @@ -135,7 +140,10 @@ o = (void *)st->ptr; /* XXX: align ? */ - STV_InitObj(sp, o, st->space - (sizeof *o + lh), lh, nhttp); + l = PRNDDN(st->space - (sizeof *o + lh)); + + + STV_InitObj(sp, o, l, lh, nhttp); o->objstore = st; return (o); } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4659 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4658 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4659 From tfheen at varnish-cache.org Mon Apr 19 11:54:33 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 13:54:33 +0200 Subject: r4685 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 13:54:32 +0200 (Mon, 19 Apr 2010) New Revision: 4685 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_ws.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4660: Align all workspace allocations on pointer boundaries. Add plenty of asserts until we see that the world don't end. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4659 + /trunk:4637,4640,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4660 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_ws.c 2010-04-19 11:49:37 UTC (rev 4684) +++ branches/2.1/varnish-cache/bin/varnishd/cache_ws.c 2010-04-19 11:54:32 UTC (rev 4685) @@ -57,13 +57,17 @@ ws->r == NULL ? 0 : pdiff(ws->f, ws->r), pdiff(ws->s, ws->e)); assert(ws->s != NULL); + // assert(PAOK(ws->s)); assert(ws->e != NULL); + // assert(PAOK(ws->e)); assert(ws->s < ws->e); assert(ws->f >= ws->s); assert(ws->f <= ws->e); + // assert(PAOK(ws->f)); if (ws->r) { assert(ws->r > ws->s); assert(ws->r <= ws->e); + // assert(PAOK(ws->r)); } } @@ -77,7 +81,9 @@ memset(ws, 0, sizeof *ws); ws->magic = WS_MAGIC; ws->s = space; + assert(PAOK(space)); ws->e = ws->s + len; + assert(PAOK(len)); ws->f = ws->s; ws->id = id; WS_Assert(ws); @@ -101,6 +107,7 @@ assert(p < ws->e); ws->f = p; } + WS_Assert(ws); } char * @@ -109,14 +116,18 @@ char *r; WS_Assert(ws); + bytes = PRNDUP(bytes); + assert(ws->r == NULL); if (ws->f + bytes > ws->e) { ws->overflow++; + WS_Assert(ws); return(NULL); } r = ws->f; ws->f += bytes; DSL(0x02, SLT_Debug, 0, "WS_Alloc(%p, %u) = %p", ws, bytes, r); + WS_Assert(ws); return (r); } @@ -126,11 +137,13 @@ unsigned l; char *p; + WS_Assert(ws); l = strlen(s) + 1; p = WS_Alloc(ws, l); if (p != NULL) memcpy(p, s, l); DSL(0x02, SLT_Debug, 0, "WS_Dup(%p, \"%s\") = %p", ws, s, p); + WS_Assert(ws); return (p); } @@ -155,16 +168,20 @@ unsigned WS_Reserve(struct ws *ws, unsigned bytes) { - unsigned b2 = bytes; + unsigned b2; WS_Assert(ws); assert(ws->r == NULL); if (bytes == 0) b2 = ws->e - ws->f; + else + b2 = bytes; + // b2 = PRNDND(b2); xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", ws, b2, bytes, pdiff(ws->f, ws->r)); + WS_Assert(ws); return (pdiff(ws->f, ws->r)); } @@ -172,12 +189,14 @@ WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); + // bytes = PRNDUP(bytes); assert(bytes <= ws->e - ws->f); DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); assert(ws->f + bytes <= ws->r); ws->f += bytes; ws->r = NULL; + WS_Assert(ws); } void @@ -188,8 +207,10 @@ assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); - ws->f = ptr; + // ws->f += PRNDUP(ptr - ws->f); + ws->f += (ptr - ws->f); ws->r = NULL; + WS_Assert(ws); } #if 0 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4660 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4659 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4660 From phk at varnish-cache.org Mon Apr 19 11:58:33 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 19 Apr 2010 13:58:33 +0200 Subject: r4686 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: Author: phk Date: 2010-04-19 13:58:33 +0200 (Mon, 19 Apr 2010) New Revision: 4686 Added: trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc Log: Add experimental and limited support for "Range:" headers. By default it is disabled, enable with param http_range_support. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-19 11:54:32 UTC (rev 4685) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-19 11:58:33 UTC (rev 4686) @@ -40,6 +40,7 @@ #include "shmlog.h" #include "cache.h" +#include "vct.h" /*--------------------------------------------------------------------*/ @@ -127,6 +128,56 @@ /*--------------------------------------------------------------------*/ +static void +res_dorange(struct sess *sp, const char *r, unsigned *plow, unsigned *phigh) +{ + unsigned low, high; + + (void)sp; + if (strncmp(r, "bytes=", 6)) + return; + r += 6; + printf("-----------------RANGE: <%s>\n", r); + low = 0; + high = 0; + if (!vct_isdigit(*r)) + return; + while (vct_isdigit(*r)) { + low *= 10; + low += *r - '0'; + r++; + } + if (*r != '-') + return; + r++; + if (!vct_isdigit(*r)) + return; + while (vct_isdigit(*r)) { + high *= 10; + high += *r - '0'; + r++; + } + if (*r != '\0') + return; + printf("-----------------RANGE: %u %u\n", low, high); + if (high >= sp->obj->len) + high = sp->obj->len - 1; + if (low == 0 && high >= sp->obj->len) + return; + + + http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Content-Range: bytes %u-%u/%u", low, high, sp->obj->len); + http_Unset(sp->wrk->resp, H_Content_Length); + http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Content-Length: %u", 1 + high - low); + http_SetResp(sp->wrk->resp, "HTTP/1.1", "206", "Partial Content"); + *plow = low; + *phigh = high; +} + +/*--------------------------------------------------------------------*/ + void RES_BuildHttp(struct sess *sp) { @@ -153,7 +204,10 @@ "Transfer-Encoding: chunked"); else sp->doclose = "ESI EOF"; - } + } else if (params->http_range_support) + http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Accept-Ranges: bytes"); + TIM_format(TIM_real(), time_str); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str); @@ -179,63 +233,119 @@ struct storage *st; unsigned u = 0; char lenbuf[20]; + char *r; + unsigned low, high, ptr, off, len; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); WRW_Reserve(sp->wrk, &sp->fd); - if (sp->disable_esi || !sp->esis) - sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); + /* + * ESI objects get special delivery + */ + if (!sp->disable_esi && sp->obj->esidata != NULL) { - if (!sp->disable_esi && sp->wantbody && sp->obj->esidata != NULL) { + if (sp->esis == 0) + /* no headers for interior ESI includes */ + sp->acct_req.hdrbytes += + http_Write(sp->wrk, sp->wrk->resp, 1); + if (WRW_FlushRelease(sp->wrk)) { vca_close_session(sp, "remote closed"); - return; - } - ESI_Deliver(sp); + } else if (sp->wantbody) + ESI_Deliver(sp); return; } - if (sp->wantbody) { - if (!sp->disable_esi && - sp->esis > 0 && - sp->http->protover >= 1.1 && - sp->obj->len > 0) { - sprintf(lenbuf, "%x\r\n", sp->obj->len); - (void)WRW_Write(sp->wrk, lenbuf, -1); + /* + * How much of the object we want to deliver + */ + low = 0; + high = sp->obj->len - 1; + + if (sp->disable_esi || sp->esis == 0) { + /* For none ESI and non ESI-included objects, try Range */ + if (params->http_range_support && + (sp->disable_esi || sp->esis == 0) && + sp->obj->response == 200 && + sp->wantbody && + http_GetHdr(sp->http, H_Range, &r)) + res_dorange(sp, r, &low, &high); + + sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); + } else if (!sp->disable_esi && + sp->esis > 0 && + sp->http->protover >= 1.1 && + sp->obj->len > 0) { + /* + * Interior ESI includes (which are not themselves ESI + * objects) use chunked encoding (here) or EOF (nothing) + */ + assert(sp->wantbody); + sprintf(lenbuf, "%x\r\n", sp->obj->len); + (void)WRW_Write(sp->wrk, lenbuf, -1); + } + + if (!sp->wantbody) { + /* This was a HEAD request */ + assert(sp->esis == 0); + if (WRW_FlushRelease(sp->wrk)) + vca_close_session(sp, "remote closed"); + return; + } + + ptr = 0; + VTAILQ_FOREACH(st, &sp->obj->store, list) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); + u += st->len; + len = st->len; + off = 0; + if (ptr + len <= low) { + /* This segment is too early */ + ptr += len; + continue; } + if (ptr < low) { + /* Chop front of segment off */ + off += (low - ptr); + len -= (low - ptr); + ptr += (low - ptr); + } + if (ptr + len > high) + /* Chop tail of segment off */ + len = 1 + high - low; - VTAILQ_FOREACH(st, &sp->obj->store, list) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - u += st->len; - sp->acct_req.bodybytes += st->len; + ptr += len; + + sp->acct_req.bodybytes += len; #ifdef SENDFILE_WORKS - /* - * XXX: the overhead of setting up sendfile is not - * XXX: epsilon and maybe not even delta, so avoid - * XXX: engaging sendfile for small objects. - * XXX: Should use getpagesize() ? - */ - if (st->fd >= 0 && - st->len >= params->sendfile_threshold) { - VSL_stats->n_objsendfile++; - WRW_Sendfile(sp->wrk, st->fd, - st->where, st->len); - continue; - } + /* + * XXX: the overhead of setting up sendfile is not + * XXX: epsilon and maybe not even delta, so avoid + * XXX: engaging sendfile for small objects. + * XXX: Should use getpagesize() ? + */ + if (st->fd >= 0 && + st->len >= params->sendfile_threshold) { + VSL_stats->n_objsendfile++; + WRW_Sendfile(sp->wrk, st->fd, st->where + off, len); + continue; + } #endif /* SENDFILE_WORKS */ - VSL_stats->n_objwrite++; - (void)WRW_Write(sp->wrk, st->ptr, st->len); - } - assert(u == sp->obj->len); - if (!sp->disable_esi && - sp->esis > 0 && - sp->http->protover >= 1.1 && - sp->obj->len > 0) - (void)WRW_Write(sp->wrk, "\r\n", -1); + VSL_stats->n_objwrite++; + (void)WRW_Write(sp->wrk, st->ptr + off, len); } + assert(u == sp->obj->len); + if (!sp->disable_esi && + sp->esis > 0 && + sp->http->protover >= 1.1 && + sp->obj->len > 0) { + /* post-chunk new line */ + (void)WRW_Write(sp->wrk, "\r\n", -1); + } + if (WRW_FlushRelease(sp->wrk)) vca_close_session(sp, "remote closed"); } Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2010-04-19 11:54:32 UTC (rev 4685) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2010-04-19 11:58:33 UTC (rev 4686) @@ -197,6 +197,8 @@ unsigned saintmode_threshold; unsigned syslog_cli_traffic; + + unsigned http_range_support; }; /* Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-19 11:54:32 UTC (rev 4685) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-19 11:58:33 UTC (rev 4686) @@ -813,6 +813,10 @@ "A value of 0 disables saintmode.", EXPERIMENTAL, "10", "objects" }, + { "http_range_support", tweak_bool, &master.http_range_support, 0, 0, + "Enable support for HTTP Range headers.\n", + EXPERIMENTAL, + "off", "bool" }, { NULL, NULL, NULL } }; Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00032.vtc ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc ___________________________________________________________________ Added: svn:keywords + Id Added: trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-19 11:58:33 UTC (rev 4686) @@ -0,0 +1,59 @@ +# $Id$ + +test "Range headers" + +server s1 { + rxreq + txresp -bodylen 100 +} -start + +varnish v1 -vcl+backend { +} -start + +client c1 { + txreq -hdr "Range: bytes=0-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 +} -run + +varnish v1 -cliok "param.set http_range_support on" + + +client c1 { + txreq -hdr "Range: bytes =0-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=0- 9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes =-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes =0-a" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=0-9" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=10-19" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=90-101" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 +} -run + Property changes on: trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc ___________________________________________________________________ Added: svn:keywords + Id From tfheen at varnish-cache.org Mon Apr 19 12:00:29 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:00:29 +0200 Subject: r4687 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 14:00:29 +0200 (Mon, 19 Apr 2010) New Revision: 4687 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/common.h branches/2.1/varnish-cache/bin/varnishd/shmlog.c branches/2.1/varnish-cache/bin/varnishd/varnishd.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4661: We need to update the master-process pid in the shmlog after we daemon()'ize. Spotted by: Mark Moseley Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4660 + /trunk:4637,4640,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4661 Modified: branches/2.1/varnish-cache/bin/varnishd/common.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/common.h 2010-04-19 11:58:33 UTC (rev 4686) +++ branches/2.1/varnish-cache/bin/varnishd/common.h 2010-04-19 12:00:29 UTC (rev 4687) @@ -43,6 +43,7 @@ /* shmlog.c */ void VSL_MgtInit(const char *fn, unsigned size); +void VSL_MgtPid(void); extern struct varnish_stats *VSL_stats; /* varnishd.c */ Modified: branches/2.1/varnish-cache/bin/varnishd/shmlog.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/shmlog.c 2010-04-19 11:58:33 UTC (rev 4686) +++ branches/2.1/varnish-cache/bin/varnishd/shmlog.c 2010-04-19 12:00:29 UTC (rev 4687) @@ -413,3 +413,10 @@ *pp = *params; params = pp; } + +void +VSL_MgtPid(void) +{ + + loghead->master_pid = getpid(); +} Modified: branches/2.1/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/varnishd.c 2010-04-19 11:58:33 UTC (rev 4686) +++ branches/2.1/varnish-cache/bin/varnishd/varnishd.c 2010-04-19 12:00:29 UTC (rev 4687) @@ -674,6 +674,8 @@ if (!d_flag && !F_flag) AZ(varnish_daemon(1, 0)); + VSL_MgtPid(); + if (pfh != NULL && vpf_write(pfh)) fprintf(stderr, "NOTE: Could not write PID file\n"); Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4661 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4660 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4661 From tfheen at varnish-cache.org Mon Apr 19 12:06:44 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:06:44 +0200 Subject: r4688 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 14:06:44 +0200 (Mon, 19 Apr 2010) New Revision: 4688 Added: branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_center.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/b00000.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/bin/varnishtest/vtc_http.c branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4662: We converted HEAD to GET in vcl_recv{}, that is far too early, since it also affects pipe and pass processing. Move the HEAD->GET override to vcl_miss{} and do it on the bereq.* so we do not tamper with the original request. Fixes: #679 Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4661 + /trunk:4637,4640,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4662 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 12:00:29 UTC (rev 4687) +++ branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 12:06:44 UTC (rev 4688) @@ -866,6 +866,7 @@ sp->wrk->bereq = sp->wrk->http[0]; http_Setup(sp->wrk->bereq, sp->wrk->ws); http_FilterHeader(sp, HTTPH_R_FETCH); + http_ForceGet(sp->wrk->bereq); sp->wrk->connect_timeout = 0; sp->wrk->first_byte_timeout = 0; sp->wrk->between_bytes_timeout = 0; @@ -1050,10 +1051,9 @@ assert(sp->handling == VCL_RET_HASH); SHA256_Final(sp->digest, sp->wrk->sha256ctx); - if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) { + if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) sp->wantbody = 0; - http_ForceGet(sp->http); - } else + else sp->wantbody = 1; sp->sendbody = 0; Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4662 Modified: branches/2.1/varnish-cache/bin/varnishtest/tests/b00000.vtc =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-19 12:00:29 UTC (rev 4687) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-19 12:06:44 UTC (rev 4688) @@ -11,6 +11,8 @@ varnish v1 -arg "-smalloc,1m" -vcl+backend {} -start +varnish v1 -cliok "param.set diag_bitmap 0x2" + varnish v1 -expect n_object == 0 varnish v1 -expect client_conn == 0 varnish v1 -expect client_req == 0 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4662 Copied: branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc (from rev 4662, trunk/varnish-cache/bin/varnishtest/tests/r00679.vtc) =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc (rev 0) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc 2010-04-19 12:06:44 UTC (rev 4688) @@ -0,0 +1,16 @@ +# $Id$ + +test "pass + HEAD" + +server s1 { + rxreq + expect req.request == "HEAD" + txresp +} -start + +varnish v1 -vcl+backend {} -start + +client c1 { + txreq -req HEAD -hdr "Cookie: foo=bar" + rxresp -no_obj +} -run Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4662 Modified: branches/2.1/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-19 12:00:29 UTC (rev 4687) +++ branches/2.1/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-19 12:06:44 UTC (rev 4688) @@ -467,6 +467,7 @@ cmd_http_rxresp(CMD_ARGS) { struct http *hp; + int has_obj = 1; (void)cmd; (void)vl; @@ -476,11 +477,17 @@ av++; for(; *av != NULL; av++) - vtc_log(hp->vl, 0, "Unknown http rxresp spec: %s\n", *av); + if (!strcmp(*av, "-no_obj")) + has_obj = 0; + else + vtc_log(hp->vl, 0, + "Unknown http rxresp spec: %s\n", *av); vtc_log(hp->vl, 3, "rxresp"); http_rxhdr(hp); http_splitheader(hp, 0); - if (!strcmp(hp->resp[1], "200")) + if (!has_obj) + ; + else if (!strcmp(hp->resp[1], "200")) http_swallow_body(hp, hp->resp, 1); else http_swallow_body(hp, hp->resp, 0); Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4662 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4661 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4662 From phk at varnish-cache.org Mon Apr 19 12:08:32 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 19 Apr 2010 14:08:32 +0200 Subject: r4689 - in trunk/varnish-cache: bin/varnishd lib/libvarnish lib/libvcl Message-ID: Author: phk Date: 2010-04-19 14:08:32 +0200 (Mon, 19 Apr 2010) New Revision: 4689 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/mgt_child.c trunk/varnish-cache/bin/varnishd/stevedore.c trunk/varnish-cache/lib/libvarnish/binary_heap.c trunk/varnish-cache/lib/libvcl/vcc_acl.c trunk/varnish-cache/lib/libvcl/vcc_var.c Log: Whitespace cleanup Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -1051,7 +1051,7 @@ assert(sp->handling == VCL_RET_HASH); SHA256_Final(sp->digest, sp->wrk->sha256ctx); - if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) + if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) sp->wantbody = 0; else sp->wantbody = 1; Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -207,8 +207,8 @@ } else if (params->http_range_support) http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, "Accept-Ranges: bytes"); - + TIM_format(TIM_real(), time_str); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str); @@ -248,7 +248,7 @@ if (sp->esis == 0) /* no headers for interior ESI includes */ - sp->acct_req.hdrbytes += + sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); if (WRW_FlushRelease(sp->wrk)) { @@ -279,7 +279,7 @@ sp->http->protover >= 1.1 && sp->obj->len > 0) { /* - * Interior ESI includes (which are not themselves ESI + * Interior ESI includes (which are not themselves ESI * objects) use chunked encoding (here) or EOF (nothing) */ assert(sp->wantbody); @@ -304,7 +304,7 @@ off = 0; if (ptr + len <= low) { /* This segment is too early */ - ptr += len; + ptr += len; continue; } if (ptr < low) { Modified: trunk/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/bin/varnishd/mgt_child.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -101,7 +101,7 @@ /*-------------------------------------------------------------------- * Track the highest file descriptor the parent knows is being used. * - * This allows the child process to clean/close only a small fraction + * This allows the child process to clean/close only a small fraction * of the possible file descriptors after exec(2). * * This is likely to a bit on the low side, as libc and other libraries Modified: trunk/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/bin/varnishd/stevedore.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -141,8 +141,8 @@ o = (void *)st->ptr; /* XXX: align ? */ l = PRNDDN(st->space - (sizeof *o + lh)); - + STV_InitObj(sp, o, l, lh, nhttp); o->objstore = st; return (o); Modified: trunk/varnish-cache/lib/libvarnish/binary_heap.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/lib/libvarnish/binary_heap.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -194,7 +194,7 @@ ; bh->page_shift = u; assert(bh->page_size <= (sizeof(**bh->array) * ROW_WIDTH)); - + bh->cmp = cmp_f; bh->update = update_f; bh->next = ROOT_IDX; Modified: trunk/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -308,7 +308,7 @@ ae->mask = vcc_UintVal(tl); } - if (ae->para) + if (ae->para) SkipToken(tl, ')'); if (!vcc_acl_try_netnotation(tl, ae)) { Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 12:06:44 UTC (rev 4688) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-19 12:08:32 UTC (rev 4689) @@ -131,7 +131,7 @@ Fb(tl, 0, "%g", d); } else if (vp->fmt == FLOAT) { Fb(tl, 0, "%g", vcc_DoubleVal(tl)); - } else if (vp->fmt == INT) { + } else if (vp->fmt == INT) { Fb(tl, 0, "%u", vcc_UintVal(tl)); } else { AN(vt); From phk at varnish-cache.org Mon Apr 19 12:10:32 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 19 Apr 2010 14:10:32 +0200 Subject: r4690 - in trunk/varnish-cache: bin/varnishsizes doc Message-ID: Author: phk Date: 2010-04-19 14:10:31 +0200 (Mon, 19 Apr 2010) New Revision: 4690 Modified: trunk/varnish-cache/bin/varnishsizes/Makefile.am trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 trunk/varnish-cache/bin/varnishsizes/varnishsizes.c trunk/varnish-cache/doc/changes-2.0.2-2.0.3.xml trunk/varnish-cache/doc/changes-2.1.0.xml Log: Set $Id$ keyword expansion Property changes on: trunk/varnish-cache/bin/varnishsizes/Makefile.am ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishsizes/varnishsizes.1 ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/varnish-cache/bin/varnishsizes/varnishsizes.c ___________________________________________________________________ Added: svn:keywords + Id Property changes on: trunk/varnish-cache/doc/changes-2.0.2-2.0.3.xml ___________________________________________________________________ Added: svn:keywords + Id Modified: trunk/varnish-cache/doc/changes-2.1.0.xml =================================================================== --- trunk/varnish-cache/doc/changes-2.1.0.xml 2010-04-19 12:08:32 UTC (rev 4689) +++ trunk/varnish-cache/doc/changes-2.1.0.xml 2010-04-19 12:10:31 UTC (rev 4690) @@ -3,7 +3,7 @@ ]> - + Varnish 2.1 Property changes on: trunk/varnish-cache/doc/changes-2.1.0.xml ___________________________________________________________________ Added: svn:keywords + Id From tfheen at varnish-cache.org Mon Apr 19 12:14:47 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:14:47 +0200 Subject: r4691 - in branches/2.1: . varnish-cache varnish-cache/bin varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 14:14:47 +0200 (Mon, 19 Apr 2010) New Revision: 4691 Added: branches/2.1/varnish-cache/bin/varnishsizes/ Modified: branches/2.1/ branches/2.1/varnish-cache/bin/Makefile.am branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/configure.ac branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4663: Add varnishsizes, which is varnishhist for the Length-header Though it works fine, varnishhist and *sizes should probably be merged together at some point. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4662 + /trunk:4637,4640,4643-4645,4647-4650,4654-4663 Modified: branches/2.1/varnish-cache/bin/Makefile.am =================================================================== --- branches/2.1/varnish-cache/bin/Makefile.am 2010-04-19 12:10:31 UTC (rev 4690) +++ branches/2.1/varnish-cache/bin/Makefile.am 2010-04-19 12:14:47 UTC (rev 4691) @@ -3,5 +3,5 @@ SUBDIRS = varnishadm varnishd varnishlog varnishncsa varnishreplay varnishtest if HAVE_CURSES -SUBDIRS += varnishhist varnishstat varnishtop +SUBDIRS += varnishhist varnishstat varnishtop varnishsizes endif Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4663 Modified: branches/2.1/varnish-cache/configure.ac =================================================================== --- branches/2.1/varnish-cache/configure.ac 2010-04-19 12:10:31 UTC (rev 4690) +++ branches/2.1/varnish-cache/configure.ac 2010-04-19 12:14:47 UTC (rev 4691) @@ -450,6 +450,7 @@ bin/varnishncsa/Makefile bin/varnishreplay/Makefile bin/varnishstat/Makefile + bin/varnishsizes/Makefile bin/varnishtest/Makefile bin/varnishtop/Makefile doc/Makefile Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4663 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4662 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4663 From tfheen at varnish-cache.org Mon Apr 19 12:30:23 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:30:23 +0200 Subject: r4692 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl varnish-cache/redhat Message-ID: Author: tfheen Date: 2010-04-19 14:30:23 +0200 (Mon, 19 Apr 2010) New Revision: 4692 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/redhat/varnish.spec branches/2.1/varnish-cache/redhat/varnish.sysconfig Log: Merge r4664: Added the -S option as default in the redhat package Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4663 + /trunk:4637,4640,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4664 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4663 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4664 Modified: branches/2.1/varnish-cache/redhat/varnish.spec =================================================================== --- branches/2.1/varnish-cache/redhat/varnish.spec 2010-04-19 12:14:47 UTC (rev 4691) +++ branches/2.1/varnish-cache/redhat/varnish.spec 2010-04-19 12:30:23 UTC (rev 4692) @@ -1,22 +1,22 @@ Summary: High-performance HTTP accelerator Name: varnish -Version: 2.0.7 -Release: 0.1svn20100201r4527%{?dist} +Version: 2.1.1 +Release: 0.svn20100415%{?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 -#BuildRequires: automake autoconf libtool +BuildRequires: automake autoconf libtool BuildRequires: ncurses-devel libxslt groff pcre-devel pkgconfig Requires: varnish-libs = %{version}-%{release} Requires: logrotate Requires: ncurses +Requires: pcre Requires(pre): shadow-utils -Requires(post): /sbin/chkconfig +Requires(post): /sbin/chkconfig, /usr/bin/mkpasswd Requires(preun): /sbin/chkconfig Requires(preun): /sbin/service Requires(preun): initscripts @@ -61,15 +61,13 @@ #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 -#./autogen.sh +./autogen.sh -#%patch0 - # Hack to get 32- and 64-bits tests run concurrently on the same build machine case `uname -m` in ppc64 | s390x | x86_64 | sparc64 ) @@ -101,6 +99,11 @@ %configure --disable-static --localstatedir=/var/lib %endif +# Have to regenerate the docs because of patched doc/changes-2.0.6-2.1.0.xml +pushd doc/ +make clean +popd + # We have to remove rpath - not allowed in Fedora # (This problem only visible on 64 bit arches) sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g; @@ -144,9 +147,6 @@ %endif %endif -# p class checks are still unstable -rm bin/varnishtest/tests/p*.vtc - 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" @@ -234,6 +234,7 @@ /sbin/chkconfig --add varnish /sbin/chkconfig --add varnishlog /sbin/chkconfig --add varnishncsa +test -f /etc/varnish/secret || (mkpasswd > /etc/varnish/secret && chmod 0600 /etc/varnish/secret) %preun if [ $1 -lt 1 ]; then @@ -250,10 +251,19 @@ %postun libs -p /sbin/ldconfig %changelog -* Mon Jan 25 2010 Ingvar Hagelund - 2.0.7-0.1 -- changes-2.0.6.html works now, so remove fix -- Added pcre-devel and pkgconfig to the build requirements +* Wed Apr 14 2010 Ingvar Hagelund - 2.1.0-2 +- Added a patch from svn that fixes changes-2.0.6-2.1.0.xml +* Tue Apr 06 2010 Ingvar Hagelund - 2.1.0-1 +- New upstream release; note: Configuration changes, see the README +- Removed unneeded patches +- CVE-2009-2936: Added a patch from Debian that adds the -S option + to the varnisdh(1) manpage and to the sysconfig defaults, thus + password-protecting the admin interface port (#579536,#579533) +- Generates that password in the post script, requires mkpasswd +- Added a patch from Robert Scheck for explicit linking to libm +- Requires pcre + * Wed Dec 23 2009 Ingvar Hagelund - 2.0.6-2 - Added a test that enables jemalloc on ppc if the kernel is not a rhel5 kernel (as on redhat builders) Modified: branches/2.1/varnish-cache/redhat/varnish.sysconfig =================================================================== --- branches/2.1/varnish-cache/redhat/varnish.sysconfig 2010-04-19 12:14:47 UTC (rev 4691) +++ branches/2.1/varnish-cache/redhat/varnish.sysconfig 2010-04-19 12:30:23 UTC (rev 4692) @@ -38,6 +38,7 @@ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -u varnish -g varnish \ + -S /etc/varnish/secret \ -s file,/var/lib/varnish/varnish_storage.bin,1G" From tfheen at varnish-cache.org Mon Apr 19 12:40:31 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:40:31 +0200 Subject: r4693 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 14:40:31 +0200 (Mon, 19 Apr 2010) New Revision: 4693 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c Log: Merge r4665: Add vcc_ prefixes to a bunch of static functions. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4664 + /trunk:4637,4640,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4665 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4664 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4665 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 12:30:23 UTC (rev 4692) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-19 12:40:31 UTC (rev 4693) @@ -43,8 +43,8 @@ /*--------------------------------------------------------------------*/ -static void Compound(struct tokenlist *tl); -static void Cond_0(struct tokenlist *tl); +static void vcc_Compound(struct tokenlist *tl); +static void vcc_Cond_0(struct tokenlist *tl); /*--------------------------------------------------------------------*/ @@ -64,7 +64,7 @@ */ static double -TimeUnit(struct tokenlist *tl) +vcc_TimeUnit(struct tokenlist *tl) { double sc = 1.0; @@ -97,7 +97,7 @@ */ static double -SizeUnit(struct tokenlist *tl) +vcc_SizeUnit(struct tokenlist *tl) { double sc = 1.0; @@ -186,7 +186,7 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = TimeUnit(tl); + sc = vcc_TimeUnit(tl); *d = sign * v * sc; } @@ -200,7 +200,7 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = TimeUnit(tl); + sc = vcc_TimeUnit(tl); *d = v * sc; } @@ -214,14 +214,14 @@ v = vcc_DoubleVal(tl); ERRCHK(tl); ExpectErr(tl, ID); - sc = SizeUnit(tl); + sc = vcc_SizeUnit(tl); *d = v * sc; } /*--------------------------------------------------------------------*/ static void -Cond_String(const struct var *vp, struct tokenlist *tl) +vcc_Cond_String(const struct var *vp, struct tokenlist *tl) { char *p; @@ -255,7 +255,7 @@ } static void -Cond_Int(const struct var *vp, struct tokenlist *tl) +vcc_Cond_Int(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s ", vp->rname); @@ -284,14 +284,14 @@ } static void -Cond_Bool(const struct var *vp, const struct tokenlist *tl) +vcc_Cond_Bool(const struct var *vp, const struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); } static void -Cond_Backend(const struct var *vp, struct tokenlist *tl) +vcc_Cond_Backend(const struct var *vp, struct tokenlist *tl) { Fb(tl, 1, "%s\n", vp->rname); @@ -317,7 +317,7 @@ } static void -Cond_2(struct tokenlist *tl) +vcc_Cond_2(struct tokenlist *tl) { struct var *vp; @@ -330,7 +330,7 @@ } if (tl->t->tok == '(') { vcc_NextToken(tl); - Cond_0(tl); + vcc_Cond_0(tl); SkipToken(tl, ')'); } else if (tl->t->tok == VAR) { vp = vcc_FindVar(tl, tl->t, vcc_vars); @@ -338,14 +338,14 @@ assert(vp != NULL); vcc_NextToken(tl); switch (vp->fmt) { - case INT: L(tl, Cond_Int(vp, tl)); break; - case SIZE: L(tl, Cond_Int(vp, tl)); break; - case BOOL: L(tl, Cond_Bool(vp, tl)); break; + case INT: L(tl, vcc_Cond_Int(vp, tl)); break; + case SIZE: L(tl, vcc_Cond_Int(vp, tl)); break; + case BOOL: L(tl, vcc_Cond_Bool(vp, tl)); break; case IP: L(tl, vcc_Cond_Ip(vp, tl)); break; - case STRING: L(tl, Cond_String(vp, tl)); break; - case TIME: L(tl, Cond_Int(vp, tl)); break; - case RTIME: L(tl, Cond_Int(vp, tl)); break; - case BACKEND: L(tl, Cond_Backend(vp, tl)); break; + case STRING: L(tl, vcc_Cond_String(vp, tl)); break; + case TIME: L(tl, vcc_Cond_Int(vp, tl)); break; + case RTIME: L(tl, vcc_Cond_Int(vp, tl)); break; + case BACKEND: L(tl, vcc_Cond_Backend(vp, tl)); break; default: vsb_printf(tl->sb, "Variable '%s'" @@ -367,40 +367,40 @@ } static void -Cond_1(struct tokenlist *tl) +vcc_Cond_1(struct tokenlist *tl) { Fb(tl, 1, "(\n"); - L(tl, Cond_2(tl)); + L(tl, vcc_Cond_2(tl)); while (tl->t->tok == T_CAND) { vcc_NextToken(tl); Fb(tl, 1, ") && (\n"); - L(tl, Cond_2(tl)); + L(tl, vcc_Cond_2(tl)); } Fb(tl, 1, ")\n"); } static void -Cond_0(struct tokenlist *tl) +vcc_Cond_0(struct tokenlist *tl) { Fb(tl, 1, "(\n"); - L(tl, Cond_1(tl)); + L(tl, vcc_Cond_1(tl)); while (tl->t->tok == T_COR) { vcc_NextToken(tl); Fb(tl, 1, ") || (\n"); - L(tl, Cond_1(tl)); + L(tl, vcc_Cond_1(tl)); } Fb(tl, 1, ")\n"); } static void -Conditional(struct tokenlist *tl) +vcc_Conditional(struct tokenlist *tl) { SkipToken(tl, '('); Fb(tl, 1, "(\n"); - L(tl, Cond_0(tl)); + L(tl, vcc_Cond_0(tl)); ERRCHK(tl); Fb(tl, 1, ")\n"); SkipToken(tl, ')'); @@ -409,14 +409,14 @@ /*--------------------------------------------------------------------*/ static void -IfStmt(struct tokenlist *tl) +vcc_IfStmt(struct tokenlist *tl) { SkipToken(tl, T_IF); Fb(tl, 1, "if \n"); - L(tl, Conditional(tl)); + L(tl, vcc_Conditional(tl)); ERRCHK(tl); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); while (1) { switch (tl->t->tok) { @@ -424,7 +424,7 @@ vcc_NextToken(tl); if (tl->t->tok != T_IF) { Fb(tl, 1, "else \n"); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); return; } @@ -433,9 +433,9 @@ case T_ELSIF: Fb(tl, 1, "else if \n"); vcc_NextToken(tl); - L(tl, Conditional(tl)); + L(tl, vcc_Conditional(tl)); ERRCHK(tl); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); ERRCHK(tl); break; default: @@ -448,7 +448,7 @@ /*--------------------------------------------------------------------*/ static void -Compound(struct tokenlist *tl) +vcc_Compound(struct tokenlist *tl) { int i; @@ -460,10 +460,10 @@ ERRCHK(tl); switch (tl->t->tok) { case '{': - Compound(tl); + vcc_Compound(tl); break; case T_IF: - IfStmt(tl); + vcc_IfStmt(tl); break; case '}': vcc_NextToken(tl); @@ -502,7 +502,7 @@ /*--------------------------------------------------------------------*/ static void -Function(struct tokenlist *tl) +vcc_Function(struct tokenlist *tl) { int m; @@ -534,7 +534,7 @@ vcc_NextToken(tl); tl->indent += INDENT; Fb(tl, 1, "{\n"); - L(tl, Compound(tl)); + L(tl, vcc_Compound(tl)); if (m == -1) { /* * non-method subroutines must have an explicit non-action @@ -564,7 +564,7 @@ parse_f *func; } toplev[] = { { "acl", vcc_Acl }, - { "sub", Function }, + { "sub", vcc_Function }, { "backend", vcc_ParseDirector }, { "director", vcc_ParseDirector }, { NULL, NULL } From tfheen at varnish-cache.org Mon Apr 19 12:49:33 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 14:49:33 +0200 Subject: r4694 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 14:49:33 +0200 (Mon, 19 Apr 2010) New Revision: 4694 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_ws.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4666: Oops: Last commit to this file didn't actually get the changes it advertized: Align all WS allocations. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4665 + /trunk:4637,4640,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4666 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_ws.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_ws.c 2010-04-19 12:40:31 UTC (rev 4693) +++ branches/2.1/varnish-cache/bin/varnishd/cache_ws.c 2010-04-19 12:49:33 UTC (rev 4694) @@ -57,17 +57,17 @@ ws->r == NULL ? 0 : pdiff(ws->f, ws->r), pdiff(ws->s, ws->e)); assert(ws->s != NULL); - // assert(PAOK(ws->s)); + assert(PAOK(ws->s)); assert(ws->e != NULL); - // assert(PAOK(ws->e)); + assert(PAOK(ws->e)); assert(ws->s < ws->e); assert(ws->f >= ws->s); assert(ws->f <= ws->e); - // assert(PAOK(ws->f)); + assert(PAOK(ws->f)); if (ws->r) { assert(ws->r > ws->s); assert(ws->r <= ws->e); - // assert(PAOK(ws->r)); + assert(PAOK(ws->r)); } } @@ -176,7 +176,7 @@ b2 = ws->e - ws->f; else b2 = bytes; - // b2 = PRNDND(b2); + b2 = PRNDDN(b2); xxxassert(ws->f + b2 <= ws->e); ws->r = ws->f + b2; DSL(0x02, SLT_Debug, 0, "WS_Reserve(%p, %u/%u) = %u", @@ -189,7 +189,7 @@ WS_Release(struct ws *ws, unsigned bytes) { WS_Assert(ws); - // bytes = PRNDUP(bytes); + bytes = PRNDUP(bytes); assert(bytes <= ws->e - ws->f); DSL(0x02, SLT_Debug, 0, "WS_Release(%p, %u)", ws, bytes); assert(ws->r != NULL); @@ -207,8 +207,7 @@ assert(ws->r != NULL); assert(ptr >= ws->f); assert(ptr <= ws->r); - // ws->f += PRNDUP(ptr - ws->f); - ws->f += (ptr - ws->f); + ws->f += PRNDUP(ptr - ws->f); ws->r = NULL; WS_Assert(ws); } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4666 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4665 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4666 From tfheen at varnish-cache.org Mon Apr 19 13:03:14 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 19 Apr 2010 15:03:14 +0200 Subject: r4695 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-19 15:03:14 +0200 (Mon, 19 Apr 2010) New Revision: 4695 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c branches/2.1/varnish-cache/bin/varnishd/hash_slinger.h branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/include/vrt.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_action.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Merge r4667: Carry out a bit of internal renaming, and recognize that it was a really bad idea to call "bans" for "purges" some places. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4666 + /trunk:4637,4640,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4667 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-19 12:49:33 UTC (rev 4694) +++ branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-19 13:03:14 UTC (rev 4695) @@ -937,7 +937,7 @@ /*--------------------------------------------------------------------*/ void -VRT_purge(struct sess *sp, char *cmds, ...) +VRT_ban(struct sess *sp, char *cmds, ...) { char *a1, *a2, *a3; va_list ap; @@ -972,7 +972,7 @@ /*--------------------------------------------------------------------*/ void -VRT_purge_string(struct sess *sp, const char *str, ...) +VRT_ban_string(struct sess *sp, const char *str, ...) { char *p, *a1, *a2, *a3; char **av; Modified: branches/2.1/varnish-cache/bin/varnishd/hash_slinger.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/hash_slinger.h 2010-04-19 12:49:33 UTC (rev 4694) +++ branches/2.1/varnish-cache/bin/varnishd/hash_slinger.h 2010-04-19 13:03:14 UTC (rev 4695) @@ -64,6 +64,7 @@ void HSH_DerefObjCore(struct sess *sp); void HSH_FindBan(struct sess *sp, struct objcore **oc); struct objcore *HSH_Insert(const struct sess *sp); +void HSH_Purge(struct sess *, struct objhead *, double ttl, double grace); #ifdef VARNISH_CACHE_CHILD Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4667 Modified: branches/2.1/varnish-cache/include/vrt.h =================================================================== --- branches/2.1/varnish-cache/include/vrt.h 2010-04-19 12:49:33 UTC (rev 4694) +++ branches/2.1/varnish-cache/include/vrt.h 2010-04-19 13:03:14 UTC (rev 4695) @@ -136,8 +136,8 @@ void *, const char *); void VRT_panic(struct sess *sp, const char *, ...); -void VRT_purge(struct sess *sp, char *, ...); -void VRT_purge_string(struct sess *sp, const char *, ...); +void VRT_ban(struct sess *sp, char *, ...); +void VRT_ban_string(struct sess *sp, const char *, ...); void VRT_count(const struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4667 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4667 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 12:49:33 UTC (rev 4694) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_action.c 2010-04-19 13:03:14 UTC (rev 4695) @@ -325,7 +325,7 @@ vcc_NextToken(tl); if (tl->t->tok == VAR) { - Fb(tl, 1, "VRT_purge(sp,\n"); + Fb(tl, 1, "VRT_ban(sp,\n"); tl->indent += INDENT; while (1) { ExpectErr(tl, VAR); @@ -379,7 +379,7 @@ Fb(tl, 1, "0);\n"); tl->indent -= INDENT; } else { - Fb(tl, 1, "VRT_purge_string(sp, "); + Fb(tl, 1, "VRT_ban_string(sp, "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; @@ -404,7 +404,7 @@ Expect(tl, '('); vcc_NextToken(tl); - Fb(tl, 1, "VRT_purge(sp, \"req.url\", \"~\", "); + Fb(tl, 1, "VRT_ban(sp, \"req.url\", \"~\", "); if (!vcc_StringVal(tl)) { vcc_ExpectedStringval(tl); return; Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4666 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4667 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-19 12:49:33 UTC (rev 4694) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-19 13:03:14 UTC (rev 4695) @@ -279,10 +279,10 @@ 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 *, ...);\n"); - vsb_cat(sb, "void VRT_purge(struct sess *sp, char *, ...);\n"); - vsb_cat(sb, "void VRT_purge_string(struct sess *sp, const char *, ."); - vsb_cat(sb, "..);\n\nvoid VRT_count(const struct sess *, unsigned);"); - vsb_cat(sb, "\nint VRT_rewrite(const char *, const char *);\n"); + vsb_cat(sb, "void VRT_ban(struct sess *sp, char *, ...);\n"); + vsb_cat(sb, "void VRT_ban_string(struct sess *sp, const char *, ..."); + vsb_cat(sb, ");\n\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"); From phk at varnish-cache.org Tue Apr 20 13:15:11 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 20 Apr 2010 15:15:11 +0200 Subject: r4696 - in trunk/varnish-cache/doc: . sphinx sphinx/installation sphinx/reference sphinx/tutorial Message-ID: Author: phk Date: 2010-04-20 15:15:09 +0200 (Tue, 20 Apr 2010) New Revision: 4696 Added: trunk/varnish-cache/doc/sphinx/ trunk/varnish-cache/doc/sphinx/=build/ trunk/varnish-cache/doc/sphinx/=static/ trunk/varnish-cache/doc/sphinx/=templates/ trunk/varnish-cache/doc/sphinx/Makefile trunk/varnish-cache/doc/sphinx/conf.py trunk/varnish-cache/doc/sphinx/index.rst trunk/varnish-cache/doc/sphinx/installation/ trunk/varnish-cache/doc/sphinx/installation/index.rst trunk/varnish-cache/doc/sphinx/reference/ trunk/varnish-cache/doc/sphinx/reference/index.rst trunk/varnish-cache/doc/sphinx/tutorial/ trunk/varnish-cache/doc/sphinx/tutorial/index.rst Log: Add a Sphinx directory and my outlines for three varnish documents: installation, tutorial and reference. Please feel free to help flesh these out. See http://sphinx.pocoo.org for more on the tool we are using. To build html version, go into doc/sphinx and type "make html" result should end up under the =build subdirectory. Added: trunk/varnish-cache/doc/sphinx/Makefile =================================================================== --- trunk/varnish-cache/doc/sphinx/Makefile (rev 0) +++ trunk/varnish-cache/doc/sphinx/Makefile 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,89 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = =build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Varnish.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Varnish.qhc" + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \ + "run these through (pdf)latex." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." Added: trunk/varnish-cache/doc/sphinx/conf.py =================================================================== --- trunk/varnish-cache/doc/sphinx/conf.py (rev 0) +++ trunk/varnish-cache/doc/sphinx/conf.py 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,194 @@ +# -*- coding: utf-8 -*- +# +# Varnish documentation build configuration file, created by +# sphinx-quickstart on Tue Apr 20 13:02:15 2010. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.append(os.path.abspath('.')) + +# -- General configuration ----------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = ['sphinx.ext.todo'] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['=templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'Varnish' +copyright = u'2010, Varnish Project' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '-trunk' +# The full version, including alpha/beta/rc tags. +release = '-trunk' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of documents that shouldn't be included in the build. +#unused_docs = [] + +# List of directories, relative to source directory, that shouldn't be searched +# for source files. +exclude_trees = ['=build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. Major themes that come with +# Sphinx are currently 'default' and 'sphinxdoc'. +html_theme = 'default' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +#html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = None + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['=static'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_use_modindex = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = '' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'Varnishdoc' + + +# -- Options for LaTeX output -------------------------------------------------- + +# The paper size ('letter' or 'a4'). +#latex_paper_size = 'letter' + +# The font size ('10pt', '11pt' or '12pt'). +#latex_font_size = '10pt' + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +latex_documents = [ + ('index', 'Varnish.tex', u'Varnish Documentation', + u'Varnish Project', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# Additional stuff for the LaTeX preamble. +#latex_preamble = '' + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_use_modindex = True Added: trunk/varnish-cache/doc/sphinx/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/index.rst 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,24 @@ +.. Varnish documentation master file, created by + sphinx-quickstart on Tue Apr 20 13:02:15 2010. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to Varnish's documentation! +=================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + installation/index.rst + tutorial/index.rst + reference/index.rst + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + Added: trunk/varnish-cache/doc/sphinx/installation/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,19 @@ +%%%%%%%%%%%%%%%%%%%% +Varnish Installation +%%%%%%%%%%%%%%%%%%%% + +.. todo:: + on this os, pull this package + .. that ..//.. + to compile from source + how to get help + - mailing list + - IRC + - varnish-software.com + - other listed consultants + reporting bugs + - using varnishtest to reproduce + - what data do we need + - confidentiality + - ... + Added: trunk/varnish-cache/doc/sphinx/reference/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/reference/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/reference/index.rst 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,35 @@ +%%%%%%%%%%%%%%%%%%%%% +The Varnish Reference +%%%%%%%%%%%%%%%%%%%%% + +.. todo:: + The programs: + . varnishd manual page + . varnishstat + . - counters explained + . common filtering options for shmlog tools + . varnishlog .. + . varnsihtop .. + . varnsihncsa .. + . varnsihhist .. + The CLI: + . connections: -T -S -M + . varnishadm + . CLI commands and what they do + . - vcl.load + . - stop + . - start + . - ... + VCL language + . The functions: + . - vcl_recv + . - vcl_miss + . --- + . The things you can do + . - set + . - unset + . - esi + . - rollback + Varnishtest + . syntax etc. + Added: trunk/varnish-cache/doc/sphinx/tutorial/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/tutorial/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/tutorial/index.rst 2010-04-20 13:15:09 UTC (rev 4696) @@ -0,0 +1,25 @@ +%%%%%%%%%%%%%%%% +Varnish Tutorial +%%%%%%%%%%%%%%%% + +.. todo:: + starting varnish with -d, seeing a transaction go through + explain varnishlog output for a miss and a hit + a few simple VCL tricks, including switching VCL on the fly + The helpers: varnishstat, varnishhist, varnishtop varnishncsa + Now that you know how it works, lets talk planning: + - backend, directors and polling + - storage + - logging + - management CLI & security + - ESI + Real life examples: + - A real life varnish explained + - A more complex real life varnish explained + - Sky's Wikia Setup + Varnishtest + - What varnishtest does and why + - writing simple test-cases + - using varnishtest to test your VCL + - using varnishtest to reproduce bugs + From phk at varnish-cache.org Tue Apr 20 13:35:52 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 20 Apr 2010 15:35:52 +0200 Subject: r4697 - trunk/varnish-cache/doc/sphinx Message-ID: Author: phk Date: 2010-04-20 15:35:51 +0200 (Tue, 20 Apr 2010) New Revision: 4697 Modified: trunk/varnish-cache/doc/sphinx/index.rst Log: Add boilerplate explanation Modified: trunk/varnish-cache/doc/sphinx/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/index.rst 2010-04-20 13:15:09 UTC (rev 4696) +++ trunk/varnish-cache/doc/sphinx/index.rst 2010-04-20 13:35:51 UTC (rev 4697) @@ -6,6 +6,11 @@ Welcome to Varnish's documentation! =================================== +We are making a fresh start on the documentation, our previous attempts +have utterly failed, but my discovery of Sphinx_/reStructuredText_ as tools +for writing documentation gives me hope that we have finally found a +platform, that we can kick ourselves to actually use. + Contents: .. toctree:: @@ -22,3 +27,81 @@ * :ref:`modindex` * :ref:`search` +Why Sphinx_ and reStructuredText_ ? +=================================== + +The first school of thought on documentation, is the one we subscribe +to in Varnish right now: "Documentation schmocumentation..." It does +not work for anybody. + +The second school is the "Write a {La}TeX document" school, where +the documentation is seen as a stand alone product, which is produced +independently. This works great for PDF output, and sucks royally +for HTML and TXT output. + +The third school is the "Literate programming" school, which abandons +readability of *both* the program source code *and* the documentation +source, which seems to be one of the best access protections +one can put on the source code of either. + +The fourth school is the "DoxyGen" school, which lets a program +collect a mindless list of hyperlinked variable, procedure, class +and filenames, and call that "documentation". + +And the fifth school is anything that uses a fileformat that +cannot be put into a version control system, because it is +binary and non-diff'able. It doesn't matter if it is +OpenOffice, LyX or Word, a non-diffable doc source is a no go +with programmers. + +Quite frankly, none of these works very well in practice. + +One of the very central issues, is that writing documentation must +not become a big and clear context-switch from programming. That +precludes special graphical editors, browser-based (wiki!) formats +etc. + +Yes, if you write documentation for half your workday, that works, +but if you write code most of your workday, that does not work. +Trust me on this, I have 25 years of experience avoiding using such +tools. + +I found one project which has thought radically about the problem, +and their reasoning is interesting, and quite attractive to me: + +#. TXT files are the lingua franca of computers, even if + you are logged with TELNET using IP over Avian Carriers + (Which is more widespread in Norway than you would think) + you can read documentation in a .TXT format. + +#. TXT is the most restrictive typographical format, so + rather than trying to neuter a high-level format into .TXT, + it is smarter to make the .TXT the source, and reinterpret + it structurally into the more capable formats. + +In other words: we are talking about the ReStructuredText_ of the +Python project, as wrapped by the Sphinx_ project. + +Unless there is something I have totally failed to spot, that is +going to be the new documentation platform in Varnish. + +Take a peek at the Python docs, and try pressing the "show source" +link at the bottom of the left menu: + +(link to random python doc page:) + + http://docs.python.org/py3k/reference/expressions.html + +Dependency wise, that means you can edit docs with no special +tools, you need python+docutils+sphinx to format HTML and a LaTex +(pdflatex ?) to produce PDFs, something I only expect to happen +on the project server on a regular basis. + +I can live with that, I might even rewrite the VCC scripts +from Tcl to Python in that case. + +Poul-Henning, 2010-04-11 + + +.. _Sphinx: http://http://sphinx.pocoo.org/ +.. _reStructuredText: http://docutils.sourceforge.net/rst.html From phk at varnish-cache.org Tue Apr 20 14:18:16 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 20 Apr 2010 16:18:16 +0200 Subject: r4698 - trunk/varnish-cache/doc/sphinx Message-ID: Author: phk Date: 2010-04-20 16:18:15 +0200 (Tue, 20 Apr 2010) New Revision: 4698 Modified: trunk/varnish-cache/doc/sphinx/index.rst Log: More HTTP: than you require Modified: trunk/varnish-cache/doc/sphinx/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/index.rst 2010-04-20 13:35:51 UTC (rev 4697) +++ trunk/varnish-cache/doc/sphinx/index.rst 2010-04-20 14:18:15 UTC (rev 4698) @@ -103,5 +103,5 @@ Poul-Henning, 2010-04-11 -.. _Sphinx: http://http://sphinx.pocoo.org/ +.. _Sphinx: http://sphinx.pocoo.org/ .. _reStructuredText: http://docutils.sourceforge.net/rst.html From phk at varnish-cache.org Tue Apr 20 16:06:39 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 20 Apr 2010 18:06:39 +0200 Subject: r4699 - in trunk/varnish-cache/doc/sphinx: installation tutorial Message-ID: Author: phk Date: 2010-04-20 18:06:38 +0200 (Tue, 20 Apr 2010) New Revision: 4699 Added: trunk/varnish-cache/doc/sphinx/installation/install.rst Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst trunk/varnish-cache/doc/sphinx/tutorial/index.rst Log: A first cut at installing Varnish on your system. Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-20 14:18:15 UTC (rev 4698) +++ trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-20 16:06:38 UTC (rev 4699) @@ -2,10 +2,19 @@ Varnish Installation %%%%%%%%%%%%%%%%%%%% +This manual explains how to get Varnish onto your system, where +to get help, how report bugs etc. In other words, it is a manual +about pretty much everything else than actually using Varnish to +move traffic. + +.. toctree:: + + install.rst + .. todo:: - on this os, pull this package - .. that ..//.. - to compile from source + [V] on this os, pull this package + [V] .. that ..//.. + [V] to compile from source how to get help - mailing list - IRC Added: trunk/varnish-cache/doc/sphinx/installation/install.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/install.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/installation/install.rst 2010-04-20 16:06:38 UTC (rev 4699) @@ -0,0 +1,158 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +Installing Varnish on your computer +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +With open source software, you can choose to install binary +packages or compile stuff from source-code. + +In general, from a point of principle, I would argue that +everybody should compile from source, but realistically +binary packages are *so much easier* so lets cover that first: + + +Installing Varnish from packages +================================ + +Installing Varnish on most relevant operating systems can usually +be done with with the systems package manager, typical examples +being: + +FreeBSD (from source) + ``cd /usr/ports/varnish && make install clean`` +FreeBSD (binary package) + ``pkg_add -r varnish`` + +If that worked for you, you can skip the rest of this document +for now, and and start reading the much more interesting :ref:`Tutorial` +instead. + + +Compiling Varnish from source +============================= + +If there are no binary packages available for your system, or if you +want to compile Varnish from source for other reasons, follow these +steps: + +First get a copy of the sourcecode using the ``svn`` command. If +you do not have this command, you need to install SubVersion_ on +your system. There is usually a binary package, try substituting +"subversion" for "varnish" in the examples above, it might just work. + +To get the development source code:: + + svn co http://varnish-cache.org/svn/varnish/trunk + +or if you want the production branch:: + + svn co http://varnish-cache.org/svn/varnish/branches/2.1 + +Next, configuration: For this you will need ``libtoolize``, ``aclocal``, +``autoheader``, ``automake`` and ``autoconf``, also known as *the +autocrap tools* installed on your system. + +Once you have them:: + + cd varnish-cache + sh autogen.sh + sh configure + make + +The ``configure`` script takes some arguments, but more likely than +not, you can forget about that for now, almost everything in Varnish +are runtime parameters. + +Before you install, you may want to run the regression tests, make +a cup of tea while it runs, it takes some minutes:: + + (cd bin/varnishtest && ./varnishtest tests/*.vtc) + +Don't worry of a single or two tests fail, some of the tests are a +bit too timing sensitive (Please tell us which so we can fix it) but +if a lot of them fails, and in particular if the ``b00000.vtc`` test +fails, something is horribly wrong, and you will get nowhere without +figuring out what. + +And finally, the true test of a brave heart:: + + make install + +.. _SubVersion: http://subversion.tigris.org/ + + +Did you call them *autocrap* tools ? +==================================== + +Yes, in fact I did, because they are the worst possible non-solution +to a self-inflicted problem. + +Back in the 1980'ies, the numerous mini- and micro-computer companies +all jumped on the UNIX band-wagon, because it gave them an operating +system for their hardware, but they also tried to "distinguish" themselves +from the competitors, by "adding value". + +That "value" was incompatibility. + +You never knew where they put stuff, what arguments the compiler needed +to behave sensibly, or for that matter, if there were a compiler to begin +with. + +So some deranged imagination, came up with the idea of the ``configure`` +script, which sniffed at your system and set up a ``Makefile`` that would +work. + +Writing configure scripts was hard work, for one thing you needed a ton +of different systems to test them on, so copy&paste became the order of +the day. + +Then some even more deranged imagination, came up with the idea of +writing a script for writing configure scripts, and in an amazing +and daring attempt at the "all time most deranged" crown, used an +obscure and insufferable macro-processor called ``m4`` for the +implementation. + +Now, as it transpires, writing the specification for the configure +producing macros was tedious, so somebody wrote a tool to... + +...do you detect the pattern here ? + +Now, if the result of all this crap, was that I could write my source-code +and tell a tool where the files were, and not only assume, but actually +*trust* that things would just work out, then I could live with it. + +But as it transpires, that is not the case. For one thing, all the +autocrap tools add another layer of version-madness you need to get +right before you can even think about compiling the source code. + +Second, it doesn't actually work, you still have to do the hard work +and figure out the right way to explain to the autocrap tools what +you are trying to do and how to do it, only you have to do so in +a language which is used to produce M4 macro invocations etc. etc. + +In the meantime, the UNIX diversity has shrunk from 50+ significantly +different dialects to just a handful: Linux, \*BSD, Solaris and AIX +and the autocrap tools have become part of the portability problem, +rather than part of the solution. + +Amongst the silly activites of the autocrap generated configure script +in Varnish are: + +* Looks for ANSI-C header files (show me a system later + than 1995 without them ?) + +* Existence and support for POSIX mandated symlinks, (which + are not used by Varnish btw.) + +* Tests, 19 different ways, that the compiler is not a relic from + SYS III days. (Find me just one SYS III running computer with + an ethernet interface ?) + +* Checks if the ISO-C and POSIX mandated ``cos()`` function exists + in ``libm`` (No, I have no idea either...) + +&c. &c. &c. + +Some day when I have the time, I will rip out all the autocrap stuff +and replace it with a 5 line shellscript that calls ``uname -s``. + +Poul-Henning, 2010-04-20 Modified: trunk/varnish-cache/doc/sphinx/tutorial/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/tutorial/index.rst 2010-04-20 14:18:15 UTC (rev 4698) +++ trunk/varnish-cache/doc/sphinx/tutorial/index.rst 2010-04-20 16:06:38 UTC (rev 4699) @@ -1,3 +1,5 @@ +.. _Tutorial: + %%%%%%%%%%%%%%%% Varnish Tutorial %%%%%%%%%%%%%%%% From phk at varnish-cache.org Wed Apr 21 05:53:41 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 21 Apr 2010 07:53:41 +0200 Subject: r4700 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: Author: phk Date: 2010-04-21 07:53:41 +0200 (Wed, 21 Apr 2010) New Revision: 4700 Modified: trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc Log: Tune Range: handling based on real-world sample: Also support: bytes=-%d bytes=%d- bytes=- And ignore plain wrong cases, such as starter past end of object or end before start etc. Modified: trunk/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-20 16:06:38 UTC (rev 4699) +++ trunk/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 05:53:41 UTC (rev 4700) @@ -137,41 +137,51 @@ if (strncmp(r, "bytes=", 6)) return; r += 6; - printf("-----------------RANGE: <%s>\n", r); + + /* The low end of range */ low = 0; - high = 0; - if (!vct_isdigit(*r)) + if (!vct_isdigit(*r) && *r != '-') return; while (vct_isdigit(*r)) { low *= 10; low += *r - '0'; r++; } + + if (low >= sp->obj->len) + return; + if (*r != '-') return; r++; - if (!vct_isdigit(*r)) - return; - while (vct_isdigit(*r)) { - high *= 10; - high += *r - '0'; - r++; - } + + /* The high end of range */ + if (vct_isdigit(*r)) { + high = 0; + while (vct_isdigit(*r)) { + high *= 10; + high += *r - '0'; + r++; + } + } else + high = sp->obj->len - 1; if (*r != '\0') return; - printf("-----------------RANGE: %u %u\n", low, high); + if (high >= sp->obj->len) - high = sp->obj->len - 1; - if (low == 0 && high >= sp->obj->len) + high = sp->obj->len; + + if (low > high) return; - http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Content-Range: bytes %u-%u/%u", low, high, sp->obj->len); http_Unset(sp->wrk->resp, H_Content_Length); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Content-Length: %u", 1 + high - low); http_SetResp(sp->wrk->resp, "HTTP/1.1", "206", "Partial Content"); + + *plow = low; *phigh = high; } Modified: trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-20 16:06:38 UTC (rev 4699) +++ trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-21 05:53:41 UTC (rev 4700) @@ -51,9 +51,39 @@ expect resp.status == 206 expect resp.bodylen == 10 - txreq -hdr "Range: bytes=90-101" + txreq -hdr "Range: bytes=90-" rxresp expect resp.status == 206 expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=-9" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=102-102" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=99-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 1 + + txreq -hdr "Range: bytes=99-70" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 100 } -run From phk at varnish-cache.org Wed Apr 21 07:48:24 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 21 Apr 2010 09:48:24 +0200 Subject: r4701 - trunk/varnish-cache/doc/sphinx/installation Message-ID: Author: phk Date: 2010-04-21 09:48:24 +0200 (Wed, 21 Apr 2010) New Revision: 4701 Added: trunk/varnish-cache/doc/sphinx/installation/help.rst Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst Log: A manual page a day, keeps the users abay ? Added: trunk/varnish-cache/doc/sphinx/installation/help.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/help.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/installation/help.rst 2010-04-21 07:48:24 UTC (rev 4701) @@ -0,0 +1,90 @@ +%%%%%%%%%%%%%%%%%% +Getting hold of us +%%%%%%%%%%%%%%%%%% + +Getting hold of the gang behind Varnish is pretty straight forward, +we try to help as much as time permits and have tried to streamline +this process as much as possible. + +But before you grab hold of us, spend a moment composing your thoughts and +formulate your question, there is nothing as pointless as simply telling +us "Varnish does not work for me" with no further information to give +any clue to why. + +And before you even do that, do a couple of searches to see if your +question is already answered, if it has been, you will get your answer +much faster that way. + +IRC Channel +=========== + +The most immediate way to get hold of us, is to join our IRC channel: + + ``#varnish on server irc.linpro.no`` + +The main timezone of the channel is Europe+America. + +If you can explain your problem in a few clear sentences, without too +much copy&paste, IRC is a good way to try to get help. + +If the channel is all quiet, try again some time later, we do have lives, +families and jobs to deal with also. + +You are more than welcome to just hang out, and while we don't mind +the occational intrusion of the real world into the flow, keep +it mostly on topic, and dont paste random links unless they are +*really* spectacular and intelligent. + +Mailing Lists +============= + +Getting on or off our mailinglist happens through MailMan_. + +If you are going to use Varnish, subscribing to our ``varnish-announce`` +mailing list is probably a very good idea. The typical pattern is that +people spend some time getting Varnish running, and then more or less +forget about it. Therefore the announce list is a good way to be +reminded about new releases, bad bugs or security holes. + +The ``varnish-misc`` mailing list is for general banter, questions, +suggestions, ideas and so on. If you are new to Varnish it may pay +off to subscribe to -misc, simply to have an ear to the telegraph-pole +and learn some smart tricks. This is a good place to ask for help +with more complex issues, that require quoting of files and longis +explanations. + +Make sure to pick a good subject line, and if the subject of the +thread changes, please change the subject to match, some of us deal +with hundreds of emails per day, after spam-filters, and we need all +the help we can get to pick the interesting ones. + +The ``varnish-dev`` mailing list is used by the developers and is +usually quite focused on source-code and such. Everybody on +the -dev list is also on -misc, so cross-posting only serves to annoy +those people. + +Trouble Tickets +=============== + +Please do not open a trouble ticket, unless you have spotted an actual +bug in Varnish. Ask on IRC first if you are in doubt. + +The reason for this policy, is to avoid the bugs being drowned in a +pile of sensible suggestions for future enhancements and call for help +from people who forget to check back if they get it and so on. + +We track suggestions and ideas in our "Shopping-List" wiki page, and user +support via email and IRC. + +Commercial Support +================== + +The following companies offer commercial Varnish support, and are listed +here for your convenience. If you want your company listed here, drop +an email to phk at FreeBSD.org. + + Varnish Software + perbu at varnish-software.com + + +.. _Mailman: http://lists.varnish-cache.org/mailman/listinfo Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-21 05:53:41 UTC (rev 4700) +++ trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-21 07:48:24 UTC (rev 4701) @@ -10,6 +10,7 @@ .. toctree:: install.rst + help.rst .. todo:: [V] on this os, pull this package From phk at varnish-cache.org Wed Apr 21 09:01:56 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 21 Apr 2010 11:01:56 +0200 Subject: r4702 - trunk/varnish-cache/doc/sphinx/installation Message-ID: Author: phk Date: 2010-04-21 11:01:56 +0200 (Wed, 21 Apr 2010) New Revision: 4702 Added: trunk/varnish-cache/doc/sphinx/installation/bugs.rst Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst Log: More doc Added: trunk/varnish-cache/doc/sphinx/installation/bugs.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/bugs.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/installation/bugs.rst 2010-04-21 09:01:56 UTC (rev 4702) @@ -0,0 +1,124 @@ +%%%%%%%%%%%%%% +Reporting bugs +%%%%%%%%%%%%%% + +Varnish can be a tricky beast to debug, having potentially thousands +of threads crowding into a few data structures makes for *interesting* +core dumps. + +Actually, let me rephrase that without irony: You tire of the "no, +not thread 438 either, lets look at 439 then..." routine really fast. + +So if you run into a bug, it is important that you spend a little bit +of time collecting the right information, to help us fix the bug. + +Roughly we have three clases of bugs with Varnish. + +Varnish crashes +=============== + +Plain and simple: **boom** + +Varnish is split over two processes, the manager and the child. The child +does all the work, and the manager hangs around to resurect it, if it +crashes. + +Therefore, the first thing to do if you see a varnish crash, is to examine +your syslogs, to see if it has happened before. (One site is rumoured +to have had varnish restarting every 10 minutes and *still* provide better +service than their CMS system.) + +When it crashes, if at all possible, Varnish will spew out a crash dump +that looks something like:: + + Child (32619) died signal=6 (core dumped) + Child (32619) Panic message: Assert error in ccf_panic(), cache_cli.c line 153: + Condition(!strcmp("", "You asked for it")) not true. + errno = 9 (Bad file descriptor) + thread = (cache-main) + ident = FreeBSD,9.0-CURRENT,amd64,-sfile,-hcritbit,kqueue + Backtrace: + 0x42bce1: pan_ic+171 + 0x4196af: ccf_panic+4f + 0x8006b3ef2: _end+80013339a + 0x8006b4307: _end+8001337af + 0x8006b8b76: _end+80013801e + 0x8006b8d84: _end+80013822c + 0x8006b51c1: _end+800134669 + 0x4193f6: CLI_Run+86 + 0x429f8b: child_main+14b + 0x43ef68: start_child+3f8 + [...] + +If you can get that information to us, we are usually able to +see exactly where things went haywire, and that speeds up bugfixing +a lot. + +There will be a lot more information than this, and before sending +it all to us, you should obscure any sensitive/secret +data/cookies/passwords/ip# etc. Please make sure to keep context +when you do so, ie: do not change all the IP# to "X.X.X.X", but +change each IP# to something unique, otherwise we are likely to be +more confused than informed. + +The most important line is the "Panic Message", which comes in two +general forms: + +"Missing errorhandling code in ..." + This is a place where we can conceive ending up, and have not + (yet) written the padded-box error handling code for. + + The most likely cause here, is that you need a larger workspace + for HTTP headers and Cookies. (XXX: which params to tweak) + + Please try that before reporting a bug. + +"Assert error in ..." + This is something bad that should never happen, and a bug + report is almost certainly in order. As always, if in doubt + ask us on IRC before opening the ticket. + +In your syslog it may all be joined into one single line, but if you +can reproduce the crash, do so while running varnishd manually: + + ``varnishd -d |& tee /tmp/_catch_bug`` + +That will get you the entire panic message into a file. + +(Remember to type ``start`` to launch the worker process, that is not +automatic when ``-d`` is used.) + +Varnish goes on vacation +======================== + +This kind of bug is nasty to debug, because usually people tend to +kill the process and send us an email saying "Varnish hung, I +restarted it" which gives us only about 1.01 bit of usable debug +information to work with. + +What we need here is all the information can you squeeze out of +your operating system **before** you kill the Varnish process. + +One of the most valuable bits of information, is if all Varnish' +threads are waiting for something or if one of them is spinning +furiously on some futile condition. + +Commands like ``top -H`` or ``ps -Haxlw`` or ``ps -efH`` should be +able to figure that out. + +If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` +(or whatever else your OS provides) to get a trace of which system calls +the varnish process issues. Be aware that this may generate a lot +of very repetitive data, usually one second worth is more than enough. + +Also, run ``varnishlog`` for a second, and collect the output +for us, and if ``varnishstat`` shows any activity, capture that also. + +When you have done this, kill the Varnish *child* process, and let +the *master* process restart it. Remember to tell us if that does +or does not work. If it does not, kill all Varnish processes, and +start from scratch. If that does not work either, tell us, that +means that we have wedged your kernel. + + + Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-21 07:48:24 UTC (rev 4701) +++ trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-21 09:01:56 UTC (rev 4702) @@ -11,16 +11,17 @@ install.rst help.rst + bugs.rst .. todo:: [V] on this os, pull this package [V] .. that ..//.. [V] to compile from source - how to get help - - mailing list - - IRC - - varnish-software.com - - other listed consultants + [V] how to get help + [V]- mailing list + [V] - IRC + [V] - varnish-software.com + [V] - other listed consultants reporting bugs - using varnishtest to reproduce - what data do we need From tfheen at varnish-cache.org Wed Apr 21 09:18:39 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 11:18:39 +0200 Subject: r4703 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 11:18:39 +0200 (Wed, 21 Apr 2010) New Revision: 4703 Added: branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_hash.c branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/include/vrt.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c Log: Merge r4668: Add a, for now, unsupported & experimental facility. See test-case for details. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4667 + /trunk:4637,4640,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4668 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_hash.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_hash.c 2010-04-21 09:01:56 UTC (rev 4702) +++ branches/2.1/varnish-cache/bin/varnishd/cache_hash.c 2010-04-21 09:18:39 UTC (rev 4703) @@ -308,6 +308,8 @@ return (oc); } +/********************************************************************** + */ struct objcore * HSH_Lookup(struct sess *sp, struct objhead **poh) @@ -353,8 +355,8 @@ VTAILQ_FOREACH(oc, &oh->objcs, list) { /* Must be at least our own ref + the objcore we examine */ assert(oh->refcnt > 1); + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); assert(oc->objhead == oh); - CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); if (oc->flags & OC_F_PERSISTENT) SMP_Fixup(sp, oh, oc); @@ -455,6 +457,9 @@ return (oc); } +/********************************************************************** + */ + static void hsh_rush(struct objhead *oh) { @@ -483,6 +488,56 @@ } /********************************************************************** + * Purge an entire objhead + */ + +void +HSH_Purge(struct sess *sp, struct objhead *oh, double ttl, double grace) +{ + struct objcore *oc, **ocp; + unsigned spc, nobj, n; + struct object *o; + + CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); + spc = WS_Reserve(sp->wrk->ws, 0); + ocp = (void*)sp->wrk->ws->f; + Lck_Lock(&oh->mtx); + assert(oh->refcnt > 0); + nobj = 0; + VTAILQ_FOREACH(oc, &oh->objcs, list) { + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + assert(oc->objhead == oh); + + if (oc->flags & OC_F_PERSISTENT) + SMP_Fixup(sp, oh, oc); + + xxxassert(spc >= sizeof *ocp); + oc->refcnt++; + spc -= sizeof *ocp; + ocp[nobj++] = oc; + } + Lck_Unlock(&oh->mtx); + + if (ttl <= 0) + ttl = -1; + for (n = 0; n < nobj; n++) { + oc = ocp[n]; + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + o = oc->obj; + if (o == NULL) + continue; + CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); + o->ttl = sp->t_req + ttl; + if (!isnan(grace)) + o->grace = grace; + EXP_Rearm(o); + HSH_Deref(sp->wrk, &o); + } + WS_Release(sp->wrk->ws, 0); +} + + +/********************************************************************** * Kill a busy object we don't need anyway. * There may be sessions on the waiting list, so we cannot just blow * it out of the water. Modified: branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-21 09:01:56 UTC (rev 4702) +++ branches/2.1/varnish-cache/bin/varnishd/cache_vrt.c 2010-04-21 09:18:39 UTC (rev 4703) @@ -1024,6 +1024,19 @@ } /*-------------------------------------------------------------------- + * "real" purges + */ + +void +VRT_purge(struct sess *sp, double ttl, double grace) +{ + if (sp->cur_method == VCL_MET_HIT) + HSH_Purge(sp, sp->obj->objcore->objhead, ttl, grace); + else if (sp->cur_method == VCL_MET_MISS) + HSH_Purge(sp, sp->objcore->objhead, ttl, grace); +} + +/*-------------------------------------------------------------------- * Simple stuff */ Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4668 Copied: branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc (from rev 4668, trunk/varnish-cache/bin/varnishtest/tests/c00033.vtc) =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc (rev 0) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc 2010-04-21 09:18:39 UTC (rev 4703) @@ -0,0 +1,89 @@ +# $Id$ + +test "real purges" + +server s1 { + rxreq + txresp -hdr "Vary: foo" -bodylen 1 + rxreq + txresp -hdr "Vary: foo" -bodylen 2 + rxreq + txresp -hdr "Vary: foo" -bodylen 3 + rxreq + txresp -hdr "Vary: foo" -bodylen 4 + rxreq + txresp -hdr "Vary: foo" -bodylen 5 + rxreq + txresp -hdr "Vary: foo" -bodylen 6 +} -start + +varnish v1 -vcl+backend { + + sub vcl_recv { + if (req.request == "PURGE") { + return (lookup); + } + } + + sub vcl_hit { + if (req.request == "PURGE") { + C{ VRT_purge(sp, 0, 0); }C + error 456 "got it"; + } + } + sub vcl_miss { + if (req.request == "PURGE") { + C{ VRT_purge(sp, 0, 0); }C + error 456 "got it"; + } + } +} -start + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 1 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 2 + + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 1 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 2 + + txreq -req "PURGE" -hdr "foo: bar1" + rxresp + expect resp.status == 456 +} -run + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 3 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 4 + + txreq -req "PURGE" -hdr "foo: bar3" + rxresp + expect resp.status == 456 +} -run + +client c1 { + txreq -hdr "foo: bar1" + rxresp + expect resp.bodylen == 5 + + txreq -hdr "foo: bar2" + rxresp + expect resp.bodylen == 6 + +} -run + + Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4668 Modified: branches/2.1/varnish-cache/include/vrt.h =================================================================== --- branches/2.1/varnish-cache/include/vrt.h 2010-04-21 09:01:56 UTC (rev 4702) +++ branches/2.1/varnish-cache/include/vrt.h 2010-04-21 09:18:39 UTC (rev 4703) @@ -138,6 +138,7 @@ void VRT_panic(struct sess *sp, const char *, ...); void VRT_ban(struct sess *sp, char *, ...); void VRT_ban_string(struct sess *sp, const char *, ...); +void VRT_purge(struct sess *sp, double ttl, double grace); void VRT_count(const struct sess *, unsigned); int VRT_rewrite(const char *, const char *); Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4668 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4667 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4668 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-21 09:01:56 UTC (rev 4702) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-21 09:18:39 UTC (rev 4703) @@ -227,8 +227,8 @@ 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"); - vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4428 2010-01-06 17:"); - vsb_cat(sb, "38:59Z tfheen $\n *\n * Runtime support for compiled V"); + vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4695 2010-04-19 13:"); + vsb_cat(sb, "03:14Z tfheen $\n *\n * Runtime support for compiled V"); vsb_cat(sb, "CL programs.\n *\n * XXX: When this file is changed, l"); vsb_cat(sb, "ib/libvcl/vcc_gen_fixed_token.tcl\n"); vsb_cat(sb, " * XXX: *MUST* be rerun.\n */\n"); @@ -281,8 +281,9 @@ vsb_cat(sb, "\nvoid VRT_panic(struct sess *sp, const char *, ...);\n"); vsb_cat(sb, "void VRT_ban(struct sess *sp, char *, ...);\n"); vsb_cat(sb, "void VRT_ban_string(struct sess *sp, const char *, ..."); - vsb_cat(sb, ");\n\nvoid VRT_count(const struct sess *, unsigned);\n"); - vsb_cat(sb, "int VRT_rewrite(const char *, const char *);\n"); + vsb_cat(sb, ");\nvoid VRT_purge(struct sess *sp, double ttl, double"); + vsb_cat(sb, " grace);\n\nvoid VRT_count(const struct sess *, unsign"); + vsb_cat(sb, "ed);\nint 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"); From tfheen at varnish-cache.org Wed Apr 21 09:24:12 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 11:24:12 +0200 Subject: r4704 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl varnish-cache/man Message-ID: Author: tfheen Date: 2010-04-21 11:24:12 +0200 (Wed, 21 Apr 2010) New Revision: 4704 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c branches/2.1/varnish-cache/man/vcl.7so Log: Merge r4669: Document that TTL is no longer taken into account for beresp.cacheable Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4668 + /trunk:4637,4640,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4669 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4668 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4669 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-21 09:18:39 UTC (rev 4703) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-21 09:24:12 UTC (rev 4704) @@ -227,8 +227,8 @@ 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"); - vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4695 2010-04-19 13:"); - vsb_cat(sb, "03:14Z tfheen $\n *\n * Runtime support for compiled V"); + vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4703 2010-04-21 09:"); + vsb_cat(sb, "18:39Z tfheen $\n *\n * Runtime support for compiled V"); vsb_cat(sb, "CL programs.\n *\n * XXX: When this file is changed, l"); vsb_cat(sb, "ib/libvcl/vcc_gen_fixed_token.tcl\n"); vsb_cat(sb, " * XXX: *MUST* be rerun.\n */\n"); Modified: branches/2.1/varnish-cache/man/vcl.7so =================================================================== --- branches/2.1/varnish-cache/man/vcl.7so 2010-04-21 09:18:39 UTC (rev 4703) +++ branches/2.1/varnish-cache/man/vcl.7so 2010-04-21 09:24:12 UTC (rev 4704) @@ -586,13 +586,8 @@ .It Va obj.cacheable True if the request resulted in a cacheable response. .\" see cache_center.c and rfc2616.c for details -A response is considered cacheable if it is valid (see above), the -HTTP status code is 200, 203, 300, 301, 302, 404 or 410 and it has a -non-zero time-to-live when -.Cm Expires -and -.Cm Cache-Control -headers are taken into account. +A response is considered cacheable if it is valid (see above), and the +HTTP status code is 200, 203, 300, 301, 302, 404 or 410. .It Va obj.ttl The object's remaining time to live, in seconds. .It Va obj.lastuse From tfheen at varnish-cache.org Wed Apr 21 09:33:27 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 11:33:27 +0200 Subject: r4705 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 11:33:27 +0200 (Wed, 21 Apr 2010) New Revision: 4705 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4670: Add vct_isdigit() Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4669 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670 Modified: branches/2.1/varnish-cache/include/vct.h =================================================================== --- branches/2.1/varnish-cache/include/vct.h 2010-04-21 09:24:12 UTC (rev 4704) +++ branches/2.1/varnish-cache/include/vct.h 2010-04-21 09:33:27 UTC (rev 4705) @@ -55,6 +55,7 @@ #define vct_iscrlf(x) vct_is(x, VCT_CRLF) #define vct_islws(x) vct_is(x, VCT_LWS) #define vct_isctl(x) vct_is(x, VCT_CTL) +#define vct_isdigit(x) vct_is(x, VCT_DIGIT) #define vct_isalpha(x) vct_is(x, VCT_ALPHA) #define vct_issep(x) vct_is(x, VCT_SEPARATOR) #define vct_issepctl(x) vct_is(x, VCT_SEPARATOR | VCT_CTL) Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4669 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670 From phk at varnish-cache.org Wed Apr 21 09:41:39 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 21 Apr 2010 11:41:39 +0200 Subject: r4706 - trunk/varnish-cache/doc/sphinx/installation Message-ID: Author: phk Date: 2010-04-21 11:41:39 +0200 (Wed, 21 Apr 2010) New Revision: 4706 Modified: trunk/varnish-cache/doc/sphinx/installation/bugs.rst Log: The simple bugs Modified: trunk/varnish-cache/doc/sphinx/installation/bugs.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/bugs.rst 2010-04-21 09:33:27 UTC (rev 4705) +++ trunk/varnish-cache/doc/sphinx/installation/bugs.rst 2010-04-21 09:41:39 UTC (rev 4706) @@ -12,8 +12,16 @@ So if you run into a bug, it is important that you spend a little bit of time collecting the right information, to help us fix the bug. -Roughly we have three clases of bugs with Varnish. +The most valuable information you can give us, is **always** how +to trigger and reproduce the problem. If you can tell us that, we +rarely need anything else to solve it. The caveat being, that we +do not have a way to simulate high levels of real-life web-traffic, +so telling us to "have 10.000 clients hit at once" does not really +allow us to reproduce. +Roughly we have three clases of bugs with Varnish, and the information +we need to debug them depends on the kind of bug. + Varnish crashes =============== @@ -121,4 +129,19 @@ means that we have wedged your kernel. +Varnish does something wrong +============================ +These are the easy bugs: usually all we need from you is the relevant +transactions recorded with ``varnishlog`` and your explanation of +what is wrong about what Varnish does. + +Be aware, that often Varnish does exactly what you asked it to, rather +than what you intended it to do, so it sounds like a bug that would +have tripped up everybody else, take a moment to read though your +VCL and see if it really does what you think. + +You can also try setting the ``vcl_trace`` parameter, that will +generate log records with like and char number for each statement +executed in your VCL program. + From tfheen at varnish-cache.org Wed Apr 21 10:26:07 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 12:26:07 +0200 Subject: r4707 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 12:26:07 +0200 (Wed, 21 Apr 2010) New Revision: 4707 Added: branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_response.c branches/2.1/varnish-cache/bin/varnishd/heritage.h branches/2.1/varnish-cache/bin/varnishd/mgt_param.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4686: Add experimental and limited support for "Range:" headers. By default it is disabled, enable with param http_range_support. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 09:41:39 UTC (rev 4706) +++ branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 10:26:07 UTC (rev 4707) @@ -40,6 +40,7 @@ #include "shmlog.h" #include "cache.h" +#include "vct.h" /*--------------------------------------------------------------------*/ @@ -127,6 +128,56 @@ /*--------------------------------------------------------------------*/ +static void +res_dorange(struct sess *sp, const char *r, unsigned *plow, unsigned *phigh) +{ + unsigned low, high; + + (void)sp; + if (strncmp(r, "bytes=", 6)) + return; + r += 6; + printf("-----------------RANGE: <%s>\n", r); + low = 0; + high = 0; + if (!vct_isdigit(*r)) + return; + while (vct_isdigit(*r)) { + low *= 10; + low += *r - '0'; + r++; + } + if (*r != '-') + return; + r++; + if (!vct_isdigit(*r)) + return; + while (vct_isdigit(*r)) { + high *= 10; + high += *r - '0'; + r++; + } + if (*r != '\0') + return; + printf("-----------------RANGE: %u %u\n", low, high); + if (high >= sp->obj->len) + high = sp->obj->len - 1; + if (low == 0 && high >= sp->obj->len) + return; + + + http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Content-Range: bytes %u-%u/%u", low, high, sp->obj->len); + http_Unset(sp->wrk->resp, H_Content_Length); + http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Content-Length: %u", 1 + high - low); + http_SetResp(sp->wrk->resp, "HTTP/1.1", "206", "Partial Content"); + *plow = low; + *phigh = high; +} + +/*--------------------------------------------------------------------*/ + void RES_BuildHttp(struct sess *sp) { @@ -153,7 +204,10 @@ "Transfer-Encoding: chunked"); else sp->doclose = "ESI EOF"; - } + } else if (params->http_range_support) + http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, + "Accept-Ranges: bytes"); + TIM_format(TIM_real(), time_str); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str); @@ -179,63 +233,119 @@ struct storage *st; unsigned u = 0; char lenbuf[20]; + char *r; + unsigned low, high, ptr, off, len; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); WRW_Reserve(sp->wrk, &sp->fd); - if (sp->disable_esi || !sp->esis) - sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); + /* + * ESI objects get special delivery + */ + if (!sp->disable_esi && sp->obj->esidata != NULL) { - if (!sp->disable_esi && sp->wantbody && sp->obj->esidata != NULL) { + if (sp->esis == 0) + /* no headers for interior ESI includes */ + sp->acct_req.hdrbytes += + http_Write(sp->wrk, sp->wrk->resp, 1); + if (WRW_FlushRelease(sp->wrk)) { vca_close_session(sp, "remote closed"); - return; - } - ESI_Deliver(sp); + } else if (sp->wantbody) + ESI_Deliver(sp); return; } - if (sp->wantbody) { - if (!sp->disable_esi && - sp->esis > 0 && - sp->http->protover >= 1.1 && - sp->obj->len > 0) { - sprintf(lenbuf, "%x\r\n", sp->obj->len); - (void)WRW_Write(sp->wrk, lenbuf, -1); + /* + * How much of the object we want to deliver + */ + low = 0; + high = sp->obj->len - 1; + + if (sp->disable_esi || sp->esis == 0) { + /* For none ESI and non ESI-included objects, try Range */ + if (params->http_range_support && + (sp->disable_esi || sp->esis == 0) && + sp->obj->response == 200 && + sp->wantbody && + http_GetHdr(sp->http, H_Range, &r)) + res_dorange(sp, r, &low, &high); + + sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); + } else if (!sp->disable_esi && + sp->esis > 0 && + sp->http->protover >= 1.1 && + sp->obj->len > 0) { + /* + * Interior ESI includes (which are not themselves ESI + * objects) use chunked encoding (here) or EOF (nothing) + */ + assert(sp->wantbody); + sprintf(lenbuf, "%x\r\n", sp->obj->len); + (void)WRW_Write(sp->wrk, lenbuf, -1); + } + + if (!sp->wantbody) { + /* This was a HEAD request */ + assert(sp->esis == 0); + if (WRW_FlushRelease(sp->wrk)) + vca_close_session(sp, "remote closed"); + return; + } + + ptr = 0; + VTAILQ_FOREACH(st, &sp->obj->store, list) { + CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); + u += st->len; + len = st->len; + off = 0; + if (ptr + len <= low) { + /* This segment is too early */ + ptr += len; + continue; } + if (ptr < low) { + /* Chop front of segment off */ + off += (low - ptr); + len -= (low - ptr); + ptr += (low - ptr); + } + if (ptr + len > high) + /* Chop tail of segment off */ + len = 1 + high - low; - VTAILQ_FOREACH(st, &sp->obj->store, list) { - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); - CHECK_OBJ_NOTNULL(st, STORAGE_MAGIC); - u += st->len; - sp->acct_req.bodybytes += st->len; + ptr += len; + + sp->acct_req.bodybytes += len; #ifdef SENDFILE_WORKS - /* - * XXX: the overhead of setting up sendfile is not - * XXX: epsilon and maybe not even delta, so avoid - * XXX: engaging sendfile for small objects. - * XXX: Should use getpagesize() ? - */ - if (st->fd >= 0 && - st->len >= params->sendfile_threshold) { - VSL_stats->n_objsendfile++; - WRW_Sendfile(sp->wrk, st->fd, - st->where, st->len); - continue; - } + /* + * XXX: the overhead of setting up sendfile is not + * XXX: epsilon and maybe not even delta, so avoid + * XXX: engaging sendfile for small objects. + * XXX: Should use getpagesize() ? + */ + if (st->fd >= 0 && + st->len >= params->sendfile_threshold) { + VSL_stats->n_objsendfile++; + WRW_Sendfile(sp->wrk, st->fd, st->where + off, len); + continue; + } #endif /* SENDFILE_WORKS */ - VSL_stats->n_objwrite++; - (void)WRW_Write(sp->wrk, st->ptr, st->len); - } - assert(u == sp->obj->len); - if (!sp->disable_esi && - sp->esis > 0 && - sp->http->protover >= 1.1 && - sp->obj->len > 0) - (void)WRW_Write(sp->wrk, "\r\n", -1); + VSL_stats->n_objwrite++; + (void)WRW_Write(sp->wrk, st->ptr + off, len); } + assert(u == sp->obj->len); + if (!sp->disable_esi && + sp->esis > 0 && + sp->http->protover >= 1.1 && + sp->obj->len > 0) { + /* post-chunk new line */ + (void)WRW_Write(sp->wrk, "\r\n", -1); + } + if (WRW_FlushRelease(sp->wrk)) vca_close_session(sp, "remote closed"); } Modified: branches/2.1/varnish-cache/bin/varnishd/heritage.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/heritage.h 2010-04-21 09:41:39 UTC (rev 4706) +++ branches/2.1/varnish-cache/bin/varnishd/heritage.h 2010-04-21 10:26:07 UTC (rev 4707) @@ -197,6 +197,8 @@ unsigned saintmode_threshold; unsigned syslog_cli_traffic; + + unsigned http_range_support; }; /* Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-21 09:41:39 UTC (rev 4706) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-21 10:26:07 UTC (rev 4707) @@ -813,6 +813,10 @@ "A value of 0 disables saintmode.", EXPERIMENTAL, "10", "objects" }, + { "http_range_support", tweak_bool, &master.http_range_support, 0, 0, + "Enable support for HTTP Range headers.\n", + EXPERIMENTAL, + "off", "bool" }, { NULL, NULL, NULL } }; Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00033.vtc ___________________________________________________________________ Added: svn:keywords + Id Copied: branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc (from rev 4686, trunk/varnish-cache/bin/varnishtest/tests/c00034.vtc) =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc (rev 0) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-21 10:26:07 UTC (rev 4707) @@ -0,0 +1,59 @@ +# $Id$ + +test "Range headers" + +server s1 { + rxreq + txresp -bodylen 100 +} -start + +varnish v1 -vcl+backend { +} -start + +client c1 { + txreq -hdr "Range: bytes=0-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 +} -run + +varnish v1 -cliok "param.set http_range_support on" + + +client c1 { + txreq -hdr "Range: bytes =0-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=0- 9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes =-9" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes =0-a" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=0-9" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=10-19" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=90-101" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 +} -run + Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00679.vtc ___________________________________________________________________ Added: svn:keywords + Id Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686 From tfheen at varnish-cache.org Wed Apr 21 10:36:12 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 12:36:12 +0200 Subject: r4708 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 12:36:12 +0200 (Wed, 21 Apr 2010) New Revision: 4708 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_center.c branches/2.1/varnish-cache/bin/varnishd/cache_response.c branches/2.1/varnish-cache/bin/varnishd/mgt_child.c branches/2.1/varnish-cache/bin/varnishd/stevedore.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/lib/libvcl/vcc_var.c Log: Merge r4689: Whitespace cleanup Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/bin/varnishd/cache_center.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -1051,7 +1051,7 @@ assert(sp->handling == VCL_RET_HASH); SHA256_Final(sp->digest, sp->wrk->sha256ctx); - if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) + if (!strcmp(sp->http->hd[HTTP_HDR_REQ].b, "HEAD")) sp->wantbody = 0; else sp->wantbody = 1; Modified: branches/2.1/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -207,8 +207,8 @@ } else if (params->http_range_support) http_SetHeader(sp->wrk, sp->fd, sp->wrk->resp, "Accept-Ranges: bytes"); - + TIM_format(TIM_real(), time_str); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Date: %s", time_str); @@ -248,7 +248,7 @@ if (sp->esis == 0) /* no headers for interior ESI includes */ - sp->acct_req.hdrbytes += + sp->acct_req.hdrbytes += http_Write(sp->wrk, sp->wrk->resp, 1); if (WRW_FlushRelease(sp->wrk)) { @@ -279,7 +279,7 @@ sp->http->protover >= 1.1 && sp->obj->len > 0) { /* - * Interior ESI includes (which are not themselves ESI + * Interior ESI includes (which are not themselves ESI * objects) use chunked encoding (here) or EOF (nothing) */ assert(sp->wantbody); @@ -304,7 +304,7 @@ off = 0; if (ptr + len <= low) { /* This segment is too early */ - ptr += len; + ptr += len; continue; } if (ptr < low) { Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_child.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_child.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_child.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -101,7 +101,7 @@ /*-------------------------------------------------------------------- * Track the highest file descriptor the parent knows is being used. * - * This allows the child process to clean/close only a small fraction + * This allows the child process to clean/close only a small fraction * of the possible file descriptors after exec(2). * * This is likely to a bit on the low side, as libc and other libraries Modified: branches/2.1/varnish-cache/bin/varnishd/stevedore.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/stevedore.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/bin/varnishd/stevedore.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -141,8 +141,8 @@ o = (void *)st->ptr; /* XXX: align ? */ l = PRNDDN(st->space - (sizeof *o + lh)); - + STV_InitObj(sp, o, l, lh, nhttp); o->objstore = st; return (o); Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_acl.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -308,7 +308,7 @@ ae->mask = vcc_UintVal(tl); } - if (ae->para) + if (ae->para) SkipToken(tl, ')'); if (!vcc_acl_try_netnotation(tl, ae)) { Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 Modified: branches/2.1/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-21 10:26:07 UTC (rev 4707) +++ branches/2.1/varnish-cache/lib/libvcl/vcc_var.c 2010-04-21 10:36:12 UTC (rev 4708) @@ -131,7 +131,7 @@ Fb(tl, 0, "%g", d); } else if (vp->fmt == FLOAT) { Fb(tl, 0, "%g", vcc_DoubleVal(tl)); - } else if (vp->fmt == INT) { + } else if (vp->fmt == INT) { Fb(tl, 0, "%u", vcc_UintVal(tl)); } else { AN(vt); From tfheen at varnish-cache.org Wed Apr 21 10:40:28 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 12:40:28 +0200 Subject: r4709 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishsizes varnish-cache/bin/varnishtest/tests varnish-cache/doc varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 12:40:27 +0200 (Wed, 21 Apr 2010) New Revision: 4709 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishsizes/Makefile.am branches/2.1/varnish-cache/bin/varnishsizes/varnishsizes.1 branches/2.1/varnish-cache/bin/varnishsizes/varnishsizes.c branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/doc/changes-2.0.2-2.0.3.xml branches/2.1/varnish-cache/doc/changes-2.1.0.xml branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4690: Set $Id$ keyword expansion Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishsizes/Makefile.am ___________________________________________________________________ Added: svn:keywords + Id Property changes on: branches/2.1/varnish-cache/bin/varnishsizes/varnishsizes.1 ___________________________________________________________________ Added: svn:keywords + Id Property changes on: branches/2.1/varnish-cache/bin/varnishsizes/varnishsizes.c ___________________________________________________________________ Added: svn:keywords + Id Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/doc/changes-2.0.2-2.0.3.xml ___________________________________________________________________ Added: svn:keywords + Id Modified: branches/2.1/varnish-cache/doc/changes-2.1.0.xml =================================================================== --- branches/2.1/varnish-cache/doc/changes-2.1.0.xml 2010-04-21 10:36:12 UTC (rev 4708) +++ branches/2.1/varnish-cache/doc/changes-2.1.0.xml 2010-04-21 10:40:27 UTC (rev 4709) @@ -3,7 +3,7 @@ ]> - + Varnish 2.1 Property changes on: branches/2.1/varnish-cache/doc/changes-2.1.0.xml ___________________________________________________________________ Added: svn:keywords + Id Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 From tfheen at varnish-cache.org Wed Apr 21 10:47:57 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 12:47:57 +0200 Subject: r4710 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-21 12:47:57 +0200 (Wed, 21 Apr 2010) New Revision: 4710 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/cache_response.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4700: Tune Range: handling based on real-world sample: Also support: bytes=-%d bytes=%d- bytes=- And ignore plain wrong cases, such as starter past end of object or end before start etc. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Modified: branches/2.1/varnish-cache/bin/varnishd/cache_response.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 10:40:27 UTC (rev 4709) +++ branches/2.1/varnish-cache/bin/varnishd/cache_response.c 2010-04-21 10:47:57 UTC (rev 4710) @@ -137,41 +137,51 @@ if (strncmp(r, "bytes=", 6)) return; r += 6; - printf("-----------------RANGE: <%s>\n", r); + + /* The low end of range */ low = 0; - high = 0; - if (!vct_isdigit(*r)) + if (!vct_isdigit(*r) && *r != '-') return; while (vct_isdigit(*r)) { low *= 10; low += *r - '0'; r++; } + + if (low >= sp->obj->len) + return; + if (*r != '-') return; r++; - if (!vct_isdigit(*r)) - return; - while (vct_isdigit(*r)) { - high *= 10; - high += *r - '0'; - r++; - } + + /* The high end of range */ + if (vct_isdigit(*r)) { + high = 0; + while (vct_isdigit(*r)) { + high *= 10; + high += *r - '0'; + r++; + } + } else + high = sp->obj->len - 1; if (*r != '\0') return; - printf("-----------------RANGE: %u %u\n", low, high); + if (high >= sp->obj->len) - high = sp->obj->len - 1; - if (low == 0 && high >= sp->obj->len) + high = sp->obj->len; + + if (low > high) return; - http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Content-Range: bytes %u-%u/%u", low, high, sp->obj->len); http_Unset(sp->wrk->resp, H_Content_Length); http_PrintfHeader(sp->wrk, sp->fd, sp->wrk->resp, "Content-Length: %u", 1 + high - low); http_SetResp(sp->wrk->resp, "HTTP/1.1", "206", "Partial Content"); + + *plow = low; *phigh = high; } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Modified: branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-21 10:40:27 UTC (rev 4709) +++ branches/2.1/varnish-cache/bin/varnishtest/tests/c00034.vtc 2010-04-21 10:47:57 UTC (rev 4710) @@ -51,9 +51,39 @@ expect resp.status == 206 expect resp.bodylen == 10 - txreq -hdr "Range: bytes=90-101" + txreq -hdr "Range: bytes=90-" rxresp expect resp.status == 206 expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=-9" + rxresp + expect resp.status == 206 + expect resp.bodylen == 10 + + txreq -hdr "Range: bytes=-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=102-102" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=99-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 1 + + txreq -hdr "Range: bytes=99-70" + rxresp + expect resp.status == 200 + expect resp.bodylen == 100 + + txreq -hdr "Range: bytes=-" + rxresp + expect resp.status == 206 + expect resp.bodylen == 100 } -run Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 From tfheen at varnish-cache.org Wed Apr 21 13:00:14 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 15:00:14 +0200 Subject: r4711 - branches/2.1/varnish-cache/doc Message-ID: Author: tfheen Date: 2010-04-21 15:00:14 +0200 (Wed, 21 Apr 2010) New Revision: 4711 Added: branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml branches/2.1/varnish-cache/doc/changes-2.1.1.xml Modified: branches/2.1/varnish-cache/doc/Makefile.am Log: Add changelogs for 2.1.1 Modified: branches/2.1/varnish-cache/doc/Makefile.am =================================================================== --- branches/2.1/varnish-cache/doc/Makefile.am 2010-04-21 10:47:57 UTC (rev 4710) +++ branches/2.1/varnish-cache/doc/Makefile.am 2010-04-21 13:00:14 UTC (rev 4711) @@ -1,6 +1,7 @@ # $Id$ CHANGELOGS = \ + changes-2.1.1.html \ changes-2.1.0.html \ changes-2.0.6.html \ changes-2.0.5.html \ @@ -15,6 +16,7 @@ changes-1.0.4.html XML = \ + changes-2.1.0-2.1.1.xml \ changes-2.0.6-2.1.0.xml \ changes-2.0.5-2.0.6.xml \ changes-2.0.4-2.0.5.xml \ Added: branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml =================================================================== --- branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml (rev 0) +++ branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml 2010-04-21 13:00:14 UTC (rev 4711) @@ -0,0 +1,87 @@ + + +]> + + + + varnishd + + + The changelog in 2.1.0 included syntax errors, causing + the generated changelog to be empty. + + + + The help text for default_grace was wrongly + formatted and included a syntax error. This has now been fixed. + + + + varnishd now closes the file descriptor used + to read the management secret file (from the -S + parameter). + + + + The child would previously try to close every valid file + descriptor, something which could cause problems if the file + descriptor ulimit was set too high. We now keep track of all + the file descriptors we open and only close up to that number. + + + + + ESI was partially broken in 2.1.0 due to a bug in the + rollback of session workspace. This has been fixed. + + + + Reject the authcommand rather than crash if + there is no -S parameter given. + + + + Align pointers in allocated objects. This will in theory + make Varnish a tiny bit faster at the expense of slightly more + memory usage. + + + + Ensure the master process process id is updated in the + shared memory log file after we go into the background. + + + + HEAD requests would be converted to GET + requests too early, which affected pass + and pipe. This has been fixed. + + + + Update the documentation to point out that the TTL is no + longer taken into account to decide whether an object is + cacheable or not. + + + + Add support for completely obliterating an object and all + variants of it. Currently, this has to be done using inline C. + + + + Add experimental support for the Range + header. This has to be enabled using the parameter + http_range_support. + + + + varnishsizes + + + varnishsizes, which is + like varnishhost, but for the length of objects, + has been added.. + + + Added: branches/2.1/varnish-cache/doc/changes-2.1.1.xml =================================================================== --- branches/2.1/varnish-cache/doc/changes-2.1.1.xml (rev 0) +++ branches/2.1/varnish-cache/doc/changes-2.1.1.xml 2010-04-21 13:00:14 UTC (rev 4711) @@ -0,0 +1,12 @@ + + + +]> + + + Varnish + 2.1 + + + From ingvar at varnish-cache.org Wed Apr 21 13:31:03 2010 From: ingvar at varnish-cache.org (ingvar at varnish-cache.org) Date: Wed, 21 Apr 2010 15:31:03 +0200 Subject: r4712 - in trunk/varnish-cache: bin/varnishd bin/varnishtest man Message-ID: Author: ingvar Date: 2010-04-21 15:31:03 +0200 (Wed, 21 Apr 2010) New Revision: 4712 Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 trunk/varnish-cache/bin/varnishtest/Makefile.am trunk/varnish-cache/man/vcl.7so Log: Patch by Robert Scheck for varnish >= 2.1, which adds the missing (former implicit) linking to libm. And as implicit linking can be dangerous, this changed, see: http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking Commited by Ingvar. This is necessary to make varnish build on fedora>13. Modified: trunk/varnish-cache/bin/varnishd/varnishd.1 =================================================================== --- trunk/varnish-cache/bin/varnishd/varnishd.1 2010-04-21 13:00:14 UTC (rev 4711) +++ trunk/varnish-cache/bin/varnishd/varnishd.1 2010-04-21 13:31:03 UTC (rev 4712) @@ -173,6 +173,9 @@ See .Sx Run-Time Parameters for a list of parameters. +.It Fl S Ar file +Path to a file containing a secret used for authorizing access to the +management port. .It Fl s Ar type Ns Xo .Op , Ns Ar options .Xc Modified: trunk/varnish-cache/bin/varnishtest/Makefile.am =================================================================== --- trunk/varnish-cache/bin/varnishtest/Makefile.am 2010-04-21 13:00:14 UTC (rev 4711) +++ trunk/varnish-cache/bin/varnishtest/Makefile.am 2010-04-21 13:31:03 UTC (rev 4712) @@ -25,7 +25,7 @@ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - ${PTHREAD_LIBS} + ${LIBM} ${PTHREAD_LIBS} EXTRA_DIST = $(top_srcdir)/bin/varnishtest/tests/*.vtc \ $(top_srcdir)/bin/varnishtest/tests/README Modified: trunk/varnish-cache/man/vcl.7so =================================================================== --- trunk/varnish-cache/man/vcl.7so 2010-04-21 13:00:14 UTC (rev 4711) +++ trunk/varnish-cache/man/vcl.7so 2010-04-21 13:31:03 UTC (rev 4712) @@ -126,7 +126,6 @@ can be set to the maximum list size. Setting a value of 0 disables saintmode checking entirely for that backend. The value in the backend declaration overrides the parameter. - .Ss Directors Directors choose from different backends based on health status and a per-director algorithm. From ingvar at varnish-cache.org Wed Apr 21 13:39:39 2010 From: ingvar at varnish-cache.org (ingvar at varnish-cache.org) Date: Wed, 21 Apr 2010 15:39:39 +0200 Subject: r4713 - branches/2.1/varnish-cache/redhat Message-ID: Author: ingvar Date: 2010-04-21 15:39:38 +0200 (Wed, 21 Apr 2010) New Revision: 4713 Modified: branches/2.1/varnish-cache/redhat/varnish.spec Log: redhat specfile ready to roll Modified: branches/2.1/varnish-cache/redhat/varnish.spec =================================================================== --- branches/2.1/varnish-cache/redhat/varnish.spec 2010-04-21 13:31:03 UTC (rev 4712) +++ branches/2.1/varnish-cache/redhat/varnish.spec 2010-04-21 13:39:38 UTC (rev 4713) @@ -1,7 +1,7 @@ Summary: High-performance HTTP accelerator Name: varnish Version: 2.1.1 -Release: 0.svn20100415%{?dist} +Release: 0.svn20100421%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ @@ -9,7 +9,7 @@ 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 -BuildRequires: automake autoconf libtool +#BuildRequires: automake autoconf libtool BuildRequires: ncurses-devel libxslt groff pcre-devel pkgconfig Requires: varnish-libs = %{version}-%{release} Requires: logrotate @@ -61,12 +61,12 @@ #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 -./autogen.sh +#./autogen.sh # Hack to get 32- and 64-bits tests run concurrently on the same build machine case `uname -m` in From tfheen at varnish-cache.org Wed Apr 21 13:44:49 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Wed, 21 Apr 2010 15:44:49 +0200 Subject: r4714 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl varnish-cache/man Message-ID: Author: tfheen Date: 2010-04-21 15:44:48 +0200 (Wed, 21 Apr 2010) New Revision: 4714 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/varnishd.1 branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/Makefile.am branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c branches/2.1/varnish-cache/man/vcl.7so Log: Merge r4712: Add libm to linking flags Patch by Robert Scheck for varnish >= 2.1, which adds the missing (former implicit) linking to libm. And as implicit linking can be dangerous, this changed, see: http://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking Commited by Ingvar. This is necessary to make varnish build on fedora>13. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Modified: branches/2.1/varnish-cache/bin/varnishd/varnishd.1 =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/varnishd.1 2010-04-21 13:39:38 UTC (rev 4713) +++ branches/2.1/varnish-cache/bin/varnishd/varnishd.1 2010-04-21 13:44:48 UTC (rev 4714) @@ -173,6 +173,9 @@ See .Sx Run-Time Parameters for a list of parameters. +.It Fl S Ar file +Path to a file containing a secret used for authorizing access to the +management port. .It Fl s Ar type Ns Xo .Op , Ns Ar options .Xc Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Modified: branches/2.1/varnish-cache/bin/varnishtest/Makefile.am =================================================================== --- branches/2.1/varnish-cache/bin/varnishtest/Makefile.am 2010-04-21 13:39:38 UTC (rev 4713) +++ branches/2.1/varnish-cache/bin/varnishtest/Makefile.am 2010-04-21 13:44:48 UTC (rev 4714) @@ -25,7 +25,7 @@ $(top_builddir)/lib/libvarnish/libvarnish.la \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ - ${PTHREAD_LIBS} + ${LIBM} ${PTHREAD_LIBS} EXTRA_DIST = $(top_srcdir)/bin/varnishtest/tests/*.vtc \ $(top_srcdir)/bin/varnishtest/tests/README Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 Modified: branches/2.1/varnish-cache/man/vcl.7so =================================================================== --- branches/2.1/varnish-cache/man/vcl.7so 2010-04-21 13:39:38 UTC (rev 4713) +++ branches/2.1/varnish-cache/man/vcl.7so 2010-04-21 13:44:48 UTC (rev 4714) @@ -126,7 +126,6 @@ can be set to the maximum list size. Setting a value of 0 disables saintmode checking entirely for that backend. The value in the backend declaration overrides the parameter. - .Ss Directors Directors choose from different backends based on health status and a per-director algorithm. From phk at varnish-cache.org Thu Apr 22 09:54:14 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 22 Apr 2010 11:54:14 +0200 Subject: r4715 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-22 11:54:14 +0200 (Thu, 22 Apr 2010) New Revision: 4715 Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c trunk/varnish-cache/bin/varnishd/heritage.h trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Make the critbit cooling off period a parameter. Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-21 13:44:48 UTC (rev 4714) +++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-22 09:54:14 UTC (rev 4715) @@ -340,8 +340,6 @@ /**********************************************************************/ -#define COOL_DURATION 60 /* seconds */ - static void * hcb_cleaner(void *priv) { @@ -363,7 +361,7 @@ y = (void *)&oh->u; if (y->leaf[0] || y->leaf[1]) continue; - if (++oh->digest[0] > COOL_DURATION) { + if (++oh->digest[0] > params->critbit_cooloff) { VTAILQ_REMOVE(&laylow, oh, coollist); #ifdef PHK fprintf(stderr, "OH %p is cold enough\n", oh); Modified: trunk/varnish-cache/bin/varnishd/heritage.h =================================================================== --- trunk/varnish-cache/bin/varnishd/heritage.h 2010-04-21 13:44:48 UTC (rev 4714) +++ trunk/varnish-cache/bin/varnishd/heritage.h 2010-04-22 09:54:14 UTC (rev 4715) @@ -199,6 +199,8 @@ unsigned syslog_cli_traffic; unsigned http_range_support; + + double critbit_cooloff; }; /* Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-21 13:44:48 UTC (rev 4714) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-22 09:54:14 UTC (rev 4715) @@ -817,6 +817,13 @@ "Enable support for HTTP Range headers.\n", EXPERIMENTAL, "off", "bool" }, + { "critbit_cooloff", tweak_timeout_double, + &master.critbit_cooloff, 60, UINT_MAX, + "How long time the critbit hasher keeps deleted objheads " + "on the cooloff list.\n" + "A value of zero disables the ban lurker.", + EXPERIMENTAL, + "180.0", "s" }, { NULL, NULL, NULL } }; From phk at varnish-cache.org Thu Apr 22 11:13:34 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 22 Apr 2010 13:13:34 +0200 Subject: r4716 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-22 13:13:34 +0200 (Thu, 22 Apr 2010) New Revision: 4716 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c Log: Set correct upper limit on critbit cooling timer. Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-22 09:54:14 UTC (rev 4715) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-22 11:13:34 UTC (rev 4716) @@ -818,7 +818,7 @@ EXPERIMENTAL, "off", "bool" }, { "critbit_cooloff", tweak_timeout_double, - &master.critbit_cooloff, 60, UINT_MAX, + &master.critbit_cooloff, 60, 254, "How long time the critbit hasher keeps deleted objheads " "on the cooloff list.\n" "A value of zero disables the ban lurker.", From phk at varnish-cache.org Fri Apr 23 05:16:33 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 23 Apr 2010 07:16:33 +0200 Subject: r4717 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-23 07:16:33 +0200 (Fri, 23 Apr 2010) New Revision: 4717 Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c Log: Fix a deadlock in the critbit hasher. Spotted by: dormando Testing by: Kristian Fixes: #684 Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-22 11:13:34 UTC (rev 4716) +++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-23 05:16:33 UTC (rev 4717) @@ -160,7 +160,9 @@ return ((struct hcb_y *)(u & ~HCB_BIT_Y)); } -/**********************************************************************/ +/********************************************************************** + * Find the "critical" bit that separates these two digests + */ static unsigned hcb_crit_bit(const struct objhead *oh1, const struct objhead *oh2, @@ -238,6 +240,7 @@ while(hcb_is_y(*p)) { y = hcb_l_y(*p); + assert(y->critbit != y2->critbit); if (y->critbit > y2->critbit) break; assert(y->ptr < DIGEST_LEN); @@ -353,7 +356,6 @@ THR_SetName("hcb_cleaner"); (void)priv; while (1) { - (void)sleep(1); Lck_Lock(&hcb_mtx); VTAILQ_FOREACH_SAFE(oh, &laylow, coollist, oh2) { CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); @@ -363,14 +365,16 @@ continue; if (++oh->digest[0] > params->critbit_cooloff) { VTAILQ_REMOVE(&laylow, oh, coollist); -#ifdef PHK - fprintf(stderr, "OH %p is cold enough\n", oh); -#endif - HSH_DeleteObjHead(&ww, oh); + break; } } Lck_Unlock(&hcb_mtx); - WRK_SumStat(&ww); + if (oh == NULL) { + WRK_SumStat(&ww); + (void)sleep(1); + } else { + HSH_DeleteObjHead(&ww, oh); + } } NEEDLESS_RETURN(NULL); } @@ -385,11 +389,11 @@ (void)oh; CLI_AddFuncs(hcb_cmds); + Lck_New(&hcb_mtx); AZ(pthread_create(&tp, NULL, hcb_cleaner, NULL)); assert(sizeof(struct hcb_y) <= sizeof(oh->u)); memset(&hcb_root, 0, sizeof hcb_root); hcb_build_bittbl(); - Lck_New(&hcb_mtx); } static int @@ -401,8 +405,8 @@ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); - if (oh->refcnt == 1) { - /* Remove from tree before decrementing refcnt to zero */ + oh->refcnt--; + if (oh->refcnt == 0) { Lck_Lock(&hcb_mtx); hcb_delete(&hcb_root, oh); assert(VTAILQ_EMPTY(&oh->objcs)); @@ -411,7 +415,6 @@ VTAILQ_INSERT_TAIL(&laylow, oh, coollist); Lck_Unlock(&hcb_mtx); } - oh->refcnt--; Lck_Unlock(&oh->mtx); #ifdef PHK fprintf(stderr, "hcb_defef %d %d <%s>\n", __LINE__, r, oh->hash); @@ -423,54 +426,52 @@ hcb_lookup(const struct sess *sp, struct objhead *noh) { struct objhead *oh; - unsigned u; + volatile unsigned u; + unsigned with_lock; (void)sp; - oh = hcb_insert(&hcb_root, noh, 0); - if (oh != NULL) { - /* Assert that we didn't muck with the tree without lock */ - assert(oh != noh); + + with_lock = 0; + while (1) { + if (with_lock) { + Lck_Lock(&hcb_mtx); + VSL_stats->hcb_lock++; + assert(noh->refcnt == 1); + oh = hcb_insert(&hcb_root, noh, 1); + Lck_Unlock(&hcb_mtx); + } else { + VSL_stats->hcb_nolock++; + oh = hcb_insert(&hcb_root, noh, 0); + } + + if (oh != NULL && oh == noh) { + /* Assert that we only muck with the tree with a lock */ + assert(with_lock); + VSL_stats->hcb_insert++; + assert(oh->refcnt > 0); + return (oh); + } + + if (oh == NULL) { + assert(!with_lock); + /* Try again, with lock */ + with_lock = 1; + continue; + } + + CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); /* * A refcount of zero indicates that the tree changed * under us, so fall through and try with the lock held. */ u = oh->refcnt; - if (u) + if (u > 0) oh->refcnt++; Lck_Unlock(&oh->mtx); - if (u) { - VSL_stats->hcb_nolock++; + if (u > 0) return (oh); - } } - - /* - * Try again, holding lock and fully ready objhead, so that if - * somebody else beats us back, they do not get surprised. - */ - Lck_Lock(&hcb_mtx); - assert(noh->refcnt == 1); - oh = hcb_insert(&hcb_root, noh, 1); - if (oh == noh) { - VSL_stats->hcb_insert++; - assert(oh->refcnt > 0); -#ifdef PHK - fprintf(stderr, "hcb_lookup %d\n", __LINE__); -#endif - } else { - CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); - VSL_stats->hcb_lock++; -#ifdef PHK - fprintf(stderr, "hcb_lookup %d\n", __LINE__); -#endif - Lck_Lock(&oh->mtx); - assert(oh->refcnt > 0); - oh->refcnt++; - Lck_Unlock(&oh->mtx); - } - Lck_Unlock(&hcb_mtx); - return (oh); } From phk at varnish-cache.org Fri Apr 23 21:09:30 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 23 Apr 2010 23:09:30 +0200 Subject: r4718 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-23 23:09:29 +0200 (Fri, 23 Apr 2010) New Revision: 4718 Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c Log: Add more "volatile" to make it clear to the compiler what we mean here. Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-23 05:16:33 UTC (rev 4717) +++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-23 21:09:29 UTC (rev 4718) @@ -93,18 +93,17 @@ */ struct hcb_y { - unsigned short critbit; - unsigned char ptr; - unsigned char bitmask; - uintptr_t leaf[2]; + unsigned short critbit; + unsigned char ptr; + unsigned char bitmask; + volatile uintptr_t leaf[2]; }; #define HCB_BIT_NODE (1<<0) #define HCB_BIT_Y (1<<1) struct hcb_root { - uintptr_t origo; - unsigned cmps; + volatile uintptr_t origo; }; static struct hcb_root hcb_root; @@ -209,7 +208,6 @@ assert(y->ptr < DIGEST_LEN); s = (oh->digest[y->ptr] & y->bitmask) != 0; assert(s < 2); - root->cmps++; p = &y->leaf[s]; pp = *p; } @@ -246,7 +244,6 @@ assert(y->ptr < DIGEST_LEN); s = (oh->digest[y->ptr] & y->bitmask) != 0; assert(s < 2); - root->cmps++; p = &y->leaf[s]; } y2->leaf[s2] = *p; @@ -260,7 +257,7 @@ hcb_delete(struct hcb_root *r, struct objhead *oh) { struct hcb_y *y; - uintptr_t *p; + volatile uintptr_t *p; unsigned s; if (r->origo == hcb_r_node(oh)) { @@ -283,7 +280,6 @@ y->leaf[1] = 0; return; } - r->cmps++; p = &y->leaf[s]; } } From phk at varnish-cache.org Sat Apr 24 07:44:57 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Sat, 24 Apr 2010 09:44:57 +0200 Subject: r4719 - trunk/varnish-cache/bin/varnishd Message-ID: Author: phk Date: 2010-04-24 09:44:57 +0200 (Sat, 24 Apr 2010) New Revision: 4719 Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c Log: Close a race between hcb_insert() and hcb_delete() Hit by: dormando Modified: trunk/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-23 21:09:29 UTC (rev 4718) +++ trunk/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-24 07:44:57 UTC (rev 4719) @@ -212,6 +212,12 @@ pp = *p; } + if (pp == 0) { + /* We raced hcb_delete and got a NULL pointer */ + assert(!has_lock); + return (NULL); + } + assert(hcb_is_node(pp)); /* We found a node, does it match ? */ From tfheen at varnish-cache.org Mon Apr 26 07:30:33 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 09:30:33 +0200 Subject: r4720 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-26 09:30:32 +0200 (Mon, 26 Apr 2010) New Revision: 4720 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c branches/2.1/varnish-cache/bin/varnishd/heritage.h branches/2.1/varnish-cache/bin/varnishd/mgt_param.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4715: Make the critbit cooling off period a parameter. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Modified: branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-24 07:44:57 UTC (rev 4719) +++ branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:30:32 UTC (rev 4720) @@ -340,8 +340,6 @@ /**********************************************************************/ -#define COOL_DURATION 60 /* seconds */ - static void * hcb_cleaner(void *priv) { @@ -363,7 +361,7 @@ y = (void *)&oh->u; if (y->leaf[0] || y->leaf[1]) continue; - if (++oh->digest[0] > COOL_DURATION) { + if (++oh->digest[0] > params->critbit_cooloff) { VTAILQ_REMOVE(&laylow, oh, coollist); #ifdef PHK fprintf(stderr, "OH %p is cold enough\n", oh); Modified: branches/2.1/varnish-cache/bin/varnishd/heritage.h =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/heritage.h 2010-04-24 07:44:57 UTC (rev 4719) +++ branches/2.1/varnish-cache/bin/varnishd/heritage.h 2010-04-26 07:30:32 UTC (rev 4720) @@ -199,6 +199,8 @@ unsigned syslog_cli_traffic; unsigned http_range_support; + + double critbit_cooloff; }; /* Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-24 07:44:57 UTC (rev 4719) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-26 07:30:32 UTC (rev 4720) @@ -817,6 +817,13 @@ "Enable support for HTTP Range headers.\n", EXPERIMENTAL, "off", "bool" }, + { "critbit_cooloff", tweak_timeout_double, + &master.critbit_cooloff, 60, UINT_MAX, + "How long time the critbit hasher keeps deleted objheads " + "on the cooloff list.\n" + "A value of zero disables the ban lurker.", + EXPERIMENTAL, + "180.0", "s" }, { NULL, NULL, NULL } }; Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 From tfheen at varnish-cache.org Mon Apr 26 07:36:36 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 09:36:36 +0200 Subject: r4721 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-26 09:36:36 +0200 (Mon, 26 Apr 2010) New Revision: 4721 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/mgt_param.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4716: Set correct upper limit on critbit cooling timer. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Modified: branches/2.1/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-26 07:30:32 UTC (rev 4720) +++ branches/2.1/varnish-cache/bin/varnishd/mgt_param.c 2010-04-26 07:36:36 UTC (rev 4721) @@ -818,7 +818,7 @@ EXPERIMENTAL, "off", "bool" }, { "critbit_cooloff", tweak_timeout_double, - &master.critbit_cooloff, 60, UINT_MAX, + &master.critbit_cooloff, 60, 254, "How long time the critbit hasher keeps deleted objheads " "on the cooloff list.\n" "A value of zero disables the ban lurker.", Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 From tfheen at varnish-cache.org Mon Apr 26 07:52:10 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 09:52:10 +0200 Subject: r4722 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-26 09:52:09 +0200 (Mon, 26 Apr 2010) New Revision: 4722 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4717: Fix a deadlock in the critbit hasher. Spotted by: dormando Testing by: Kristian Fixes: #684 Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Modified: branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:36:36 UTC (rev 4721) +++ branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:52:09 UTC (rev 4722) @@ -160,7 +160,9 @@ return ((struct hcb_y *)(u & ~HCB_BIT_Y)); } -/**********************************************************************/ +/********************************************************************** + * Find the "critical" bit that separates these two digests + */ static unsigned hcb_crit_bit(const struct objhead *oh1, const struct objhead *oh2, @@ -238,6 +240,7 @@ while(hcb_is_y(*p)) { y = hcb_l_y(*p); + assert(y->critbit != y2->critbit); if (y->critbit > y2->critbit) break; assert(y->ptr < DIGEST_LEN); @@ -353,7 +356,6 @@ THR_SetName("hcb_cleaner"); (void)priv; while (1) { - (void)sleep(1); Lck_Lock(&hcb_mtx); VTAILQ_FOREACH_SAFE(oh, &laylow, coollist, oh2) { CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); @@ -363,14 +365,16 @@ continue; if (++oh->digest[0] > params->critbit_cooloff) { VTAILQ_REMOVE(&laylow, oh, coollist); -#ifdef PHK - fprintf(stderr, "OH %p is cold enough\n", oh); -#endif - HSH_DeleteObjHead(&ww, oh); + break; } } Lck_Unlock(&hcb_mtx); - WRK_SumStat(&ww); + if (oh == NULL) { + WRK_SumStat(&ww); + (void)sleep(1); + } else { + HSH_DeleteObjHead(&ww, oh); + } } NEEDLESS_RETURN(NULL); } @@ -385,11 +389,11 @@ (void)oh; CLI_AddFuncs(hcb_cmds); + Lck_New(&hcb_mtx); AZ(pthread_create(&tp, NULL, hcb_cleaner, NULL)); assert(sizeof(struct hcb_y) <= sizeof(oh->u)); memset(&hcb_root, 0, sizeof hcb_root); hcb_build_bittbl(); - Lck_New(&hcb_mtx); } static int @@ -401,8 +405,8 @@ CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); - if (oh->refcnt == 1) { - /* Remove from tree before decrementing refcnt to zero */ + oh->refcnt--; + if (oh->refcnt == 0) { Lck_Lock(&hcb_mtx); hcb_delete(&hcb_root, oh); assert(VTAILQ_EMPTY(&oh->objcs)); @@ -411,7 +415,6 @@ VTAILQ_INSERT_TAIL(&laylow, oh, coollist); Lck_Unlock(&hcb_mtx); } - oh->refcnt--; Lck_Unlock(&oh->mtx); #ifdef PHK fprintf(stderr, "hcb_defef %d %d <%s>\n", __LINE__, r, oh->hash); @@ -423,54 +426,52 @@ hcb_lookup(const struct sess *sp, struct objhead *noh) { struct objhead *oh; - unsigned u; + volatile unsigned u; + unsigned with_lock; (void)sp; - oh = hcb_insert(&hcb_root, noh, 0); - if (oh != NULL) { - /* Assert that we didn't muck with the tree without lock */ - assert(oh != noh); + + with_lock = 0; + while (1) { + if (with_lock) { + Lck_Lock(&hcb_mtx); + VSL_stats->hcb_lock++; + assert(noh->refcnt == 1); + oh = hcb_insert(&hcb_root, noh, 1); + Lck_Unlock(&hcb_mtx); + } else { + VSL_stats->hcb_nolock++; + oh = hcb_insert(&hcb_root, noh, 0); + } + + if (oh != NULL && oh == noh) { + /* Assert that we only muck with the tree with a lock */ + assert(with_lock); + VSL_stats->hcb_insert++; + assert(oh->refcnt > 0); + return (oh); + } + + if (oh == NULL) { + assert(!with_lock); + /* Try again, with lock */ + with_lock = 1; + continue; + } + + CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); Lck_Lock(&oh->mtx); /* * A refcount of zero indicates that the tree changed * under us, so fall through and try with the lock held. */ u = oh->refcnt; - if (u) + if (u > 0) oh->refcnt++; Lck_Unlock(&oh->mtx); - if (u) { - VSL_stats->hcb_nolock++; + if (u > 0) return (oh); - } } - - /* - * Try again, holding lock and fully ready objhead, so that if - * somebody else beats us back, they do not get surprised. - */ - Lck_Lock(&hcb_mtx); - assert(noh->refcnt == 1); - oh = hcb_insert(&hcb_root, noh, 1); - if (oh == noh) { - VSL_stats->hcb_insert++; - assert(oh->refcnt > 0); -#ifdef PHK - fprintf(stderr, "hcb_lookup %d\n", __LINE__); -#endif - } else { - CHECK_OBJ_NOTNULL(noh, OBJHEAD_MAGIC); - VSL_stats->hcb_lock++; -#ifdef PHK - fprintf(stderr, "hcb_lookup %d\n", __LINE__); -#endif - Lck_Lock(&oh->mtx); - assert(oh->refcnt > 0); - oh->refcnt++; - Lck_Unlock(&oh->mtx); - } - Lck_Unlock(&hcb_mtx); - return (oh); } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4716 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 From tfheen at varnish-cache.org Mon Apr 26 07:58:19 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 09:58:19 +0200 Subject: r4723 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-26 09:58:18 +0200 (Mon, 26 Apr 2010) New Revision: 4723 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4718: Add more "volatile" to make it clear to the compiler what we mean here. Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Modified: branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:52:09 UTC (rev 4722) +++ branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:58:18 UTC (rev 4723) @@ -93,18 +93,17 @@ */ struct hcb_y { - unsigned short critbit; - unsigned char ptr; - unsigned char bitmask; - uintptr_t leaf[2]; + unsigned short critbit; + unsigned char ptr; + unsigned char bitmask; + volatile uintptr_t leaf[2]; }; #define HCB_BIT_NODE (1<<0) #define HCB_BIT_Y (1<<1) struct hcb_root { - uintptr_t origo; - unsigned cmps; + volatile uintptr_t origo; }; static struct hcb_root hcb_root; @@ -209,7 +208,6 @@ assert(y->ptr < DIGEST_LEN); s = (oh->digest[y->ptr] & y->bitmask) != 0; assert(s < 2); - root->cmps++; p = &y->leaf[s]; pp = *p; } @@ -246,7 +244,6 @@ assert(y->ptr < DIGEST_LEN); s = (oh->digest[y->ptr] & y->bitmask) != 0; assert(s < 2); - root->cmps++; p = &y->leaf[s]; } y2->leaf[s2] = *p; @@ -260,7 +257,7 @@ hcb_delete(struct hcb_root *r, struct objhead *oh) { struct hcb_y *y; - uintptr_t *p; + volatile uintptr_t *p; unsigned s; if (r->origo == hcb_r_node(oh)) { @@ -283,7 +280,6 @@ y->leaf[1] = 0; return; } - r->cmps++; p = &y->leaf[s]; } } Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4717 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 From tfheen at varnish-cache.org Mon Apr 26 08:12:16 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 10:12:16 +0200 Subject: r4724 - in branches/2.1: . varnish-cache/bin/varnishd varnish-cache/bin/varnishtest/tests varnish-cache/include varnish-cache/lib/libvarnish varnish-cache/lib/libvcl Message-ID: Author: tfheen Date: 2010-04-26 10:12:16 +0200 (Mon, 26 Apr 2010) New Revision: 4724 Modified: branches/2.1/ branches/2.1/varnish-cache/bin/varnishd/cache_backend.h branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c branches/2.1/varnish-cache/bin/varnishd/vparam.h branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc branches/2.1/varnish-cache/include/vct.h branches/2.1/varnish-cache/include/vev.h branches/2.1/varnish-cache/lib/libvarnish/tcp.c branches/2.1/varnish-cache/lib/libvarnish/vev.c branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c Log: Merge r4719: Close a race between hcb_insert() and hcb_delete() Hit by: dormando Property changes on: branches/2.1 ___________________________________________________________________ Modified: svn:mergeinfo - /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishd/cache_backend.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishd/cache_backend_cfg.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishd/cache_backend_cfg.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Modified: branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c =================================================================== --- branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 07:58:18 UTC (rev 4723) +++ branches/2.1/varnish-cache/bin/varnishd/hash_critbit.c 2010-04-26 08:12:16 UTC (rev 4724) @@ -212,6 +212,12 @@ pp = *p; } + if (pp == 0) { + /* We raced hcb_delete and got a NULL pointer */ + assert(!has_lock); + return (NULL); + } + assert(hcb_is_node(pp)); /* We found a node, does it match ? */ Property changes on: branches/2.1/varnish-cache/bin/varnishd/vparam.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishd/vparam.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/c00019.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishtest/tests/c00019.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00325.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishtest/tests/r00325.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/r00416.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishtest/tests/r00416.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/bin/varnishtest/tests/v00011.vtc ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/bin/varnishtest/tests/v00011.vtc:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/include/vct.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/include/vct.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/include/vev.h ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/include/vev.h:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/tcp.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/lib/libvarnish/tcp.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/lib/libvarnish/vev.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/lib/libvarnish/vev.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 Property changes on: branches/2.1/varnish-cache/lib/libvcl/vcc_dir_random.c ___________________________________________________________________ Modified: svn:mergeinfo - /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4718 + /trunk/varnish-cache/lib/libvcl/vcc_dir_random.c:4637,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 From tfheen at varnish-cache.org Mon Apr 26 08:18:42 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 10:18:42 +0200 Subject: r4725 - branches/2.1/varnish-cache/doc Message-ID: Author: tfheen Date: 2010-04-26 10:18:42 +0200 (Mon, 26 Apr 2010) New Revision: 4725 Modified: branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml Log: Update changelog with critbit fixes Modified: branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml =================================================================== --- branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml 2010-04-26 08:12:16 UTC (rev 4724) +++ branches/2.1/varnish-cache/doc/changes-2.1.0-2.1.1.xml 2010-04-26 08:18:42 UTC (rev 4725) @@ -74,6 +74,12 @@ header. This has to be enabled using the parameter http_range_support. + + + The critbit hasher could get into a deadlock + and had a race condition. Both those have now been fixed. + + varnishsizes From tfheen at varnish-cache.org Mon Apr 26 08:38:03 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 10:38:03 +0200 Subject: r4726 - trunk/varnish-cache Message-ID: Author: tfheen Date: 2010-04-26 10:38:03 +0200 (Mon, 26 Apr 2010) New Revision: 4726 Modified: trunk/varnish-cache/configure.ac Log: Update email address for varnish-dev Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2010-04-26 08:18:42 UTC (rev 4725) +++ trunk/varnish-cache/configure.ac 2010-04-26 08:38:03 UTC (rev 4726) @@ -4,7 +4,7 @@ AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2009 Linpro AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [trunk], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at varnish-cache.org Mon Apr 26 08:49:53 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 10:49:53 +0200 Subject: r4727 - branches/2.1/varnish-cache Message-ID: Author: tfheen Date: 2010-04-26 10:49:53 +0200 (Mon, 26 Apr 2010) New Revision: 4727 Modified: branches/2.1/varnish-cache/configure.ac Log: Release 2.1.1 Modified: branches/2.1/varnish-cache/configure.ac =================================================================== --- branches/2.1/varnish-cache/configure.ac 2010-04-26 08:38:03 UTC (rev 4726) +++ branches/2.1/varnish-cache/configure.ac 2010-04-26 08:49:53 UTC (rev 4727) @@ -5,7 +5,7 @@ Copyright (c) 2006-2010 Redpill Linpro AS Copyright (c) 2010 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [2.1], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [2.1.1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at varnish-cache.org Mon Apr 26 08:50:25 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 10:50:25 +0200 Subject: r4728 - in tags: . varnish-2.1.1 Message-ID: Author: tfheen Date: 2010-04-26 10:50:25 +0200 (Mon, 26 Apr 2010) New Revision: 4728 Added: tags/varnish-2.1.1/ Log: Tag 2.1.1 Property changes on: tags/varnish-2.1.1 ___________________________________________________________________ Added: svn:ignore + .deps Makefile Makefile.in aclocal.m4 autom4te.cache compile config.guess config.h config.h.in config.log config.status config.sub configure depcomp install-sh missing stamp-h1 varnish Added: svn:mergeinfo + /trunk:4637,4640,4643-4645,4647-4650,4654-4670,4686,4689-4690,4700,4712,4715-4719 From phk at varnish-cache.org Mon Apr 26 20:09:14 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Mon, 26 Apr 2010 22:09:14 +0200 Subject: r4729 - in trunk/varnish-cache/doc/sphinx: . glossary installation tutorial Message-ID: Author: phk Date: 2010-04-26 22:09:14 +0200 (Mon, 26 Apr 2010) New Revision: 4729 Added: trunk/varnish-cache/doc/sphinx/glossary/ trunk/varnish-cache/doc/sphinx/glossary/index.rst Modified: trunk/varnish-cache/doc/sphinx/index.rst trunk/varnish-cache/doc/sphinx/installation/index.rst trunk/varnish-cache/doc/sphinx/tutorial/index.rst Log: I started writing the tutorial, but got sidetracked on how to carry through the hands-on. Ended up starting a glossary instead. Added: trunk/varnish-cache/doc/sphinx/glossary/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/glossary/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/glossary/index.rst 2010-04-26 20:09:14 UTC (rev 4729) @@ -0,0 +1,111 @@ + +.. _glossary: + +Varnish Glossary +================ + +.. glossary:: + :sorted: + + .. comment: + + This file will be sorted automagically during formatting, + so we keep the source in subject order to make sure we + cover all bases. + + .. comment: "components of varnish --------------------------------" + + varnishd (NB: with 'd') + This is the actual Varnish cache program. There is only + one program, but when you run it, you will get *two* + processes: The "master" and the "worker" (or "child"). + + master (process) + One of the two processes in the varnishd program. + The master proces is a manager/nanny process which handles + configuration, parameters, compilation of :term:VCL etc. + but it does never get near the actual HTTP traffic. + + worker (process) + The worker process is started and configured by the master + process. This is the process that does all the work you actually + want varnish to do. If the worker dies, the master will try start + it again, to keep your website alive.. + + backend + The HTTP server varnishd is caching for. This can be + any sort of device that handles HTTP requests, including, but + not limited to: a webserver, a CMS, a load-balancer + another varnishd, etc. + + client + The program which sends varnishd a HTTP request, typically + a browser, but do not forget to think about spiders, robots + script-kiddies and criminals. + + varnishstat + Program which presents varnish statistics counters. + + varnishlog + Program which presents varnish transaction log in native format. + + varnishtop + Program which gives real-time "top-X" list view of transaction log. + + varnishncsa + Program which presents varnish transaction log in "NCSA" format. + + varnishhist + Eye-candy program showing responsetime histogram in 1980ies + ASCII-art style. + + varnishtest + Program to test varnishd's behaviour with, simulates backend + and client according to test-scripts. + + .. comment: "components of traffic ---------------------------------" + + header + A HTTP protocol header, like "Accept-Encoding:". + + request + What the client sends to varnishd and varnishd sends to the backend. + + response + What the backend returns to varnishd and varnishd returns to + the client. When the response is stored in varnishd's cache, + we call it an object. + + body + The bytes that make up the contents of the object, varnishd + does not care if they are in HTML, XML, JPEG or even EBCDIC, + to varnishd they are just bytes. + + object + The cached version of a response. Varnishd receives a reponse + from the backend and creates an object, from which it can + produce cached responses to clients. + + .. comment: "configuration of varnishd -----------------------------" + + VCL + Varnish Configuration Language, a small specialized language + for instructing Varnish how to behave. + + .. comment: "actions in VCL ----------------------------------------" + + hit + An object Varnish delivers from cache. + + miss + An object Varnish fetches from the backend. It may or may not + be putin the cache, that depends. + + pass + An object Varnish does not try to cache, but simply fetches + from the backend and hands to the client. + + pipe + Varnish just moves the bytes between client and backend, it + does not try to understand what they mean. + Modified: trunk/varnish-cache/doc/sphinx/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/index.rst 2010-04-26 08:50:25 UTC (rev 4728) +++ trunk/varnish-cache/doc/sphinx/index.rst 2010-04-26 20:09:14 UTC (rev 4729) @@ -19,6 +19,7 @@ installation/index.rst tutorial/index.rst reference/index.rst + glossary/index.rst Indices and tables ================== Modified: trunk/varnish-cache/doc/sphinx/installation/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-26 08:50:25 UTC (rev 4728) +++ trunk/varnish-cache/doc/sphinx/installation/index.rst 2010-04-26 20:09:14 UTC (rev 4729) @@ -1,3 +1,5 @@ +.. _Installation: + %%%%%%%%%%%%%%%%%%%% Varnish Installation %%%%%%%%%%%%%%%%%%%% Modified: trunk/varnish-cache/doc/sphinx/tutorial/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/tutorial/index.rst 2010-04-26 08:50:25 UTC (rev 4728) +++ trunk/varnish-cache/doc/sphinx/tutorial/index.rst 2010-04-26 20:09:14 UTC (rev 4729) @@ -4,6 +4,36 @@ Varnish Tutorial %%%%%%%%%%%%%%%% +Welcome to the Varnish Tutorial, we hope this will help you get to +know and understand Varnish. + +Most tutorials are written in "subject-order", as the old Peanuts +strip goes:: + + Jogging: A Handbook + Author: S. Noopy + Chapter 1: Left foot + It was a dark and stormy night... + +This is great when the reader has no choice, or nothing better to do, but +read the entire document before starting. + +We have taken the other approach: "breadth-first", because experience +has shown us that Varnish users wants to get things running, and then +polish up things later on. + +With that in mind, we have written the tutorial so you can break off, +as Calvin tells Ms. Wormwood, "when my brain is full for today", and +come back later and learn more. + +That also means that right from the start, we will have several +things going on in parallel and you will need at least four, sometimes +more, terminal windows at the same time, to run the examples. + + +//todo// First simple example (pending varnishtest support) + + .. todo:: starting varnish with -d, seeing a transaction go through explain varnishlog output for a miss and a hit From tfheen at varnish-cache.org Mon Apr 26 20:39:16 2010 From: tfheen at varnish-cache.org (tfheen at varnish-cache.org) Date: Mon, 26 Apr 2010 22:39:16 +0200 Subject: r4730 - trunk/varnish-cache/doc/sphinx/installation Message-ID: Author: tfheen Date: 2010-04-26 22:39:15 +0200 (Mon, 26 Apr 2010) New Revision: 4730 Modified: trunk/varnish-cache/doc/sphinx/installation/help.rst Log: Fix up some links, typo, email address Modified: trunk/varnish-cache/doc/sphinx/installation/help.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/installation/help.rst 2010-04-26 20:09:14 UTC (rev 4729) +++ trunk/varnish-cache/doc/sphinx/installation/help.rst 2010-04-26 20:39:15 UTC (rev 4730) @@ -25,7 +25,8 @@ The main timezone of the channel is Europe+America. If you can explain your problem in a few clear sentences, without too -much copy&paste, IRC is a good way to try to get help. +much copy&paste, IRC is a good way to try to get help. If you do need +to paste log files, VCL and so on, please use a pastebin_. If the channel is all quiet, try again some time later, we do have lives, families and jobs to deal with also. @@ -50,7 +51,7 @@ suggestions, ideas and so on. If you are new to Varnish it may pay off to subscribe to -misc, simply to have an ear to the telegraph-pole and learn some smart tricks. This is a good place to ask for help -with more complex issues, that require quoting of files and longis +with more complex issues, that require quoting of files and long explanations. Make sure to pick a good subject line, and if the subject of the @@ -73,7 +74,7 @@ pile of sensible suggestions for future enhancements and call for help from people who forget to check back if they get it and so on. -We track suggestions and ideas in our "Shopping-List" wiki page, and user +We track suggestions and ideas in our `"Shopping-List" wiki page`_, and user support via email and IRC. Commercial Support @@ -84,7 +85,9 @@ an email to phk at FreeBSD.org. Varnish Software - perbu at varnish-software.com + sales at varnish-software.com .. _Mailman: http://lists.varnish-cache.org/mailman/listinfo +.. _pastebin: http://gist.github.com/ +.. _"Shopping-List" wiki page: http://varnish-cache.org/wiki/PostTwoShoppingList From phk at varnish-cache.org Tue Apr 27 08:37:27 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 10:37:27 +0200 Subject: r4731 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-27 10:37:27 +0200 (Tue, 27 Apr 2010) New Revision: 4731 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc Log: Don't rely on CNN's CDN architecture, use a FQDN that we control. Modified: trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2010-04-26 20:39:15 UTC (rev 4730) +++ trunk/varnish-cache/bin/varnishtest/tests/v00002.vtc 2010-04-27 08:37:27 UTC (rev 4731) @@ -114,7 +114,7 @@ varnish v1 -badvcl { /* too many IP numbers */ - backend b1 { .host = "cnn.com"; } + backend b1 { .host = "v00002.freebsd.dk"; } } varnish v1 -badvcl { From phk at varnish-cache.org Tue Apr 27 14:45:43 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 16:45:43 +0200 Subject: r4732 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-27 16:45:43 +0200 (Tue, 27 Apr 2010) New Revision: 4732 Added: trunk/varnish-cache/lib/libvcl/generate.py Log: A Python3 version of the vcc_gen_fixed_token.tcl script. Added: trunk/varnish-cache/lib/libvcl/generate.py =================================================================== --- trunk/varnish-cache/lib/libvcl/generate.py (rev 0) +++ trunk/varnish-cache/lib/libvcl/generate.py 2010-04-27 14:45:43 UTC (rev 4732) @@ -0,0 +1,709 @@ +#!/usr/local/bin/python3.1 +#- +# Copyright (c) 2006 Verdens Gang AS +# Copyright (c) 2006-2009 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. +# +# Generate various .c and .h files for the VCL compiler and the interfaces +# for it. +# +# $Id$ + +####################################################################### +# These are our tokens + +# We could drop all words such as "include", "if" etc, and use the +# ID type instead, but declaring them tokens makes them reserved words +# which hopefully makes for better error messages. +# XXX: does it actually do that ? + +tokens = { + "T_INC": "++", + "T_DEC": "--", + "T_CAND": "&&", + "T_COR": "||", + "T_LEQ": "<=", + "T_EQ": "==", + "T_NEQ": "!=", + "T_GEQ": ">=", + "T_SHR": ">>", + "T_SHL": "<<", + "T_INCR": "+=", + "T_DECR": "-=", + "T_MUL": "*=", + "T_DIV": "/=", + "T_NOMATCH": "!~", + "T_INCLUDE": "include", + "T_IF": "if", + "T_ELSEIF": "elseif", + "T_ELSIF": "elsif", + "T_ELSE": "else", + + # Single char tokens, for convenience on one line + None: "{}()*+-/%><=;!&.|~,", + + # These have handwritten recognizers + "ID": None, + "VAR": None, + "CNUM": None, + "CSTR": None, + "EOI": None, + "CSRC": None, +} + +####################################################################### +# Our methods and actions + +returns =( + ('recv', ('error', 'pass', 'pipe', 'lookup',)), + ('pipe', ('error', 'pipe',)), + ('pass', ('error', 'restart', 'pass',)), + ('hash', ('hash',)), + ('miss', ('error', 'restart', 'pass', 'fetch',)), + ('hit', ('error', 'restart', 'pass', 'deliver',)), + ('fetch', ('error', 'restart', 'pass', 'deliver',)), + ('deliver', ('restart', 'deliver',)), + ('error', ('restart', 'deliver',)), +) + + +####################################################################### +# Variables available in sessions + +sp_variables = ( + ('client.ip', + 'IP', 'RO', + ( 'all',), + 'const struct sess *' + ), + ('server.ip', + 'IP', 'RO', + ( 'all',), + 'struct sess *' + ), + ('server.hostname', + 'STRING', 'RO', + ( 'all',), + 'struct sess *' + ), + ('server.identity', + 'STRING', 'RO', + ( 'all',), + 'struct sess *' + ), + ('server.port', + 'INT', 'RO', + ( 'all',), + 'struct sess *' + ), + ('req.request', + 'STRING', 'RW', + ( 'all',), + 'const struct sess *' + ), + ('req.url', + 'STRING', 'RW', + ( 'all',), + 'const struct sess *' + ), + ('req.proto', + 'STRING', 'RW', + ( 'all',), + 'const struct sess *' + ), + ('req.http.', + 'HDR_REQ', 'RW', + ( 'all',), + 'const struct sess *' + ), + ('req.hash', + 'HASH', 'WO', + ( 'hash', 'error',), + 'struct sess *' + ), + ('req.backend', + 'BACKEND', 'RW', + ( 'all',), + 'struct sess *' + ), + ('req.restarts', + 'INT', 'RO', + ( 'all',), + 'const struct sess *' + ), + ('req.grace', + 'RTIME', 'RW', + ( 'all',), + 'struct sess *' + ), + ('req.xid', + 'STRING', 'RO', + ( 'all',), + 'struct sess *' + ), + ('req.esi', + 'BOOL', 'RW', + ( 'recv', 'fetch', 'deliver', 'error',), + 'struct sess *' + ), + ('req.backend.healthy', + 'BOOL', 'RO', + ( 'all',), + 'const struct sess *' + ), + ('bereq.request', + 'STRING', 'RW', + ( 'pipe', 'pass', 'miss', 'fetch',), + 'const struct sess *' + ), + ('bereq.url', + 'STRING', 'RW', + ( 'pipe', 'pass', 'miss', 'fetch',), + 'const struct sess *' + ), + ('bereq.proto', + 'STRING', 'RW', + ( 'pipe', 'pass', 'miss', 'fetch',), + 'const struct sess *' + ), + ('bereq.http.', + 'HDR_BEREQ', 'RW', + ( 'pipe', 'pass', 'miss', 'fetch',), + 'const struct sess *' + ), + ('bereq.connect_timeout', + 'RTIME', 'RW', + ( 'pass', 'miss',), + 'struct sess *' + ), + ('bereq.first_byte_timeout', + 'RTIME', 'RW', + ( 'pass', 'miss',), + 'struct sess *' + ), + ('bereq.between_bytes_timeout', + 'RTIME', 'RW', + ( 'pass', 'miss',), + 'struct sess *' + ), + ('beresp.proto', + 'STRING', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.saintmode', + 'RTIME', 'WO', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.status', + 'INT', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.response', + 'STRING', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.http.', + 'HDR_BERESP', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.cacheable', + 'BOOL', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.ttl', + 'RTIME', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('beresp.grace', + 'RTIME', 'RW', + ( 'fetch',), + 'const struct sess *' + ), + ('obj.proto', + 'STRING', 'RW', + ( 'hit', 'error',), + 'const struct sess *' + ), + ('obj.status', + 'INT', 'RW', + ( 'error',), + 'const struct sess *' + ), + ('obj.response', + 'STRING', 'RW', + ( 'error',), + 'const struct sess *' + ), + ('obj.hits', + 'INT', 'RO', + ( 'hit', 'deliver',), + 'const struct sess *' + ), + ('obj.http.', + 'HDR_OBJ', 'RW', + ( 'hit', 'error',), + 'const struct sess *' + ), + ('obj.cacheable', + 'BOOL', 'RW', + ( 'hit',), + 'const struct sess *' + ), + ('obj.ttl', + 'RTIME', 'RW', + ( 'hit', 'error',), + 'const struct sess *' + ), + ('obj.grace', + 'RTIME', 'RW', + ( 'hit', 'error',), + 'const struct sess *' + ), + ('obj.lastuse', + 'RTIME', 'RO', + ( 'hit', 'deliver', 'error',), + 'const struct sess *' + ), + ('resp.proto', + 'STRING', 'RW', + ( 'deliver',), + 'const struct sess *' + ), + ('resp.status', + 'INT', 'RW', + ( 'deliver',), + 'const struct sess *' + ), + ('resp.response', + 'STRING', 'RW', + ( 'deliver',), + 'const struct sess *' + ), + ('resp.http.', + 'HDR_RESP', 'RW', + ( 'deliver',), + 'const struct sess *' + ), + ('now', + 'TIME', 'RO', + ( 'all',), + 'const struct sess *' + ), +) +####################################################################### +# VCL to C type conversion + +vcltypes = { + 'IP': "struct sockaddr *", + 'STRING': "const char *", + 'BOOL': "unsigned", + 'BACKEND': "struct director *", + 'TIME': "double", + 'RTIME': "double", + 'INT': "int", + 'HDR_RESP': "const char *", + 'HDR_OBJ': "const char *", + 'HDR_REQ': "const char *", + 'HDR_BEREQ': "const char *", + 'HOSTNAME': "const char *", + 'PORTNAME': "const char *", + 'HASH': "const char *", + 'SET': "struct vrt_backend_entry *", +} + +####################################################################### +# Nothing is easily configurable below this line. +####################################################################### + +import sys +import copy + +####################################################################### +# Emit a function to recognize tokens in a string + +def emit_vcl_fixed_token(fo, tokens): + + recog = list() + emit = dict() + for i in tokens: + j = tokens[i] + if (j != None): + recog.append(j) + emit[j] = i + + recog.sort() + rrecog = copy.copy(recog) + rrecog.sort(key = lambda x: -len(x)) + + fo.write(""" +#define M1()\tdo {*q = p + 1; return (p[0]); } while (0) +#define M2(c,t)\tdo {if (p[1] == (c)) { *q = p + 2; return (t); }} while (0) + +unsigned +vcl_fixed_token(const char *p, const char **q) +{ + +\tswitch (p[0]) { +""") + last_initial = None + for i in recog: + if (i[0] == last_initial): + continue + last_initial = i[0] + fo.write("\tcase '%s':\n" % last_initial) + need_ret = True + for j in rrecog: + if (j[0] != last_initial): + continue + if len(j) == 2: + fo.write("\t\tM2('%s', %s);\n" % + (j[1], emit[j])) + elif len(j) == 1: + fo.write("\t\tM1();\n") + need_ret = False + else: + fo.write("\t\tif (") + k = 1 + l = len(j) + while (k < l): + fo.write("p[%d] == '%s'" % (k, j[k])) + fo.write(" && ") + if (k % 3) == 0: + fo.write("\n\t\t ") + k += 1 + fo.write("!isvar(p[%d])) {\n" % l) + fo.write("\t\t\t*q = p + %d;\n" % l) + fo.write("\t\t\treturn (%s);\n" % emit[j]) + fo.write("\t\t}\n") + if need_ret: + fo.write("\t\treturn (0);\n") + fo.write("\tdefault:\n\t\treturn (0);\n\t}\n}\n") + +####################################################################### +# Emit the vcl_tnames (token->string) conversion array + +def emit_vcl_tnames(fo, tokens): + fo.write("\nconst char * const vcl_tnames[256] = {\n") + l = list(tokens.keys()) + l.sort() + for i in l: + j = tokens[i] + if j == None: + j = i + if i[0] == "'": + j = i + fo.write("\t[%s] = \"%s\",\n" % (i, j)) + fo.write("};\n") + +####################################################################### +# Read a C-source file and spit out code that outputs it with vsb_cat() + +def emit_file(fo, fn): + fi = open(fn) + fc = fi.read() + fi.close() + + w = 66 # Width of lines, after white space prefix + maxlen = 10240 # Max length of string literal + + x = 0 + l = 0 + fo.write("\n\t/* %s */\n\n" % fn) + for c in fc: + if l == 0: + fo.write("\tvsb_cat(sb, \"") + l += 12 + x += 12 + if x == 0: + fo.write("\t \"") + d = c + if c == '\n': + d = "\\n" + elif c == '\t': + d = "\\t" + elif c == '"': + d = "\\\"" + elif c == '\\': + d = "\\\\" + + if c == '\n' and x > w - 20: + fo.write(d + "\"\n") + x = 0 + continue + if c.isspace() and x > w - 10: + fo.write(d + "\"\n") + x = 0 + continue + + fo.write(d) + x += len(d) + l += len(d) + if l > maxlen: + fo.write("\");\n") + l = 0; + x = 0 + if x > w - 3: + fo.write("\"\n") + x = 0 + fo.write("\");\n") + +####################################################################### + +def polish_tokens(tokens): + # Expand single char tokens + st = tokens[None] + del tokens[None] + + for i in st: + tokens["'" + i + "'"] = i +####################################################################### + +def file_header(fo): + fo.write(""" +/* + * $%s$ + * + * NB: This file is machine generated, DO NOT EDIT! + * + * Edit and run generate.py instead + */ +""" % "Id") + +####################################################################### + +fo = open("vcc_fixed_token.c", "w") + +file_header(fo) +fo.write(""" + +#include "config.h" +#include +#include +#include "config.h" +#include "vcc_priv.h" +#include "vsb.h" +""") + +polish_tokens(tokens) +emit_vcl_fixed_token(fo, tokens) +emit_vcl_tnames(fo, tokens) + +fo.write(""" +void +vcl_output_lang_h(struct vsb *sb) +{ +""") + +emit_file(fo, "../../include/vcl.h") +emit_file(fo, "../../include/vrt.h") +emit_file(fo, "../../include/vrt_obj.h") + +fo.write(""" +} +""") + +fo.close() + +####################################################################### + +fo = open("vcc_token_defs.h", "w") + +file_header(fo) + +j = 128 +l = list(tokens.keys()) +l.sort() +for i in l: + if i[0] == "'": + continue + fo.write("#define\t%s %d\n" % (i, j)) + j += 1 + assert j < 256 + +fo.close() + +####################################################################### + +rets = dict() +vcls = list() +for i in returns: + vcls.append(i[0]) + for j in i[1]: + rets[j] = True + + +####################################################################### + +fo = open("../../include/vcl_returns.h", "w") + +file_header(fo) + +fo.write("\n#ifdef VCL_RET_MAC\n") +l = list(rets.keys()) +l.sort() +for i in l: + fo.write("VCL_RET_MAC(%s, %s)\n" % (i.lower(), i.upper())) +fo.write("#endif\n") +fo.write("\n#ifdef VCL_MET_MAC\n") +for i in returns: + fo.write("VCL_MET_MAC(%s,%s,\n" % (i[0].lower(), i[0].upper())) + p = " (" + for j in i[1]: + fo.write(" %s(1U << VCL_RET_%s)\n" % (p, j.upper())) + p = "| " + fo.write("))\n") +fo.write("#endif\n") +fo.close() + +####################################################################### + +fo = open("../../include/vcl.h", "w") + +file_header(fo) + +fo.write(""" +struct sess; +struct cli; + +typedef void vcl_init_f(struct cli *); +typedef void vcl_fini_f(struct cli *); +typedef int vcl_func_f(struct sess *sp); +""") + + +fo.write("\n/* VCL Methods */\n") +n = 0 +for i in returns: + fo.write("#define VCL_MET_%s\t\t(1U << %d)\n" % (i[0].upper(), n)) + n += 1 + +fo.write("\n#define VCL_MET_MAX\t\t%d\n" % n) + + +fo.write("\n/* VCL Returns */\n") +n = 0 +l = list(rets.keys()) +l.sort() +for i in l: + fo.write("#define VCL_RET_%s\t\t%d\n" % (i.upper(), n)) + n += 1 + +fo.write("\n#define VCL_RET_MAX\t\t%d\n" % n) + + +fo.write(""" +struct VCL_conf { + 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; + + unsigned nsrc; + const char **srcname; + const char **srcbody; + + vcl_init_f *init_func; + vcl_fini_f *fini_func; + + vcl_func_f *recv_func; + vcl_func_f *pipe_func; + vcl_func_f *pass_func; + vcl_func_f *hash_func; + vcl_func_f *miss_func; + vcl_func_f *hit_func; + vcl_func_f *fetch_func; + vcl_func_f *deliver_func; + vcl_func_f *error_func; +}; +""") + +fo.close() + +####################################################################### + +fo=open("vcc_obj.c", "w") +file_header(fo) + +fo.write(""" +#include "config.h" +#include +#include "vcc_compile.h" + +struct var vcc_vars[] = { +""") + +for i in sp_variables: + typ = i[1] + if typ[:4] == "HDR_": + typ = "HEADER" + fo.write("\t{ \"%s\", %s, %d,\n" % (i[0], typ, len(i[0]))) + if i[2] == "RO" or i[2] == "RW": + fo.write('\t "VRT_r_%s(sp)",\n' % i[0].replace(".", "_")) + else: + fo.write('\t NULL,\n') + if i[2] == "WO" or i[2] == "RW": + fo.write('\t "VRT_l_%s(sp, ",\n' % i[0].replace(".", "_")) + else: + fo.write('\t NULL,\n') + fo.write('\t V_%s,' % i[2]) + if typ == "HEADER": + fo.write('\t "%s",\n' % i[1]) + else: + fo.write('\t 0,\n') # XXX: shoule be NULL + x = i[3] + if x[0] == 'all': + x = vcls + p = "" + n = 0 + for j in x: + if n == 0: + fo.write("\t ") + n += 1 + fo.write(p + "VCL_MET_" + j.upper()) + p = " | " + if n == 4: + fo.write("\n") + n = 0 + + if n > 0: + fo.write("\n") + fo.write("\t},\n") + +fo.write("\t{ NULL }\n};\n") + +fo.close() Property changes on: trunk/varnish-cache/lib/libvcl/generate.py ___________________________________________________________________ Added: svn:executable + * From phk at varnish-cache.org Tue Apr 27 15:16:03 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 17:16:03 +0200 Subject: r4733 - in trunk/varnish-cache: . lib/libvcl Message-ID: Author: phk Date: 2010-04-27 17:16:03 +0200 (Tue, 27 Apr 2010) New Revision: 4733 Modified: trunk/varnish-cache/configure.ac trunk/varnish-cache/lib/libvcl/Makefile.am Log: Have auto* look for a python3 instead of tclsh and use the python version of the VCC generator script Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2010-04-27 14:45:43 UTC (rev 4732) +++ trunk/varnish-cache/configure.ac 2010-04-27 15:16:03 UTC (rev 4733) @@ -291,9 +291,9 @@ fi AM_MISSING_HAS_RUN -AC_CHECK_PROGS(TCLSH, [tclsh tclsh8.4 tclsh8.5], :) -if test "$TCLSH" = :; then - TCLSH="${am_missing_run}tclsh" +AC_CHECK_PROGS(PYTHON3, [python3 python3.1 python3.2], :) +if test "$PYTHON3" = :; then + PYTHON3="${am_missing_run}python3" fi # Solaris defines SO_{RCV,SND}TIMEO, but does not implement them. Modified: trunk/varnish-cache/lib/libvcl/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvcl/Makefile.am 2010-04-27 14:45:43 UTC (rev 4732) +++ trunk/varnish-cache/lib/libvcl/Makefile.am 2010-04-27 15:16:03 UTC (rev 4733) @@ -27,13 +27,13 @@ vcc_xref.c EXTRA_DIST = \ - vcc_gen_fixed_token.tcl + generate.py -$(srcdir)/vcc_obj.c: $(srcdir)/vcc_gen_fixed_token.tcl - cd $(srcdir) && @TCLSH@ vcc_gen_fixed_token.tcl || true +$(srcdir)/vcc_obj.c: $(srcdir)/generate.py + cd $(srcdir) && @PYTHON3@ generate.py || true -$(srcdir)/vcc_fixed_token.c: $(srcdir)/vcc_gen_fixed_token.tcl $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h - cd $(srcdir) && @TCLSH@ vcc_gen_fixed_token.tcl || true +$(srcdir)/vcc_fixed_token.c: $(srcdir)/generate.py $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h + cd $(srcdir) && @PYTHON3@ generate.py || true -$(srcdir)/vcc_token_defs.h: $(srcdir)/vcc_gen_fixed_token.tcl $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h - cd $(srcdir) && @TCLSH@ vcc_gen_fixed_token.tcl || true +$(srcdir)/vcc_token_defs.h: $(srcdir)/generate.py $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h + cd $(srcdir) && @PYTHON3@ generate.py || true From phk at varnish-cache.org Tue Apr 27 15:18:20 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 17:18:20 +0200 Subject: r4734 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-27 17:18:19 +0200 (Tue, 27 Apr 2010) New Revision: 4734 Removed: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl Log: Retire the tcl version of the VCC generator script Deleted: trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2010-04-27 15:16:03 UTC (rev 4733) +++ trunk/varnish-cache/lib/libvcl/vcc_gen_fixed_token.tcl 2010-04-27 15:18:19 UTC (rev 4734) @@ -1,774 +0,0 @@ -#!/usr/local/bin/tclsh8.4 -#- -# Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2009 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. -# -# 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. -# Second element is list of valid return actions. -# -set methods { - {recv {error pass pipe lookup}} - {pipe {error pipe}} - {pass {error restart pass}} - {hash {hash}} - {miss {error restart pass fetch}} - {hit {error restart pass deliver}} - {fetch {error restart pass deliver}} - {deliver {restart deliver}} - {error {restart deliver}} -} - -# Language keywords -# -set keywords { - include - - if else elseif elsif -} - -# Non-word tokens -# -set magic { - {"++" INC} - {"--" DEC} - {"&&" CAND} - {"||" COR} - {"<=" LEQ} - {"==" EQ} - {"!=" NEQ} - {">=" GEQ} - {">>" SHR} - {"<<" SHL} - {"+=" INCR} - {"-=" DECR} - {"*=" MUL} - {"/=" DIV} - {"!~" NOMATCH} -} - -# Single char tokens -# -set char {{}()*+-/%><=;!&.|~,} - -# Other token identifiers -# -set extras {ID VAR CNUM CSTR EOI CSRC} - -#---------------------------------------------------------------------- -# Variables available in sessions -# Comments are stripped from #...\n -set spobj { - - # Connection related parameters - { client.ip IP - RO - all - "const struct sess *" - } - { server.ip IP - RO - all - "struct sess *" - } - { server.hostname STRING - RO - all - "struct sess *" - } - { server.identity STRING - RO - all - "struct sess *" - } - { server.port INT - RO - all - "struct sess *" - } - # Request paramters - { req.request STRING - RW - all - "const struct sess *" - } - { req.url STRING - RW - all - "const struct sess *" - } - { req.proto STRING - RW - all - "const struct sess *" - } - { req.http. HDR_REQ - RW - all - "const struct sess *" - } - - # Possibly misnamed, not really part of the request - { req.hash HASH - WO - { hash error } - "struct sess *" - } - { req.backend BACKEND - RW - all - "struct sess *" - } - { req.restarts INT - RO - all - "const struct sess *" - } - { req.grace RTIME - RW - all - "struct sess *" - } - - { req.xid STRING - RO - all - "struct sess *" - } - - { req.esi BOOL - RW - {recv fetch deliver error } - "struct sess *" - } - - { req.backend.healthy BOOL - RO - all - "const struct sess *" - } - - ####################################################################### - # Request sent to backend - { bereq.request STRING - RW - { pipe pass miss fetch } - "const struct sess *" - } - { bereq.url STRING - RW - { pipe pass miss fetch } - "const struct sess *" - } - { bereq.proto STRING - RW - { pipe pass miss fetch } - "const struct sess *" - } - { bereq.http. HDR_BEREQ - RW - { pipe pass miss fetch } - "const struct sess *" - } - { bereq.connect_timeout RTIME - RW - { pass miss } - "struct sess *" - } - { bereq.first_byte_timeout RTIME - RW - { pass miss } - "struct sess *" - } - { bereq.between_bytes_timeout RTIME - RW - { pass miss } - "struct sess *" - } - - ####################################################################### - # Response from the backend - { beresp.proto STRING - RW - { fetch } - "const struct sess *" - } - { beresp.saintmode RTIME - WO - { fetch } - "const struct sess *" - } - { beresp.status INT - RW - { fetch } - "const struct sess *" - } - { beresp.response STRING - RW - { fetch } - "const struct sess *" - } - { beresp.http. HDR_BERESP - RW - { fetch } - "const struct sess *" - } - { beresp.cacheable BOOL - RW - { fetch } - "const struct sess *" - } - { beresp.ttl RTIME - RW - { fetch } - "const struct sess *" - } - { beresp.grace RTIME - RW - { fetch } - "const struct sess *" - } - - ####################################################################### - # The (possibly) cached object - { obj.proto STRING - RW - { hit error } - "const struct sess *" - } - { obj.status INT - RW - { error } - "const struct sess *" - } - { obj.response STRING - RW - { error } - "const struct sess *" - } - { obj.hits INT - RO - { hit deliver } - "const struct sess *" - } - { obj.http. HDR_OBJ - RW - { hit error } - "const struct sess *" - } - - { obj.cacheable BOOL - RW - { hit } - "const struct sess *" - } - { obj.ttl RTIME - RW - { hit error } - "const struct sess *" - } - { obj.grace RTIME - RW - { hit error } - "const struct sess *" - } - { obj.lastuse RTIME - RO - { hit deliver error } - "const struct sess *" - } - - ####################################################################### - # The response we send back - { resp.proto STRING - RW - { deliver } - "const struct sess *" - } - { resp.status INT - RW - { deliver } - "const struct sess *" - } - { resp.response STRING - RW - { deliver } - "const struct sess *" - } - { resp.http. HDR_RESP - RW - { deliver } - "const struct sess *" - } - - # Miscellaneous - # XXX: I'm not happy about this one. All times should be relative - # XXX: or delta times in VCL programs, so this shouldn't be needed /phk - { now TIME - RO - all - "const struct sess *" - } -} - -set tt(IP) "struct sockaddr *" -set tt(STRING) "const char *" -set tt(BOOL) "unsigned" -set tt(BACKEND) "struct director *" -set tt(TIME) "double" -set tt(RTIME) "double" -set tt(INT) "int" -set tt(HDR_RESP) "const char *" -set tt(HDR_OBJ) "const char *" -set tt(HDR_REQ) "const char *" -set tt(HDR_BEREQ) "const char *" -set tt(HOSTNAME) "const char *" -set tt(PORTNAME) "const char *" -set tt(HASH) "const char *" -set tt(SET) "struct vrt_backend_entry *" - -#---------------------------------------------------------------------- -# Figure out the union list of return actions -foreach i $methods { - foreach j [lindex $i 1] { - set tmp($j) 1 - } -} -set returns [lsort [array names tmp]] -unset tmp - -#---------------------------------------------------------------------- -# Boilerplate warning for all generated files. - -proc warns {fd} { - - puts $fd "/*" - puts $fd \ - { * $Id$} - puts $fd " *" - puts $fd " * NB: This file is machine generated, DO NOT EDIT!" - puts $fd " *" - puts $fd " * Edit and run vcc_gen_fixed_token.tcl instead" - puts $fd " */" - puts $fd "" -} - -#---------------------------------------------------------------------- -# Include a .h file as a string. - -proc copy_include {n} { - global fo - - puts $fo "\n\t/* $n */\n" - set fi [open $n] - set n 0 - while {[gets $fi a] >= 0} { - 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 > 30} { - puts $fo "\");" - set n 0 - } - } - if {$n > 0} { - puts $fo "\");" - } - close $fi -} - -#---------------------------------------------------------------------- -# Build the variable related .c and .h files - -set fo [open vcc_obj.c w] -warns $fo -set fp [open ../../include/vrt_obj.h w] -warns $fp - -proc method_map {m} { - global methods - - if {$m == "all"} { - set m "" - foreach i $methods { - lappend m [lindex $i 0] - } - } - set l1 "" - set l2 "" - foreach i $m { - 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 {$l2 != ""} { - if {$l1 != ""} { - append l1 "\n\t " - } - append l1 "$l2" - } - if {$l1 == ""} { - return "0" - } - return $l1 -} - -proc vars {v pa} { - global tt fo fp - - regsub -all "#\[^\n\]*\n" $v "" v - foreach v $v { - set n [lindex $v 0] - regsub -all {[.]} $n "_" m - set t [lindex $v 1] - set a [lindex $v 2] - if {$a == "NO"} continue - set ty [lindex $v 4] - if {[regexp HDR_ $t]} { - puts $fo "\t\{ \"$n\", HEADER, [string length $n]," - } else { - puts $fo "\t\{ \"$n\", $t, [string length $n]," - } - if {$a == "RO" || $a == "RW"} { - puts $fo "\t \"VRT_r_${m}($pa)\"," - if {![regexp HDR_ $t]} { - puts $fp "$tt($t) VRT_r_${m}($ty);" - } - } else { - puts $fo "\t NULL," - } - if {$a == "WO" || $a == "RW"} { - puts $fo "\t \"VRT_l_${m}($pa, \"," - if {[regexp HDR_ $t]} { - } elseif {$t == "STRING"} { - puts $fp "void VRT_l_${m}($ty, $tt($t), ...);" - } else { - puts $fp "void VRT_l_${m}($ty, $tt($t));" - } - } else { - puts $fo "\t NULL," - } - puts -nonewline $fo "\t V_$a," - if {![regexp HDR_ $t]} { - puts $fo "\t 0," - } else { - puts $fo "\t \"$t\"," - } - puts $fo "\t [method_map [lindex $v 3]]" - puts $fo "\t\}," - - } - puts $fo "\t{ NULL }" -} - -puts $fo "#include \"config.h\"" -puts $fo "#include " -puts $fo "#include \"vcc_compile.h\"" -puts $fo "" - -puts $fo "struct var vcc_vars\[\] = {" -vars $spobj "sp" -puts $fo "};" -close $fp - - -#---------------------------------------------------------------------- -# Build the vcl.h #include file - -set fo [open ../../include/vcl.h w] -warns $fo -puts $fo {struct sess; -struct cli; - -typedef void vcl_init_f(struct cli *); -typedef void vcl_fini_f(struct cli *); -typedef int vcl_func_f(struct sess *sp); -} - -puts $fo "/* VCL Methods */" -set u 0 -foreach m $methods { - if {[string length [lindex $m 0]] < 8} { - set sp "\t" - } else { - set sp "" - } - puts -nonewline $fo "#define VCL_MET_[string toupper [lindex $m 0]]\t" - puts $fo "${sp}(1U << $u)" - incr u -} - -puts $fo "\n#define VCL_MET_MAX\t\t$u\n" - -puts $fo "/* VCL Returns */" -set i 0 -foreach k $returns { - puts $fo "#define VCL_RET_[string toupper $k]\t\t$i" - incr i -} -puts $fo "\n#define VCL_RET_MAX\t\t$i\n" - -puts $fo "struct VCL_conf {" -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; - - unsigned nsrc; - const char **srcname; - const char **srcbody; - - vcl_init_f *init_func; - vcl_fini_f *fini_func; -} -foreach m $methods { - puts $fo "\tvcl_func_f\t*[lindex $m 0]_func;" -} -puts $fo "};" - -close $fo - -#---------------------------------------------------------------------- -# Build the vcl_returns.h #include file - -set for [open "../../include/vcl_returns.h" w] -warns $for -puts $for "#ifdef VCL_RET_MAC" -set i 0 -foreach k $returns { - set u [string toupper $k] - if {$k == "error"} { - puts $for "VCL_RET_MAC($k, $u)" - } else { - puts $for "VCL_RET_MAC($k, $u)" - } - incr i -} -puts $for "#endif" -puts $for "" -puts $for "#ifdef VCL_MET_MAC" -set u 0 -foreach m $methods { - puts -nonewline $for "VCL_MET_MAC([lindex $m 0]" - puts -nonewline $for ",[string toupper [lindex $m 0]]" - set l [lindex $m 1] - puts $for "," - puts $for " ((1U << VCL_RET_[string toupper [lindex $l 0]])" - foreach r [lrange $l 1 end] { - puts $for " | (1U << VCL_RET_[string toupper $r])" - } - puts $for "))" - incr u -} -puts $for "#endif" -close $for - -#---------------------------------------------------------------------- -# Build the compiler token table and recognizers - -set fo [open "vcc_fixed_token.c" w] -warns $fo - -set foh [open "vcc_token_defs.h" w] -warns $foh - -puts $fo "#include \"config.h\"" -puts $fo "#include " -puts $fo "#include " -puts $fo "#include \"config.h\"" -puts $fo "#include \"vcc_priv.h\"" -puts $fo "#include \"vsb.h\"" - -set tn 128 - -proc add_token {tok str alpha} { - global tokens tn fixed foh - - lappend tokens [list $tok $str] - puts $foh "#define $tok $tn" - incr tn - lappend fixed [list $str $tok $alpha] -} - -proc mk_token {tok str alpha} { - set tok T_[string toupper $tok] - add_token $tok $str $alpha -} - -foreach k $keywords { mk_token $k $k 1 } -foreach k $magic { mk_token [lindex $k 1] [lindex $k 0] 0 } -foreach k $extras { - set t [string toupper $k] - lappend tokens [list $t $t] - puts $foh "#define [string toupper $k] $tn" - incr tn -} -for {set i 0} {$i < [string length $char]} {incr i} { - set t [string index $char $i] - lappend token2 [list '$t' T$t] - lappend fixed [list "$t" '$t' 0] -} - -set tokens [lsort $tokens] -set token2 [lsort $token2] - -# We want to output in ascii order: create sorted first char list -foreach t $fixed { - set xx([string index [lindex $t 0] 0]) 1 -} -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 "{" -puts $fo "" -puts $fo " switch (p\[0\]) {" - -foreach ch "$seq" { - # Now find all tokens starting with ch - set l "" - foreach t $fixed { - if {[string index [lindex $t 0] 0] == $ch} { - lappend l $t - } - } - # And do then in reverse order to match longest first - set l [lsort -index 0 -decreasing $l] - scan "$ch" "%c" cx - puts $fo " case '$ch':" - set retval "0" - set m1 0 - foreach ty $l { - set k [lindex $ty 0] - if {[string length $k] == 1} { - 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 $ty 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] == 1} { - puts -nonewline $fo "\n\t\t " - } - puts -nonewline $fo " " - } - puts -nonewline $fo "p\[$i\] == '[string index $k $i]'" - } - if {[lindex $ty 2]} { - if {[expr $i % 3] == 1} { - puts -nonewline $fo "\n\t\t " - } - puts -nonewline $fo " && !isvar(p\[$i\])" - } - puts $fo ") {" - puts $fo "\t\t\t*q = p + [string length $k];" - puts $fo "\t\t\treturn ([lindex $ty 1]);" - puts $fo "\t\t}" - } - if {$m1 == 0} { - puts $fo "\t\treturn ($retval);" - } -} - -puts $fo " default:" -puts $fo " return (0);" -puts $fo " }" -puts $fo "}" - -puts $fo "" -puts $fo "const char * const vcl_tnames\[256\] = {" -foreach i $token2 { - puts $fo "\t\[[lindex $i 0]\] = \"[lindex $i 0]\"," -} -foreach i $tokens { - puts $fo "\t\[[lindex $i 0]\] = \"[lindex $i 1]\"," -} -puts $fo "};" - -puts $fo "" -puts $fo "void" -puts $fo "vcl_output_lang_h(struct vsb *sb)" -puts $fo "{" - -copy_include ../../include/vcl.h -copy_include ../../include/vrt.h -copy_include ../../include/vrt_obj.h - -puts $fo "}" - -close $foh -close $fo - From phk at varnish-cache.org Tue Apr 27 15:19:41 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 17:19:41 +0200 Subject: r4735 - in trunk/varnish-cache: include lib/libvcl Message-ID: Author: phk Date: 2010-04-27 17:19:41 +0200 (Tue, 27 Apr 2010) New Revision: 4735 Modified: trunk/varnish-cache/include/vcl.h trunk/varnish-cache/include/vcl_returns.h trunk/varnish-cache/include/vrt.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_obj.c trunk/varnish-cache/lib/libvcl/vcc_token_defs.h Log: Update the generated files, now produced by a python script. Modified: trunk/varnish-cache/include/vcl.h =================================================================== --- trunk/varnish-cache/include/vcl.h 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/include/vcl.h 2010-04-27 15:19:41 UTC (rev 4735) @@ -1,3 +1,4 @@ + /* * $Id$ * @@ -3,5 +4,5 @@ * NB: This file is machine generated, DO NOT EDIT! * - * Edit and run vcc_gen_fixed_token.tcl instead + * Edit and run generate.py instead */ Modified: trunk/varnish-cache/include/vcl_returns.h =================================================================== --- trunk/varnish-cache/include/vcl_returns.h 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/include/vcl_returns.h 2010-04-27 15:19:41 UTC (rev 4735) @@ -1,3 +1,4 @@ + /* * $Id$ * @@ -3,5 +4,5 @@ * NB: This file is machine generated, DO NOT EDIT! * - * Edit and run vcc_gen_fixed_token.tcl instead + * Edit and run generate.py instead */ Modified: trunk/varnish-cache/include/vrt.h =================================================================== --- trunk/varnish-cache/include/vrt.h 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/include/vrt.h 2010-04-27 15:19:41 UTC (rev 4735) @@ -30,8 +30,7 @@ * * Runtime support for compiled VCL programs. * - * XXX: When this file is changed, lib/libvcl/vcc_gen_fixed_token.tcl - * XXX: *MUST* be rerun. + * XXX: When this file is changed, lib/libvcl/generate.py *MUST* be rerun. */ struct sess; Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-27 15:19:41 UTC (rev 4735) @@ -1,11 +1,13 @@ + /* - * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17:38:59Z tfheen $ + * $Id$ * * NB: This file is machine generated, DO NOT EDIT! * - * Edit and run vcc_gen_fixed_token.tcl instead + * Edit and run generate.py instead */ + #include "config.h" #include #include @@ -13,8 +15,8 @@ #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) +#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) @@ -22,8 +24,8 @@ switch (p[0]) { case '!': - M2('~', T_NOMATCH); M2('=', T_NEQ); + M2('~', T_NOMATCH); M1(); case '%': M1(); @@ -38,14 +40,14 @@ M2('=', T_MUL); M1(); case '+': - M2('=', T_INCR); M2('+', T_INC); + M2('=', T_INCR); M1(); case ',': M1(); case '-': - M2('=', T_DECR); M2('-', T_DEC); + M2('=', T_DECR); M1(); case '.': M1(); @@ -55,37 +57,37 @@ case ';': M1(); case '<': - M2('=', T_LEQ); M2('<', T_SHL); + M2('=', T_LEQ); M1(); case '=': M2('=', T_EQ); M1(); case '>': - M2('>', T_SHR); M2('=', T_GEQ); + M2('>', T_SHR); M1(); case 'e': - 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' && + 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] == 'i' && + p[4] == 'f' && !isvar(p[5])) { + *q = p + 5; + return (T_ELSIF); + } + 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); } @@ -117,14 +119,14 @@ ['-'] = "'-'", ['.'] = "'.'", ['/'] = "'/'", + [';'] = "';'", ['<'] = "'<'", ['='] = "'='", ['>'] = "'>'", ['{'] = "'{'", - ['}'] = "'}'", ['|'] = "'|'", + ['}'] = "'}'", ['~'] = "'~'", - [';'] = "';'", [CNUM] = "CNUM", [CSRC] = "CSRC", [CSTR] = "CSTR", @@ -159,231 +161,193 @@ /* ../../include/vcl.h */ - vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17"); - vsb_cat(sb, ":38:59Z tfheen $\n *\n * NB: This file is machine gen"); - vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe"); - vsb_cat(sb, "d_token.tcl 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, "\n/* VCL Methods */\n#define VCL_MET_RECV\t\t(1U << 0)"); - vsb_cat(sb, "\n#define VCL_MET_PIPE\t\t(1U << 1)\n"); - vsb_cat(sb, "#define VCL_MET_PASS\t\t(1U << 2)\n"); - vsb_cat(sb, "#define VCL_MET_HASH\t\t(1U << 3)\n"); - vsb_cat(sb, "#define VCL_MET_MISS\t\t(1U << 4)\n"); - vsb_cat(sb, "#define VCL_MET_HIT\t\t(1U << 5)\n"); - vsb_cat(sb, "#define VCL_MET_FETCH\t\t(1U << 6)\n"); - vsb_cat(sb, "#define VCL_MET_DELIVER\t\t(1U << 7)\n"); - vsb_cat(sb, "#define VCL_MET_ERROR\t\t(1U << 8)\n"); - vsb_cat(sb, "\n#define VCL_MET_MAX\t\t9\n\n/* VCL Returns */\n"); - vsb_cat(sb, "#define VCL_RET_DELIVER\t\t0\n#define VCL_RET_ERROR\t\t"); - vsb_cat(sb, "1\n#define VCL_RET_FETCH\t\t2\n"); - vsb_cat(sb, "#define VCL_RET_HASH\t\t3\n#define VCL_RET_LOOKUP\t\t4"); - vsb_cat(sb, "\n#define VCL_RET_PASS\t\t5\n#define VCL_RET_PIPE\t\t6"); - vsb_cat(sb, "\n#define VCL_RET_RESTART\t\t7\n"); - vsb_cat(sb, "\n#define VCL_RET_MAX\t\t8\n\nstruct VCL_conf {\n"); - vsb_cat(sb, "\tunsigned\tmagic;\n#define VCL_CONF_MAGIC\t0x7406c509"); - vsb_cat(sb, "\t/* from /dev/random */\n\n\tstruct director\t**direc"); - vsb_cat(sb, "tor;\n\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\tvcl_init_f\t*init_func;\n\tvcl_fini_f\t*fini_func;"); - vsb_cat(sb, "\n\n\tvcl_func_f\t*recv_func;\n"); - vsb_cat(sb, "\tvcl_func_f\t*pipe_func;\n\tvcl_func_f\t*pass_func;\n"); - vsb_cat(sb, "\tvcl_func_f\t*hash_func;\n\tvcl_func_f\t*miss_func;\n"); - vsb_cat(sb, "\tvcl_func_f\t*hit_func;\n\tvcl_func_f\t*fetch_func;\n"); - vsb_cat(sb, "\tvcl_func_f\t*deliver_func;\n\tvcl_func_f\t*error_fun"); - vsb_cat(sb, "c;\n};\n"); + vsb_cat(sb, "\n/*\n * $Id$\n *\n * NB: This file is machine " + "generated, DO NOT EDIT!\n *\n * Edit and run generate.py instead" + "\n */\n\nstruct sess;\nstruct cli;\n\ntypedef void vcl_init_f(st" + "ruct cli *);\ntypedef void vcl_fini_f(struct cli *);\n" + "typedef int vcl_func_f(struct sess *sp);\n\n/* VCL Methods " + "*/\n#define VCL_MET_RECV\t\t(1U << 0)\n#define VCL_MET_PIPE\t" + "\t(1U << 1)\n#define VCL_MET_PASS\t\t(1U << 2)\n#define VCL_MET_" + "HASH\t\t(1U << 3)\n#define VCL_MET_MISS\t\t(1U << 4)\n" + "#define VCL_MET_HIT\t\t(1U << 5)\n#define VCL_MET_FETCH\t\t" + "(1U << 6)\n#define VCL_MET_DELIVER\t\t(1U << 7)\n" + "#define VCL_MET_ERROR\t\t(1U << 8)\n\n#define VCL_MET_MAX\t" + "\t9\n\n/* VCL Returns */\n#define VCL_RET_DELIVER\t\t0\n" + "#define VCL_RET_ERROR\t\t1\n#define VCL_RET_FETCH\t\t2\n" + "#define VCL_RET_HASH\t\t3\n#define VCL_RET_LOOKUP\t\t4\n" + "#define VCL_RET_PASS\t\t5\n#define VCL_RET_PIPE\t\t6\n" + "#define VCL_RET_RESTART\t\t7\n\n#define VCL_RET_MAX\t\t8\n" + "\nstruct VCL_conf {\n\tunsigned\tmagic;\n#define VCL_CONF_MAGIC\t" + "0x7406c509\t/* from /dev/random */\n\n\tstruct director\t**direc" + "tor;\n\tunsigned\tndirector;\n\tstruct vrt_ref\t*ref;\n" + "\tunsigned\tnref;\n\tunsigned\tbusy;\n\tunsigned\tdiscard;\n" + "\n\tunsigned\tnsrc;\n\tconst char\t**srcname;\n\tconst char\t" + "**srcbody;\n\n\tvcl_init_f\t*init_func;\n\tvcl_fini_f\t*fini_fun" + "c;\n\n\tvcl_func_f\t*recv_func;\n\tvcl_func_f\t*pipe_func;\n" + "\tvcl_func_f\t*pass_func;\n\tvcl_func_f\t*hash_func;\n" + "\tvcl_func_f\t*miss_func;\n\tvcl_func_f\t*hit_func;\n" + "\tvcl_func_f\t*fetch_func;\n\tvcl_func_f\t*deliver_func;\n" + "\tvcl_func_f\t*error_func;\n};\n"); /* ../../include/vrt.h */ - vsb_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n"); - vsb_cat(sb, " * Copyright (c) 2006-2009 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"); - vsb_cat(sb, " * SUCH DAMAGE.\n *\n * $Id: vrt.h 4667 2010-04-16 09:"); - vsb_cat(sb, "58:02Z 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 const void * const vrt_magic_string_"); - vsb_cat(sb, "end;\n\nstruct vrt_backend_probe {\n"); - vsb_cat(sb, "\tconst char\t*url;\n\tconst char\t*request;\n"); - vsb_cat(sb, "\tdouble\t\ttimeout;\n\tdouble\t\tinterval;\n"); - vsb_cat(sb, "\tunsigned\texp_status;\n\tunsigned\twindow;\n"); - vsb_cat(sb, "\tunsigned\tthreshold;\n\tunsigned\tinitial;\n"); - vsb_cat(sb, "};\n\n/*\n * A backend is a host+port somewhere on the"); - vsb_cat(sb, " network\n */\nstruct vrt_backend {\n"); - vsb_cat(sb, "\tconst char\t\t\t*vcl_name;\n\tconst char\t\t\t*ident"); - vsb_cat(sb, ";\n\n\tconst char\t\t\t*hosthdr;\n"); - vsb_cat(sb, "\n\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, "\tdouble\t\t\t\tfirst_byte_timeout;\n"); - vsb_cat(sb, "\tdouble\t\t\t\tbetween_bytes_timeout;\n"); - vsb_cat(sb, "\tunsigned\t\t\tmax_connections;\n"); - vsb_cat(sb, "\tunsigned\t\t\tsaintmode_threshold;\n"); - vsb_cat(sb, "\tstruct vrt_backend_probe\tprobe;\n"); - vsb_cat(sb, "};\n\n/*\n * A director with an unpredictable reply\n"); - vsb_cat(sb, " */\n\nstruct vrt_dir_random_entry {\n"); - vsb_cat(sb, "\tint\t\t\t\t\thost;\n\tdouble\t\t\t\t\tweight;\n"); - vsb_cat(sb, "};\n\nstruct vrt_dir_random {\n"); - vsb_cat(sb, "\tconst char\t\t\t\t*name;\n\tunsigned\t\t\t\tretries;"); - vsb_cat(sb, "\n\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_r"); - vsb_cat(sb, "andom_entry\t*members;\n};\n\n/*\n"); - vsb_cat(sb, " * A director with round robin selection\n"); - vsb_cat(sb, " */\n\nstruct vrt_dir_round_robin_entry {\n"); - vsb_cat(sb, "\tint\t\t\t\t\thost;\n};\n\nstruct vrt_dir_round_robin"); - vsb_cat(sb, " {\n\tconst char\t\t\t\t*name;\n"); - vsb_cat(sb, "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_rou"); - vsb_cat(sb, "nd_robin_entry\t*members;\n};\n"); - vsb_cat(sb, "\n\n/*\n * other stuff.\n * XXX: document when bored\n"); - vsb_cat(sb, " */\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 *);\nvoid VRT_re_fini(void *);\n"); - vsb_cat(sb, "int VRT_re_match(const char *, void *re);\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 *, ...);\n"); - vsb_cat(sb, "void VRT_ban(struct sess *sp, char *, ...);\n"); - vsb_cat(sb, "void VRT_ban_string(struct sess *sp, const char *, ..."); - vsb_cat(sb, ");\nvoid VRT_purge(struct sess *sp, double ttl, double"); - vsb_cat(sb, " grace);\n\nvoid VRT_count(const struct sess *, unsign"); - vsb_cat(sb, "ed);\nint 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, HDR_BERESP };\nchar *VRT_GetHdr(const struct sess *"); - vsb_cat(sb, ", enum gethdr_e where, const char *);\n"); - vsb_cat(sb, "void VRT_SetHdr(const struct sess *, enum gethdr_e whe"); - vsb_cat(sb, "re, const char *,\n const char *, ...);\n"); - vsb_cat(sb, "void VRT_handling(struct sess *sp, unsigned hand);\n"); - vsb_cat(sb, "\n/* Simple stuff */\nint VRT_strcmp(const char *s1, c"); - vsb_cat(sb, "onst char *s2);\nvoid VRT_memmove(void *dst, const voi"); - vsb_cat(sb, "d *src, unsigned len);\n\nvoid VRT_ESI(struct sess *sp"); - vsb_cat(sb, ");\nvoid 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(struct cli "); - vsb_cat(sb, "*, struct director **, const char *name,\n"); - vsb_cat(sb, " int idx, const void *priv);\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);\nchar *VRT_time_string(const struct"); - vsb_cat(sb, " sess *sp, double);\nconst char *VRT_backend_string(st"); - vsb_cat(sb, "ruct 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"); + vsb_cat(sb, "/*-\n * Copyright (c) 2006 Verdens Gang AS\n" + " * Copyright (c) 2006-2009 Linpro AS\n * All rights reserved.\n" + " *\n * Author: Poul-Henning Kamp \n" + " *\n * Redistribution and use in source and binary forms, " + "with or without\n * modification, are permitted provided that " + "the following conditions\n * are met:\n * 1. Redistributions " + "of source code must retain the above copyright\n * notice, " + "this list of conditions and the following disclaimer.\n" + " * 2. Redistributions in binary form must reproduce the above " + "copyright\n * notice, this list of conditions and the followi" + "ng disclaimer in the\n * documentation and/or other materials" + " provided with the distribution.\n *\n * THIS SOFTWARE IS " + "PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n" + " * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED" + " TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS " + "FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT " + "SHALL AUTHOR OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, " + "INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n" + " * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF " + "SUBSTITUTE GOODS\n * OR SERVICES; LOSS OF USE, DATA, OR PROFITS;" + " OR BUSINESS INTERRUPTION)\n * HOWEVER CAUSED AND ON ANY THEORY " + "OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR " + "TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" + " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE " + "POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: vrt.h 4668 2010-04-" + "16 10:24:59Z phk $\n *\n * Runtime support for compiled VCL " + "programs.\n *\n * XXX: When this file is changed, lib/libvcl/gen" + "erate.py *MUST* be rerun.\n */\n\nstruct sess;\nstruct vsb;\n" + "struct cli;\nstruct director;\nstruct VCL_conf;\n" + "struct sockaddr;\n\n/*\n * A backend probe specification\n" + " */\n\nextern const void * const vrt_magic_string_end;\n" + "\nstruct vrt_backend_probe {\n\tconst char\t*url;\n" + "\tconst char\t*request;\n\tdouble\t\ttimeout;\n\tdouble\t\t" + "interval;\n\tunsigned\texp_status;\n\tunsigned\twindow;\n" + "\tunsigned\tthreshold;\n\tunsigned\tinitial;\n};\n" + "\n/*\n * A backend is a host+port somewhere on the network\n" + " */\nstruct vrt_backend {\n\tconst char\t\t\t*vcl_name;\n" + "\tconst char\t\t\t*ident;\n\n\tconst char\t\t\t*hosthdr;\n" + "\n\tconst unsigned char\t\t*ipv4_sockaddr;\n\tconst unsigned " + "char\t\t*ipv6_sockaddr;\n\n\tdouble\t\t\t\tconnect_timeout;\n" + "\tdouble\t\t\t\tfirst_byte_timeout;\n\tdouble\t\t\t\tbetween_byt" + "es_timeout;\n\tunsigned\t\t\tmax_connections;\n\tunsigned\t" + "\t\tsaintmode_threshold;\n\tstruct vrt_backend_probe\tprobe;\n" + "};\n\n/*\n * A director with an unpredictable reply\n" + " */\n\nstruct vrt_dir_random_entry {\n\tint\t\t\t\t\thost;\n" + "\tdouble\t\t\t\t\tweight;\n};\n\nstruct vrt_dir_random {\n" + "\tconst char\t\t\t\t*name;\n\tunsigned\t\t\t\tretries;\n" + "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_random_entry\t" + "*members;\n};\n\n/*\n * A director with round robin selection\n" + " */\n\nstruct vrt_dir_round_robin_entry {\n\tint\t\t\t\t\thost;\n" + "};\n\nstruct vrt_dir_round_robin {\n\tconst char\t\t\t\t*name;\n" + "\tunsigned\t\t\t\tnmember;\n\tconst struct vrt_dir_round_robin_e" + "ntry\t*members;\n};\n\n\n/*\n * other stuff.\n * XXX: document " + "when bored\n */\n\nstruct vrt_ref {\n\tunsigned\tsource;\n" + "\tunsigned\toffset;\n\tunsigned\tline;\n\tunsigned\tpos;\n" + "\tunsigned\tcount;\n\tconst char\t*token;\n};\n\n" + "/* ACL related */\n#define VRT_ACL_MAXADDR\t\t16\t/* max(IPv4, " + "IPv6) */\n\nvoid VRT_acl_log(const struct sess *, const char " + "*msg);\n\n/* Regexp related */\nvoid VRT_re_init(void **, " + "const char *);\nvoid VRT_re_fini(void *);\nint VRT_re_match(cons" + "t char *, void *re);\nconst char *VRT_regsub(const struct " + "sess *sp, int all, const char *,\n void *, const char *);\n" + "\nvoid VRT_panic(struct sess *sp, const char *, ...);\n" + "void VRT_ban(struct sess *sp, char *, ...);\nvoid VRT_ban_string" + "(struct sess *sp, const char *, ...);\nvoid VRT_purge(struct " + "sess *sp, double ttl, double grace);\n\nvoid VRT_count(const " + "struct sess *, unsigned);\nint VRT_rewrite(const char *, const " + "char *);\nvoid VRT_error(struct sess *, unsigned, const char " + "*);\nint VRT_switch_config(const char *);\n\nenum gethdr_e " + "{ HDR_REQ, HDR_RESP, HDR_OBJ, HDR_BEREQ, HDR_BERESP };\n" + "char *VRT_GetHdr(const struct sess *, enum gethdr_e where, " + "const char *);\nvoid VRT_SetHdr(const struct sess *, enum " + "gethdr_e where, const char *,\n const char *, ...);\n" + "void VRT_handling(struct sess *sp, unsigned hand);\n" + "\n/* Simple stuff */\nint VRT_strcmp(const char *s1, const " + "char *s2);\nvoid VRT_memmove(void *dst, const void *src, unsigne" + "d len);\n\nvoid VRT_ESI(struct sess *sp);\nvoid VRT_Rollback(str" + "uct sess *sp);\n\n/* Synthetic pages */\nvoid VRT_synth_page(str" + "uct sess *sp, unsigned flags, const char *, ...);\n" + "\n/* Backend related */\nvoid VRT_init_dir(struct cli *, struct " + "director **, const char *name,\n int idx, const void *priv);\n" + "void VRT_fini_dir(struct cli *, struct director *);\n" + "\nchar *VRT_IP_string(const struct sess *sp, const struct " + "sockaddr *sa);\nchar *VRT_int_string(const struct sess *sp, " + "int);\nchar *VRT_double_string(const struct sess *sp, double);\n" + "char *VRT_time_string(const struct sess *sp, double);\n" + "const char *VRT_backend_string(struct sess *sp);\n" + "\n#define VRT_done(sp, hand)\t\t\t\\\n\tdo {\t\t\t\t\t\\\n" + "\t\tVRT_handling(sp, hand);\t\t\\\n\t\treturn (1);\t\t\t\\\n" + "\t} while (0)\n"); /* ../../include/vrt_obj.h */ - vsb_cat(sb, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17"); - vsb_cat(sb, ":38:59Z tfheen $\n *\n * NB: This file is machine gen"); - vsb_cat(sb, "erated, DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixe"); - vsb_cat(sb, "d_token.tcl instead\n */\n\nstruct sockaddr * VRT_r_cl"); - vsb_cat(sb, "ient_ip(const struct sess *);\n"); - vsb_cat(sb, "struct sockaddr * VRT_r_server_ip(struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_server_hostname(struct sess *);\n"); - vsb_cat(sb, "const char * VRT_r_server_identity(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"); - 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, "unsigned VRT_r_req_esi(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_req_esi(struct sess *, unsigned);\n"); - vsb_cat(sb, "unsigned VRT_r_req_backend_healthy(const struct sess *"); - vsb_cat(sb, ");\nconst char * VRT_r_bereq_request(const struct sess"); - vsb_cat(sb, " *);\nvoid VRT_l_bereq_request(const struct sess *, co"); - vsb_cat(sb, "nst char *, ...);\nconst char * VRT_r_bereq_url(const "); - vsb_cat(sb, "struct sess *);\nvoid VRT_l_bereq_url(const struct ses"); - vsb_cat(sb, "s *, const char *, ...);\nconst char * VRT_r_bereq_pro"); - vsb_cat(sb, "to(const struct sess *);\nvoid VRT_l_bereq_proto(const"); - vsb_cat(sb, " struct sess *, const char *, ...);\n"); - vsb_cat(sb, "double VRT_r_bereq_connect_timeout(struct sess *);\n"); - vsb_cat(sb, "void VRT_l_bereq_connect_timeout(struct sess *, double"); - vsb_cat(sb, ");\ndouble VRT_r_bereq_first_byte_timeout(struct sess "); - vsb_cat(sb, "*);\nvoid VRT_l_bereq_first_byte_timeout(struct sess *"); - vsb_cat(sb, ", double);\ndouble VRT_r_bereq_between_bytes_timeout(s"); - vsb_cat(sb, "truct sess *);\nvoid VRT_l_bereq_between_bytes_timeout"); - vsb_cat(sb, "(struct sess *, double);\nconst char * VRT_r_beresp_pr"); - vsb_cat(sb, "oto(const struct sess *);\nvoid VRT_l_beresp_proto(con"); - vsb_cat(sb, "st struct sess *, const char *, ...);\n"); - vsb_cat(sb, "void VRT_l_beresp_saintmode(const struct sess *, doubl"); - vsb_cat(sb, "e);\nint VRT_r_beresp_status(const struct sess *);\n"); - vsb_cat(sb, "void VRT_l_beresp_status(const struct sess *, int);\n"); - vsb_cat(sb, "const char * VRT_r_beresp_response(const struct sess *"); - vsb_cat(sb, ");\nvoid VRT_l_beresp_response(const struct sess *, co"); - vsb_cat(sb, "nst char *, ...);\nunsigned VRT_r_beresp_cacheable(con"); - vsb_cat(sb, "st struct sess *);\nvoid VRT_l_beresp_cacheable(const "); - vsb_cat(sb, "struct sess *, unsigned);\ndouble VRT_r_beresp_ttl(con"); - vsb_cat(sb, "st struct sess *);\nvoid VRT_l_beresp_ttl(const struct"); - vsb_cat(sb, " sess *, double);\ndouble VRT_r_beresp_grace(const str"); - vsb_cat(sb, "uct sess *);\nvoid VRT_l_beresp_grace(const struct ses"); - vsb_cat(sb, "s *, double);\nconst char * VRT_r_obj_proto(const stru"); - vsb_cat(sb, "ct sess *);\nvoid VRT_l_obj_proto(const struct sess *,"); - vsb_cat(sb, " const char *, ...);\nint VRT_r_obj_status(const struc"); - vsb_cat(sb, "t sess *);\nvoid VRT_l_obj_status(const struct sess *,"); - vsb_cat(sb, " int);\nconst char * VRT_r_obj_response(const struct s"); - vsb_cat(sb, "ess *);\nvoid VRT_l_obj_response(const struct sess *, "); - vsb_cat(sb, "const char *, ...);\nint VRT_r_obj_hits(const struct s"); - vsb_cat(sb, "ess *);\nunsigned VRT_r_obj_cacheable(const struct ses"); - vsb_cat(sb, "s *);\nvoid VRT_l_obj_cacheable(const struct sess *, u"); - vsb_cat(sb, "nsigned);\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_lastuse(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, "/*\n * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 " + "17:38:59Z tfheen $\n *\n * NB: This file is machine generated, " + "DO NOT EDIT!\n *\n * Edit and run vcc_gen_fixed_token.tcl " + "instead\n */\n\nstruct sockaddr * VRT_r_client_ip(const struct " + "sess *);\nstruct sockaddr * VRT_r_server_ip(struct sess *);\n" + "const char * VRT_r_server_hostname(struct sess *);\n" + "const char * VRT_r_server_identity(struct sess *);\n" + "int VRT_r_server_port(struct sess *);\nconst char * VRT_r_req_re" + "quest(const struct sess *);\nvoid VRT_l_req_request(const " + "struct sess *, const char *, ...);\nconst char * VRT_r_req_url(c" + "onst struct sess *);\nvoid VRT_l_req_url(const struct sess " + "*, const char *, ...);\nconst char * VRT_r_req_proto(const " + "struct sess *);\nvoid VRT_l_req_proto(const struct sess *, " + "const char *, ...);\nvoid VRT_l_req_hash(struct sess *, const " + "char *);\nstruct director * VRT_r_req_backend(struct sess " + "*);\nvoid VRT_l_req_backend(struct sess *, struct director " + "*);\nint VRT_r_req_restarts(const struct sess *);\n" + "double VRT_r_req_grace(struct sess *);\nvoid VRT_l_req_grace(str" + "uct sess *, double);\nconst char * VRT_r_req_xid(struct sess " + "*);\nunsigned VRT_r_req_esi(struct sess *);\nvoid VRT_l_req_esi(" + "struct sess *, unsigned);\nunsigned VRT_r_req_backend_healthy(co" + "nst struct sess *);\nconst char * VRT_r_bereq_request(const " + "struct sess *);\nvoid VRT_l_bereq_request(const struct sess " + "*, const char *, ...);\nconst char * VRT_r_bereq_url(const " + "struct sess *);\nvoid VRT_l_bereq_url(const struct sess *, " + "const char *, ...);\nconst char * VRT_r_bereq_proto(const " + "struct sess *);\nvoid VRT_l_bereq_proto(const struct sess " + "*, const char *, ...);\ndouble VRT_r_bereq_connect_timeout(struc" + "t sess *);\nvoid VRT_l_bereq_connect_timeout(struct sess *, " + "double);\ndouble VRT_r_bereq_first_byte_timeout(struct sess " + "*);\nvoid VRT_l_bereq_first_byte_timeout(struct sess *, double);" + "\ndouble VRT_r_bereq_between_bytes_timeout(struct sess *);\n" + "void VRT_l_bereq_between_bytes_timeout(struct sess *, double);\n" + "const char * VRT_r_beresp_proto(const struct sess *);\n" + "void VRT_l_beresp_proto(const struct sess *, const char *, " + "...);\nvoid VRT_l_beresp_saintmode(const struct sess *, double);" + "\nint VRT_r_beresp_status(const struct sess *);\n" + "void VRT_l_beresp_status(const struct sess *, int);\n" + "const char * VRT_r_beresp_response(const struct sess *);\n" + "void VRT_l_beresp_response(const struct sess *, const char " + "*, ...);\nunsigned VRT_r_beresp_cacheable(const struct sess " + "*);\nvoid VRT_l_beresp_cacheable(const struct sess *, unsigned);" + "\ndouble VRT_r_beresp_ttl(const struct sess *);\n" + "void VRT_l_beresp_ttl(const struct sess *, double);\n" + "double VRT_r_beresp_grace(const struct sess *);\n" + "void VRT_l_beresp_grace(const struct sess *, double);\n" + "const char * VRT_r_obj_proto(const struct sess *);\n" + "void VRT_l_obj_proto(const struct sess *, const char *, ...);\n" + "int VRT_r_obj_status(const struct sess *);\nvoid VRT_l_obj_statu" + "s(const struct sess *, int);\nconst char * VRT_r_obj_response(co" + "nst struct sess *);\nvoid VRT_l_obj_response(const struct " + "sess *, const char *, ...);\nint VRT_r_obj_hits(const struct " + "sess *);\nunsigned VRT_r_obj_cacheable(const struct sess *);\n" + "void VRT_l_obj_cacheable(const struct sess *, unsigned);\n" + "double VRT_r_obj_ttl(const struct sess *);\nvoid VRT_l_obj_ttl(c" + "onst struct sess *, double);\ndouble VRT_r_obj_grace(const " + "struct sess *);\nvoid VRT_l_obj_grace(const struct sess *, " + "double);\ndouble VRT_r_obj_lastuse(const struct sess *);\n" + "const char * VRT_r_resp_proto(const struct sess *);\n" + "void VRT_l_resp_proto(const struct sess *, const char *, ...);\n" + "int VRT_r_resp_status(const struct sess *);\nvoid VRT_l_resp_sta" + "tus(const struct sess *, int);\nconst char * VRT_r_resp_response" + "(const struct sess *);\nvoid VRT_l_resp_response(const struct " + "sess *, const char *, ...);\ndouble VRT_r_now(const struct " + "sess *);\n"); + } Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-27 15:19:41 UTC (rev 4735) @@ -1,9 +1,10 @@ + /* - * $Id: vcc_gen_fixed_token.tcl 4428 2010-01-06 17:38:59Z tfheen $ + * $Id$ * * NB: This file is machine generated, DO NOT EDIT! * - * Edit and run vcc_gen_fixed_token.tcl instead + * Edit and run generate.py instead */ #include "config.h" Modified: trunk/varnish-cache/lib/libvcl/vcc_token_defs.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_token_defs.h 2010-04-27 15:18:19 UTC (rev 4734) +++ trunk/varnish-cache/lib/libvcl/vcc_token_defs.h 2010-04-27 15:19:41 UTC (rev 4735) @@ -1,3 +1,4 @@ + /* * $Id$ * @@ -3,31 +4,30 @@ * NB: This file is machine generated, DO NOT EDIT! * - * Edit and run vcc_gen_fixed_token.tcl instead + * Edit and run generate.py instead */ - -#define T_INCLUDE 128 -#define T_IF 129 -#define T_ELSE 130 -#define T_ELSEIF 131 -#define T_ELSIF 132 -#define T_INC 133 -#define T_DEC 134 -#define T_CAND 135 -#define T_COR 136 -#define T_LEQ 137 -#define T_EQ 138 -#define T_NEQ 139 -#define T_GEQ 140 -#define T_SHR 141 -#define T_SHL 142 -#define T_INCR 143 -#define T_DECR 144 -#define T_MUL 145 -#define T_DIV 146 -#define T_NOMATCH 147 -#define ID 148 -#define VAR 149 -#define CNUM 150 -#define CSTR 151 -#define EOI 152 -#define CSRC 153 +#define CNUM 128 +#define CSRC 129 +#define CSTR 130 +#define EOI 131 +#define ID 132 +#define T_CAND 133 +#define T_COR 134 +#define T_DEC 135 +#define T_DECR 136 +#define T_DIV 137 +#define T_ELSE 138 +#define T_ELSEIF 139 +#define T_ELSIF 140 +#define T_EQ 141 +#define T_GEQ 142 +#define T_IF 143 +#define T_INC 144 +#define T_INCLUDE 145 +#define T_INCR 146 +#define T_LEQ 147 +#define T_MUL 148 +#define T_NEQ 149 +#define T_NOMATCH 150 +#define T_SHL 151 +#define T_SHR 152 +#define VAR 153 From phk at varnish-cache.org Tue Apr 27 15:24:38 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Tue, 27 Apr 2010 17:24:38 +0200 Subject: r4736 - in trunk/varnish-cache: . lib/libvcl Message-ID: Author: phk Date: 2010-04-27 17:24:38 +0200 (Tue, 27 Apr 2010) New Revision: 4736 Modified: trunk/varnish-cache/configure.ac trunk/varnish-cache/lib/libvcl/Makefile.am Log: We can run the VCC generator script with python 2.5..3.2, look for anything that looks like that. Modified: trunk/varnish-cache/configure.ac =================================================================== --- trunk/varnish-cache/configure.ac 2010-04-27 15:19:41 UTC (rev 4735) +++ trunk/varnish-cache/configure.ac 2010-04-27 15:24:38 UTC (rev 4736) @@ -291,9 +291,9 @@ fi AM_MISSING_HAS_RUN -AC_CHECK_PROGS(PYTHON3, [python3 python3.1 python3.2], :) -if test "$PYTHON3" = :; then - PYTHON3="${am_missing_run}python3" +AC_CHECK_PROGS(PYTHON, [python python2 python2.5 python2.6 python3 python3.1 python3.2], :) +if test "$PYTHON" = :; then + PYTHON="${am_missing_run}python" fi # Solaris defines SO_{RCV,SND}TIMEO, but does not implement them. Modified: trunk/varnish-cache/lib/libvcl/Makefile.am =================================================================== --- trunk/varnish-cache/lib/libvcl/Makefile.am 2010-04-27 15:19:41 UTC (rev 4735) +++ trunk/varnish-cache/lib/libvcl/Makefile.am 2010-04-27 15:24:38 UTC (rev 4736) @@ -30,10 +30,10 @@ generate.py $(srcdir)/vcc_obj.c: $(srcdir)/generate.py - cd $(srcdir) && @PYTHON3@ generate.py || true + cd $(srcdir) && @PYTHON@ generate.py || true $(srcdir)/vcc_fixed_token.c: $(srcdir)/generate.py $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h - cd $(srcdir) && @PYTHON3@ generate.py || true + cd $(srcdir) && @PYTHON@ generate.py || true $(srcdir)/vcc_token_defs.h: $(srcdir)/generate.py $(top_srcdir)/include/vcl.h $(top_srcdir)/include/vrt.h $(top_srcdir)/include/vrt_obj.h - cd $(srcdir) && @PYTHON3@ generate.py || true + cd $(srcdir) && @PYTHON@ generate.py || true From phk at varnish-cache.org Wed Apr 28 08:23:53 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 10:23:53 +0200 Subject: r4737 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: Author: phk Date: 2010-04-28 10:23:52 +0200 (Wed, 28 Apr 2010) New Revision: 4737 Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc Log: Enable the ban_lurker by default Modified: trunk/varnish-cache/bin/varnishd/mgt_param.c =================================================================== --- trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-27 15:24:38 UTC (rev 4736) +++ trunk/varnish-cache/bin/varnishd/mgt_param.c 2010-04-28 08:23:52 UTC (rev 4737) @@ -805,7 +805,7 @@ " list. It always sleeps a second when nothing can be done.\n" "A value of zero disables the ban lurker.", 0, - "0.0", "s" }, + "0.1", "s" }, { "saintmode_threshold", tweak_uint, &master.saintmode_threshold, 0, UINT_MAX, "The maximum number of objects held off by saint mode before " Modified: trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc 2010-04-27 15:24:38 UTC (rev 4736) +++ trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc 2010-04-28 08:23:52 UTC (rev 4737) @@ -14,6 +14,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ -arg "-spersistent,${tmpdir}/_.per,10m" \ + -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start client c1 { From phk at varnish-cache.org Wed Apr 28 09:53:27 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 11:53:27 +0200 Subject: r4738 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-28 11:53:26 +0200 (Wed, 28 Apr 2010) New Revision: 4738 Modified: trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc Log: The ban lurker disturbs these test, so explicitly disable it. Modified: trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc 2010-04-28 08:23:52 UTC (rev 4737) +++ trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc 2010-04-28 09:53:26 UTC (rev 4738) @@ -12,6 +12,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x30000" \ -arg "-spersistent,${tmpdir}/_.per,10m" \ + -arg "-pban_lurker_sleep=0" \ -vcl+backend { sub vcl_fetch { set beresp.ttl = 3s; Modified: trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc 2010-04-28 08:23:52 UTC (rev 4737) +++ trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc 2010-04-28 09:53:26 UTC (rev 4738) @@ -14,6 +14,7 @@ varnish v1 \ -arg "-spersistent,${tmpdir}/_.per,10m" \ + -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start client c1 { From phk at varnish-cache.org Wed Apr 28 09:54:13 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 11:54:13 +0200 Subject: r4739 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-28 11:54:13 +0200 (Wed, 28 Apr 2010) New Revision: 4739 Modified: trunk/varnish-cache/lib/libvcl/generate.py Log: Split the bit map of allowed methods for variables into separate bitmaps for read and write. Modified: trunk/varnish-cache/lib/libvcl/generate.py =================================================================== --- trunk/varnish-cache/lib/libvcl/generate.py 2010-04-28 09:53:26 UTC (rev 4738) +++ trunk/varnish-cache/lib/libvcl/generate.py 2010-04-28 09:54:13 UTC (rev 4739) @@ -95,231 +95,277 @@ sp_variables = ( ('client.ip', - 'IP', 'RO', + 'IP', ( 'all',), + ( ), 'const struct sess *' ), ('server.ip', - 'IP', 'RO', + 'IP', ( 'all',), + ( ), 'struct sess *' ), ('server.hostname', - 'STRING', 'RO', + 'STRING', ( 'all',), + ( ), 'struct sess *' ), ('server.identity', - 'STRING', 'RO', + 'STRING', ( 'all',), + ( ), 'struct sess *' ), ('server.port', - 'INT', 'RO', + 'INT', ( 'all',), + ( ), 'struct sess *' ), ('req.request', - 'STRING', 'RW', + 'STRING', ( 'all',), + ( 'all',), 'const struct sess *' ), ('req.url', - 'STRING', 'RW', + 'STRING', ( 'all',), + ( 'all',), 'const struct sess *' ), ('req.proto', - 'STRING', 'RW', + 'STRING', ( 'all',), + ( 'all',), 'const struct sess *' ), ('req.http.', - 'HDR_REQ', 'RW', + 'HDR_REQ', ( 'all',), + ( 'all',), 'const struct sess *' ), ('req.hash', - 'HASH', 'WO', - ( 'hash', 'error',), + 'HASH', + ( ), + ( 'hash', 'error',), # XXX error ??? 'struct sess *' ), ('req.backend', - 'BACKEND', 'RW', + 'BACKEND', ( 'all',), + ( 'all',), 'struct sess *' ), ('req.restarts', - 'INT', 'RO', + 'INT', ( 'all',), + ( ), 'const struct sess *' ), ('req.grace', - 'RTIME', 'RW', + 'RTIME', ( 'all',), + ( 'all',), 'struct sess *' ), ('req.xid', - 'STRING', 'RO', + 'STRING', ( 'all',), + ( ), 'struct sess *' ), ('req.esi', - 'BOOL', 'RW', + 'BOOL', ( 'recv', 'fetch', 'deliver', 'error',), + ( 'recv', 'fetch', 'deliver', 'error',), 'struct sess *' ), ('req.backend.healthy', - 'BOOL', 'RO', + 'BOOL', ( 'all',), + ( ), 'const struct sess *' ), ('bereq.request', - 'STRING', 'RW', + 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), + ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.url', - 'STRING', 'RW', + 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), + ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.proto', - 'STRING', 'RW', + 'STRING', ( 'pipe', 'pass', 'miss', 'fetch',), + ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.http.', - 'HDR_BEREQ', 'RW', + 'HDR_BEREQ', ( 'pipe', 'pass', 'miss', 'fetch',), + ( 'pipe', 'pass', 'miss', 'fetch',), 'const struct sess *' ), ('bereq.connect_timeout', - 'RTIME', 'RW', + 'RTIME', ( 'pass', 'miss',), + ( 'pass', 'miss',), 'struct sess *' ), ('bereq.first_byte_timeout', - 'RTIME', 'RW', + 'RTIME', ( 'pass', 'miss',), + ( 'pass', 'miss',), 'struct sess *' ), ('bereq.between_bytes_timeout', - 'RTIME', 'RW', + 'RTIME', ( 'pass', 'miss',), + ( 'pass', 'miss',), 'struct sess *' ), ('beresp.proto', - 'STRING', 'RW', + 'STRING', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.saintmode', - 'RTIME', 'WO', + 'RTIME', + ( ), ( 'fetch',), 'const struct sess *' ), ('beresp.status', - 'INT', 'RW', + 'INT', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.response', - 'STRING', 'RW', + 'STRING', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.http.', - 'HDR_BERESP', 'RW', + 'HDR_BERESP', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.cacheable', - 'BOOL', 'RW', + 'BOOL', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.ttl', - 'RTIME', 'RW', + 'RTIME', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('beresp.grace', - 'RTIME', 'RW', + 'RTIME', ( 'fetch',), + ( 'fetch',), 'const struct sess *' ), ('obj.proto', - 'STRING', 'RW', + 'STRING', ( 'hit', 'error',), + ( 'hit', 'error',), 'const struct sess *' ), ('obj.status', - 'INT', 'RW', + 'INT', ( 'error',), + ( 'error',), 'const struct sess *' ), ('obj.response', - 'STRING', 'RW', + 'STRING', ( 'error',), + ( 'error',), 'const struct sess *' ), ('obj.hits', - 'INT', 'RO', + 'INT', ( 'hit', 'deliver',), + ( ), 'const struct sess *' ), ('obj.http.', - 'HDR_OBJ', 'RW', + 'HDR_OBJ', ( 'hit', 'error',), + ( 'error',), # XXX ? 'const struct sess *' ), ('obj.cacheable', - 'BOOL', 'RW', + 'BOOL', ( 'hit',), + ( 'hit',), 'const struct sess *' ), ('obj.ttl', - 'RTIME', 'RW', + 'RTIME', ( 'hit', 'error',), + ( 'hit', 'error',), 'const struct sess *' ), ('obj.grace', - 'RTIME', 'RW', + 'RTIME', ( 'hit', 'error',), + ( 'hit', 'error',), 'const struct sess *' ), ('obj.lastuse', - 'RTIME', 'RO', + 'RTIME', ( 'hit', 'deliver', 'error',), + ( ), 'const struct sess *' ), ('resp.proto', - 'STRING', 'RW', + 'STRING', ( 'deliver',), + ( 'deliver',), 'const struct sess *' ), ('resp.status', - 'INT', 'RW', + 'INT', ( 'deliver',), + ( 'deliver',), 'const struct sess *' ), ('resp.response', - 'STRING', 'RW', + 'STRING', ( 'deliver',), + ( 'deliver',), 'const struct sess *' ), ('resp.http.', - 'HDR_RESP', 'RW', + 'HDR_RESP', ( 'deliver',), + ( 'deliver',), 'const struct sess *' ), ('now', - 'TIME', 'RO', + 'TIME', ( 'all',), + ( ), 'const struct sess *' ), ) + ####################################################################### # VCL to C type conversion @@ -656,6 +702,29 @@ ####################################################################### +def restrict(fo, spec): + print("RX: ", spec) + if len(spec) == 0: + fo.write("\t 0,\n") + return + if spec[0] == 'all': + spec = vcls + p = "" + n = 0 + for j in spec: + if n == 4: + fo.write("\n") + n = 0 + if n == 0: + fo.write("\t ") + n += 1 + fo.write(p + "VCL_MET_" + j.upper()) + p = " | " + + fo.write(",\n") + +####################################################################### + fo=open("vcc_obj.c", "w") file_header(fo) @@ -668,40 +737,28 @@ """) for i in sp_variables: + print(i) typ = i[1] if typ[:4] == "HDR_": typ = "HEADER" fo.write("\t{ \"%s\", %s, %d,\n" % (i[0], typ, len(i[0]))) - if i[2] == "RO" or i[2] == "RW": + + if len(i[2]) > 0: fo.write('\t "VRT_r_%s(sp)",\n' % i[0].replace(".", "_")) else: - fo.write('\t NULL,\n') - if i[2] == "WO" or i[2] == "RW": + fo.write('\t NULL,\t/* No reads allowed */\n') + restrict(fo, i[2]) + + if len(i[3]) > 0: fo.write('\t "VRT_l_%s(sp, ",\n' % i[0].replace(".", "_")) else: - fo.write('\t NULL,\n') - fo.write('\t V_%s,' % i[2]) + fo.write('\t NULL,\t/* No writes allowed */\n') + restrict(fo, i[3]) + if typ == "HEADER": fo.write('\t "%s",\n' % i[1]) else: fo.write('\t 0,\n') # XXX: shoule be NULL - x = i[3] - if x[0] == 'all': - x = vcls - p = "" - n = 0 - for j in x: - if n == 0: - fo.write("\t ") - n += 1 - fo.write(p + "VCL_MET_" + j.upper()) - p = " | " - if n == 4: - fo.write("\n") - n = 0 - - if n > 0: - fo.write("\n") fo.write("\t},\n") fo.write("\t{ NULL }\n};\n") From phk at varnish-cache.org Wed Apr 28 09:54:52 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 11:54:52 +0200 Subject: r4740 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-28 11:54:52 +0200 (Wed, 28 Apr 2010) New Revision: 4740 Modified: trunk/varnish-cache/lib/libvcl/generate.py Log: Remove debug printouts Modified: trunk/varnish-cache/lib/libvcl/generate.py =================================================================== --- trunk/varnish-cache/lib/libvcl/generate.py 2010-04-28 09:54:13 UTC (rev 4739) +++ trunk/varnish-cache/lib/libvcl/generate.py 2010-04-28 09:54:52 UTC (rev 4740) @@ -703,7 +703,6 @@ ####################################################################### def restrict(fo, spec): - print("RX: ", spec) if len(spec) == 0: fo.write("\t 0,\n") return @@ -737,7 +736,6 @@ """) for i in sp_variables: - print(i) typ = i[1] if typ[:4] == "HDR_": typ = "HEADER" From phk at varnish-cache.org Wed Apr 28 09:55:47 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 11:55:47 +0200 Subject: r4741 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-28 11:55:47 +0200 (Wed, 28 Apr 2010) New Revision: 4741 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_compile.h trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c trunk/varnish-cache/lib/libvcl/vcc_obj.c trunk/varnish-cache/lib/libvcl/vcc_parse.c trunk/varnish-cache/lib/libvcl/vcc_string.c trunk/varnish-cache/lib/libvcl/vcc_var.c trunk/varnish-cache/lib/libvcl/vcc_xref.c Log: Implement distinct read/write access control for variables. Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -69,7 +69,7 @@ vcc_NextToken(tl); if (tl->t->tok == VAR) { - vp = vcc_FindVar(tl, tl->t, vcc_vars); + vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); ERRCHK(tl); assert(vp != NULL); if (vp->fmt == INT) { @@ -112,16 +112,6 @@ } static void -check_writebit(struct tokenlist *tl, const struct var *vp) -{ - - if (vp->access == V_RW || vp->access == V_WO) - return; - vsb_printf(tl->sb, "Variable %.*s cannot be modified.\n", PF(tl->t)); - vcc_ErrWhere(tl, tl->t); -} - -static void parse_set(struct tokenlist *tl) { struct var *vp; @@ -130,11 +120,9 @@ vcc_NextToken(tl); ExpectErr(tl, VAR); vt = tl->t; - vp = vcc_FindVar(tl, tl->t, vcc_vars); + vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "set"); ERRCHK(tl); assert(vp != NULL); - check_writebit(tl, vp); - ERRCHK(tl); Fb(tl, 1, "%s", vp->lname); vcc_NextToken(tl); switch (vp->fmt) { @@ -262,15 +250,15 @@ vcc_NextToken(tl); ExpectErr(tl, VAR); - vp = vcc_FindVar(tl, tl->t, vcc_vars); + vp = vcc_FindVar(tl, tl->t, vcc_vars, 1, "unset"); ERRCHK(tl); assert(vp != NULL); if (vp->fmt != STRING || vp->hdr == NULL) { - vsb_printf(tl->sb, "Only http header lines can be unset.\n"); + vsb_printf(tl->sb, + "Only http header variables can be unset.\n"); vcc_ErrWhere(tl, tl->t); return; } - check_writebit(tl, vp); ERRCHK(tl); Fb(tl, 1, "%s0);\n", vp->lname); vcc_NextToken(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_compile.h =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_compile.h 2010-04-28 09:55:47 UTC (rev 4741) @@ -109,12 +109,6 @@ HEADER }; -enum var_access { - V_RO, - V_RW, - V_WO -}; - enum ref_type { R_FUNC, R_ACL, @@ -134,10 +128,10 @@ enum var_type fmt; unsigned len; const char *rname; + unsigned r_methods; const char *lname; - enum var_access access; + unsigned l_methods; const char *hdr; - unsigned methods; }; struct method { @@ -225,7 +219,7 @@ /* vcc_var.c */ struct var *vcc_FindVar(struct tokenlist *tl, const struct token *t, - struct var *vl); + struct var *vl, int wr_access, const char *use); void vcc_VarVal(struct tokenlist *tl, const struct var *vp, const struct token *vt); @@ -238,7 +232,8 @@ struct proc *vcc_AddProc(struct tokenlist *tl, struct token *t); void vcc_ProcAction(struct proc *p, unsigned action, struct token *t); int vcc_CheckAction(struct tokenlist *tl); -void vcc_AddUses(struct tokenlist *tl, struct var *v); +void vcc_AddUses(struct tokenlist *tl, const struct token *t, unsigned mask, + const char *use); int vcc_CheckUses(struct tokenlist *tl); #define ERRCHK(tl) do { if ((tl)->err) return; } while (0) Modified: trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_fixed_token.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -215,8 +215,8 @@ "OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR " "TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n" " * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE " - "POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: vrt.h 4668 2010-04-" - "16 10:24:59Z phk $\n *\n * Runtime support for compiled VCL " + "POSSIBILITY OF\n * SUCH DAMAGE.\n *\n * $Id: vrt.h 4735 2010-04-" + "27 15:19:41Z phk $\n *\n * Runtime support for compiled VCL " "programs.\n *\n * XXX: When this file is changed, lib/libvcl/gen" "erate.py *MUST* be rerun.\n */\n\nstruct sess;\nstruct vsb;\n" "struct cli;\nstruct director;\nstruct VCL_conf;\n" Modified: trunk/varnish-cache/lib/libvcl/vcc_obj.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_obj.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -14,303 +14,360 @@ 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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "server.hostname", STRING, 15, "VRT_r_server_hostname(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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "server.identity", STRING, 15, "VRT_r_server_identity(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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "req.request", STRING, 11, "VRT_r_req_request(sp)", + 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_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_DELIVER - | VCL_MET_ERROR + | VCL_MET_ERROR, + 0, }, { "req.url", STRING, 7, "VRT_r_req_url(sp)", + 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_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_DELIVER - | VCL_MET_ERROR + | VCL_MET_ERROR, + 0, }, { "req.proto", STRING, 9, "VRT_r_req_proto(sp)", + 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_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_DELIVER - | VCL_MET_ERROR + | VCL_MET_ERROR, + 0, }, { "req.http.", HEADER, 9, "VRT_r_req_http_(sp)", + 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_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_DELIVER - | VCL_MET_ERROR + | VCL_MET_ERROR, + "HDR_REQ", }, { "req.hash", HASH, 8, - NULL, + NULL, /* No reads allowed */ + 0, "VRT_l_req_hash(sp, ", - V_WO, 0, - VCL_MET_HASH | VCL_MET_ERROR + VCL_MET_HASH | VCL_MET_ERROR, + 0, }, { "req.backend", BACKEND, 11, "VRT_r_req_backend(sp)", + 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_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_DELIVER - | VCL_MET_ERROR + | VCL_MET_ERROR, + 0, }, { "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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "req.grace", RTIME, 9, "VRT_r_req_grace(sp)", + 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_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 + | VCL_MET_ERROR, + 0, }, { "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 + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "req.esi", BOOL, 7, "VRT_r_req_esi(sp)", + VCL_MET_RECV | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, "VRT_l_req_esi(sp, ", - V_RW, 0, - VCL_MET_RECV | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR + VCL_MET_RECV | VCL_MET_FETCH | VCL_MET_DELIVER | VCL_MET_ERROR, + 0, }, { "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_ERROR + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "bereq.request", STRING, 13, "VRT_r_bereq_request(sp)", + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_request(sp, ", - V_RW, 0, - VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, + 0, }, { "bereq.url", STRING, 9, "VRT_r_bereq_url(sp)", + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_url(sp, ", - V_RW, 0, - VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, + 0, }, { "bereq.proto", STRING, 11, "VRT_r_bereq_proto(sp)", + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_proto(sp, ", - V_RW, 0, - VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, + 0, }, { "bereq.http.", HEADER, 11, "VRT_r_bereq_http_(sp)", + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, "VRT_l_bereq_http_(sp, ", - V_RW, "HDR_BEREQ", - VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH + VCL_MET_PIPE | VCL_MET_PASS | VCL_MET_MISS | VCL_MET_FETCH, + "HDR_BEREQ", }, { "bereq.connect_timeout", RTIME, 21, "VRT_r_bereq_connect_timeout(sp)", + VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_connect_timeout(sp, ", - V_RW, 0, - VCL_MET_PASS | VCL_MET_MISS + VCL_MET_PASS | VCL_MET_MISS, + 0, }, { "bereq.first_byte_timeout", RTIME, 24, "VRT_r_bereq_first_byte_timeout(sp)", + VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_first_byte_timeout(sp, ", - V_RW, 0, - VCL_MET_PASS | VCL_MET_MISS + VCL_MET_PASS | VCL_MET_MISS, + 0, }, { "bereq.between_bytes_timeout", RTIME, 27, "VRT_r_bereq_between_bytes_timeout(sp)", + VCL_MET_PASS | VCL_MET_MISS, "VRT_l_bereq_between_bytes_timeout(sp, ", - V_RW, 0, - VCL_MET_PASS | VCL_MET_MISS + VCL_MET_PASS | VCL_MET_MISS, + 0, }, { "beresp.proto", STRING, 12, "VRT_r_beresp_proto(sp)", + VCL_MET_FETCH, "VRT_l_beresp_proto(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.saintmode", RTIME, 16, - NULL, + NULL, /* No reads allowed */ + 0, "VRT_l_beresp_saintmode(sp, ", - V_WO, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.status", INT, 13, "VRT_r_beresp_status(sp)", + VCL_MET_FETCH, "VRT_l_beresp_status(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.response", STRING, 15, "VRT_r_beresp_response(sp)", + VCL_MET_FETCH, "VRT_l_beresp_response(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.http.", HEADER, 12, "VRT_r_beresp_http_(sp)", + VCL_MET_FETCH, "VRT_l_beresp_http_(sp, ", - V_RW, "HDR_BERESP", - VCL_MET_FETCH + VCL_MET_FETCH, + "HDR_BERESP", }, { "beresp.cacheable", BOOL, 16, "VRT_r_beresp_cacheable(sp)", + VCL_MET_FETCH, "VRT_l_beresp_cacheable(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.ttl", RTIME, 10, "VRT_r_beresp_ttl(sp)", + VCL_MET_FETCH, "VRT_l_beresp_ttl(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "beresp.grace", RTIME, 12, "VRT_r_beresp_grace(sp)", + VCL_MET_FETCH, "VRT_l_beresp_grace(sp, ", - V_RW, 0, - VCL_MET_FETCH + VCL_MET_FETCH, + 0, }, { "obj.proto", STRING, 9, "VRT_r_obj_proto(sp)", + VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_proto(sp, ", - V_RW, 0, - VCL_MET_HIT | VCL_MET_ERROR + VCL_MET_HIT | VCL_MET_ERROR, + 0, }, { "obj.status", INT, 10, "VRT_r_obj_status(sp)", + VCL_MET_ERROR, "VRT_l_obj_status(sp, ", - V_RW, 0, - VCL_MET_ERROR + VCL_MET_ERROR, + 0, }, { "obj.response", STRING, 12, "VRT_r_obj_response(sp)", + VCL_MET_ERROR, "VRT_l_obj_response(sp, ", - V_RW, 0, - VCL_MET_ERROR + VCL_MET_ERROR, + 0, }, { "obj.hits", INT, 8, "VRT_r_obj_hits(sp)", - NULL, - V_RO, 0, - VCL_MET_HIT | VCL_MET_DELIVER + VCL_MET_HIT | VCL_MET_DELIVER, + NULL, /* No writes allowed */ + 0, + 0, }, { "obj.http.", HEADER, 9, "VRT_r_obj_http_(sp)", + VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_http_(sp, ", - V_RW, "HDR_OBJ", - VCL_MET_HIT | VCL_MET_ERROR + VCL_MET_ERROR, + "HDR_OBJ", }, { "obj.cacheable", BOOL, 13, "VRT_r_obj_cacheable(sp)", + VCL_MET_HIT, "VRT_l_obj_cacheable(sp, ", - V_RW, 0, - VCL_MET_HIT + VCL_MET_HIT, + 0, }, { "obj.ttl", RTIME, 7, "VRT_r_obj_ttl(sp)", + VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_ttl(sp, ", - V_RW, 0, - VCL_MET_HIT | VCL_MET_ERROR + VCL_MET_HIT | VCL_MET_ERROR, + 0, }, { "obj.grace", RTIME, 9, "VRT_r_obj_grace(sp)", + VCL_MET_HIT | VCL_MET_ERROR, "VRT_l_obj_grace(sp, ", - V_RW, 0, - VCL_MET_HIT | VCL_MET_ERROR + VCL_MET_HIT | VCL_MET_ERROR, + 0, }, { "obj.lastuse", RTIME, 11, "VRT_r_obj_lastuse(sp)", - NULL, - V_RO, 0, - VCL_MET_HIT | VCL_MET_DELIVER | VCL_MET_ERROR + VCL_MET_HIT | VCL_MET_DELIVER | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { "resp.proto", STRING, 10, "VRT_r_resp_proto(sp)", + VCL_MET_DELIVER, "VRT_l_resp_proto(sp, ", - V_RW, 0, - VCL_MET_DELIVER + VCL_MET_DELIVER, + 0, }, { "resp.status", INT, 11, "VRT_r_resp_status(sp)", + VCL_MET_DELIVER, "VRT_l_resp_status(sp, ", - V_RW, 0, - VCL_MET_DELIVER + VCL_MET_DELIVER, + 0, }, { "resp.response", STRING, 13, "VRT_r_resp_response(sp)", + VCL_MET_DELIVER, "VRT_l_resp_response(sp, ", - V_RW, 0, - VCL_MET_DELIVER + VCL_MET_DELIVER, + 0, }, { "resp.http.", HEADER, 10, "VRT_r_resp_http_(sp)", + VCL_MET_DELIVER, "VRT_l_resp_http_(sp, ", - V_RW, "HDR_RESP", - VCL_MET_DELIVER + VCL_MET_DELIVER, + "HDR_RESP", }, { "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_ERROR + | VCL_MET_ERROR, + NULL, /* No writes allowed */ + 0, + 0, }, { NULL } }; Modified: trunk/varnish-cache/lib/libvcl/vcc_parse.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_parse.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -333,7 +333,7 @@ vcc_Cond_0(tl); SkipToken(tl, ')'); } else if (tl->t->tok == VAR) { - vp = vcc_FindVar(tl, tl->t, vcc_vars); + vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); ERRCHK(tl); assert(vp != NULL); vcc_NextToken(tl); Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_string.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_string.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -154,7 +154,7 @@ if (tl->t->tok == ID && vcc_IdIs(tl->t, "regsuball")) return (vcc_regsub(tl, 1)); if (tl->t->tok == VAR) { - vp = vcc_FindVar(tl, tl->t, vcc_vars); + vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read"); if (tl->err) return (0); assert(vp != NULL); Modified: trunk/varnish-cache/lib/libvcl/vcc_var.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_var.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -61,10 +61,10 @@ memcpy(p, t->b, i); p[i] = '\0'; v->name = p; - v->access = V_RW; + v->r_methods = vh->r_methods; + v->l_methods = vh->l_methods; v->fmt = STRING; v->hdr = vh->hdr; - v->methods = vh->methods; l = strlen(v->name + vh->len) + 1; bprintf(buf, "VRT_GetHdr(sp, %s, \"\\%03o%s:\")", @@ -87,7 +87,8 @@ /*--------------------------------------------------------------------*/ struct var * -vcc_FindVar(struct tokenlist *tl, const struct token *t, struct var *vl) +vcc_FindVar(struct tokenlist *tl, const struct token *t, struct var *vl, + int wr_access, const char *use) { struct var *v; @@ -98,7 +99,25 @@ continue; if (memcmp(t->b, v->name, v->len)) continue; - vcc_AddUses(tl, v); + if (wr_access && v->l_methods == 0) { + vsb_printf(tl->sb, "Variable "); + vcc_ErrToken(tl, t); + vsb_printf(tl->sb, " is read only."); + vsb_cat(tl->sb, "\nAt: "); + vcc_ErrWhere(tl, t); + return (NULL); + } else if (wr_access) { + vcc_AddUses(tl, t, v->l_methods, use); + } else if (v->r_methods == 0) { + vsb_printf(tl->sb, "Variable "); + vcc_ErrToken(tl, t); + vsb_printf(tl->sb, " is write only."); + vsb_cat(tl->sb, "\nAt: "); + vcc_ErrWhere(tl, t); + return (NULL); + } else { + vcc_AddUses(tl, t, v->r_methods, use); + } if (v->fmt != HEADER) return (v); return (HeaderVar(tl, t, v)); Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_xref.c 2010-04-28 09:54:52 UTC (rev 4740) +++ trunk/varnish-cache/lib/libvcl/vcc_xref.c 2010-04-28 09:55:47 UTC (rev 4741) @@ -61,7 +61,8 @@ struct procuse { VTAILQ_ENTRY(procuse) list; struct token *t; - struct var *v; + unsigned mask; + const char *use; }; struct proc { @@ -212,16 +213,19 @@ } void -vcc_AddUses(struct tokenlist *tl, struct var *v) +vcc_AddUses(struct tokenlist *tl, const struct token *t, unsigned mask, + const char *use) { struct procuse *pu; + (void)t; if (tl->curproc == NULL) /* backend */ return; pu = TlAlloc(tl, sizeof *pu); assert(pu != NULL); - pu->v = v; pu->t = tl->t; + pu->mask = mask; + pu->use = use; VTAILQ_INSERT_TAIL(&tl->curproc->uses, pu, list); } @@ -339,7 +343,7 @@ struct procuse *pu; VTAILQ_FOREACH(pu, &p->uses, list) - if (!(pu->v->methods & m->bitval)) + if (!(pu->mask & m->bitval)) return (pu); return (NULL); } @@ -389,8 +393,8 @@ pu = vcc_FindIllegalUse(p, m); if (pu != NULL) { vsb_printf(tl->sb, - "Variable '%.*s' not accessible in method '%.*s'.", - PF(pu->t), PF(p->name)); + "Variable '%.*s': %s not allowed in method '%.*s'.", + PF(pu->t), pu->use, PF(p->name)); vsb_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, pu->t); return (1); From phk at varnish-cache.org Wed Apr 28 11:04:53 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 13:04:53 +0200 Subject: r4742 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-28 13:04:53 +0200 (Wed, 28 Apr 2010) New Revision: 4742 Modified: trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc Log: I guess none of the p* tests really like the ban-lurker. Modified: trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc 2010-04-28 09:55:47 UTC (rev 4741) +++ trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc 2010-04-28 11:04:53 UTC (rev 4742) @@ -12,6 +12,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ -arg "-spersistent,${tmpdir}/_.per,10m" \ + -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start varnish v1 -cliok purge.list From phk at varnish-cache.org Wed Apr 28 11:05:44 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 13:05:44 +0200 Subject: r4743 - trunk/varnish-cache/lib/libvcl Message-ID: Author: phk Date: 2010-04-28 13:05:43 +0200 (Wed, 28 Apr 2010) New Revision: 4743 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c trunk/varnish-cache/lib/libvcl/vcc_xref.c Log: Restrict the "esi" action to vcl_fetch{} now that we have the VCC infrastructure to do so. Fixes: #638 Modified: trunk/varnish-cache/lib/libvcl/vcc_action.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-28 11:04:53 UTC (rev 4742) +++ trunk/varnish-cache/lib/libvcl/vcc_action.c 2010-04-28 11:05:43 UTC (rev 4743) @@ -482,6 +482,7 @@ static struct action_table { const char *name; action_f *func; + unsigned bitmask; } action_table[] = { { "error", parse_error }, @@ -492,7 +493,7 @@ /* Keep list sorted from here */ { "call", parse_call }, - { "esi", parse_esi }, + { "esi", parse_esi, VCL_MET_FETCH }, { "panic", parse_panic }, { "purge", parse_purge }, { "purge_url", parse_purge_url }, @@ -515,6 +516,8 @@ assert (at->tok == ID); for(atp = action_table; atp->name != NULL; atp++) { if (vcc_IdIs(at, atp->name)) { + if (atp->bitmask != 0) + vcc_AddUses(tl, at, atp->bitmask, "is"); atp->func(tl); return(1); } Modified: trunk/varnish-cache/lib/libvcl/vcc_xref.c =================================================================== --- trunk/varnish-cache/lib/libvcl/vcc_xref.c 2010-04-28 11:04:53 UTC (rev 4742) +++ trunk/varnish-cache/lib/libvcl/vcc_xref.c 2010-04-28 11:05:43 UTC (rev 4743) @@ -358,8 +358,8 @@ pu = vcc_FindIllegalUse(p, m); if (pu != NULL) { vsb_printf(tl->sb, - "Variable \"%.*s\" is not available in %s\n", - PF(pu->t), m->name); + "'%.*s': %s not possible in method '%.*s'.\n", + PF(pu->t), pu->use, PF(p->name)); vcc_ErrWhere(tl, pu->t); vsb_printf(tl->sb, "\n...in function \"%.*s\"\n", PF(p->name)); @@ -393,7 +393,7 @@ pu = vcc_FindIllegalUse(p, m); if (pu != NULL) { vsb_printf(tl->sb, - "Variable '%.*s': %s not allowed in method '%.*s'.", + "'%.*s': %s not possible in method '%.*s'.", PF(pu->t), pu->use, PF(p->name)); vsb_cat(tl->sb, "\nAt: "); vcc_ErrWhere(tl, pu->t); From phk at varnish-cache.org Wed Apr 28 12:08:04 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 14:08:04 +0200 Subject: r4744 - trunk/varnish-cache/bin/varnishtest Message-ID: Author: phk Date: 2010-04-28 14:08:04 +0200 (Wed, 28 Apr 2010) New Revision: 4744 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c Log: Update the "vtc_thread" for each test we run so that error exits work as expected. Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-28 11:05:43 UTC (rev 4743) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-28 12:08:04 UTC (rev 4744) @@ -504,6 +504,7 @@ pe = priv; + vtc_thread = pthread_self(); parse_string(pe->buf, cmds, NULL, vltop); old_err = vtc_error; vtc_stop = 1; @@ -544,6 +545,7 @@ AZ(pthread_mutex_lock(&vtc_mtx)); AZ(pthread_create(&pt, NULL, exec_file_thread, &pe)); i = pthread_cond_timedwait(&vtc_cond, &vtc_mtx, &ts); + vtc_thread = NULL; if (i == 0) { AZ(pthread_mutex_unlock(&vtc_mtx)); @@ -649,7 +651,6 @@ AN(vtc_tmpdir); AZ(mkdir(vtc_tmpdir, 0700)); macro_def(vltop, NULL, "tmpdir", vtc_tmpdir); - vtc_thread = pthread_self(); AZ(pthread_mutex_init(&vtc_mtx, NULL)); AZ(pthread_cond_init(&vtc_cond, NULL)); From phk at varnish-cache.org Wed Apr 28 12:26:03 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 14:26:03 +0200 Subject: r4745 - trunk/varnish-cache/bin/varnishtest Message-ID: Author: phk Date: 2010-04-28 14:26:03 +0200 (Wed, 28 Apr 2010) New Revision: 4745 Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c Log: Return on error, we are in the vtc_thread Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-04-28 12:08:04 UTC (rev 4744) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-04-28 12:26:03 UTC (rev 4745) @@ -509,10 +509,12 @@ AZ(vsb_overflowed(vsb)); u = varnish_ask_cli(v, vsb_data(vsb), NULL); - if (u != expect) + if (u != expect) { vtc_log(v->vl, 0, "VCL compilation got %u expected %u", u, expect); + return; + } if (u == CLIS_OK) { vsb_clear(vsb); vsb_printf(vsb, "vcl.use vcl%d", v->vcl_nbr); From phk at varnish-cache.org Wed Apr 28 12:26:17 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Wed, 28 Apr 2010 14:26:17 +0200 Subject: r4746 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-28 14:26:17 +0200 (Wed, 28 Apr 2010) New Revision: 4746 Modified: trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc Log: More xref coverage testing Modified: trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc 2010-04-28 12:26:03 UTC (rev 4745) +++ trunk/varnish-cache/bin/varnishtest/tests/v00021.vtc 2010-04-28 12:26:17 UTC (rev 4746) @@ -50,3 +50,22 @@ } +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub foo { + } +} + + +varnish v1 -badvcl { + backend b { .host = "127.0.0.1"; } + + sub vcl_recv { + call foo; + } + + sub foo { + return (deliver); + } +} From phk at varnish-cache.org Thu Apr 29 08:52:22 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Thu, 29 Apr 2010 10:52:22 +0200 Subject: r4747 - in trunk/varnish-cache/doc/sphinx: . faq Message-ID: Author: phk Date: 2010-04-29 10:52:22 +0200 (Thu, 29 Apr 2010) New Revision: 4747 Added: trunk/varnish-cache/doc/sphinx/faq/ trunk/varnish-cache/doc/sphinx/faq/index.rst Modified: trunk/varnish-cache/doc/sphinx/index.rst Log: Add a FAQ and start converting the Trac FAQ to .rst format Added: trunk/varnish-cache/doc/sphinx/faq/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/faq/index.rst (rev 0) +++ trunk/varnish-cache/doc/sphinx/faq/index.rst 2010-04-29 08:52:22 UTC (rev 4747) @@ -0,0 +1,484 @@ + +.. _faq: + +Frequently Asked Varnish Questions +================================== + +Varnish does... +--------------- + +... Varnish does not cache things, all requests hit the backend + + The number one cause is cookies, the ```default.vcl``` will + not cache anything if the request has a ```Cookie:``` header + or the if the backend sends a ```Set-Cookie:``` header. + + Number two cause is authentication, same thing. + +How... +------ + +... How much RAM/Disk do I need for Varnish ? + + That depends on pretty much everything. + + I think our best current guidance is that you go for a cost-effective + RAM configuration, something like 1-16GB, and a SSD disk. + + Unless you positively know that you will need it, there is + little point in spendng a fortune on a hand-sewn motherboard + that can fit several TB in special RAM blocks, rivetet together + by leftover watch-makers in Switzerland. + + On the other hand, if you plot your traffic in Gb/s, you probably + need all the RAM you can afford/get. + +... How can I limit Varnish to use less RAM ? + + You can not. Varnish operates in Virtual Memory and it is up to the + kernel to decide which process gets to use how much RAM to map the + virtual address-space of the process. + + +Where... +-------- + +... Can I find varnish for my operating system ? + + We know that Varnish has been packaged for Debian, Ubuntu, RHEL, + Centos, (Open)SuSE, Gentoo and FreeBSD, possibly more. Check whatever + packagemanager you use. + +Can I... +-------- + +... Can I use Varnish as a client-side proxy ? + + No. Varnish needs all backends configured in the VCL. Look at squid + instead. + +... Can I run Varnish on a 32bit system ? + + Yes, recently somebody even claimed to run Varnish on his N900 mobile + phone recently, but if you have the choice, go 64 bit from the start. + + Varnish is written to use Virtual Memory and on a 32bit system that + really cramps your style, and you will have trouble configuring more + than 2 GB of storage. + +... Can I run Varnish on the same system as Apache ? + + Yes, and many people do that with good success. + + There will be competition for resources, but Apache is not particular + good at using RAM effectively and Varnish is, so this synergy usually + more than compensates for the competition. + +... Can I run multiple Varnish on the same system ? + + Yes, as long as you give them different TCP ports and different ```-n``` + arguments, you will be fine. + + +... Can I cache multiple vhosts with one Varnish ? + + Yes, that works right out of the box. + +... Can I see what is cached in Varnish ? + + That is not possible for several reasons. A command to list + all the contents of a Varnish cache with millions of objects would + bring your Varnish to a standstill while it traverses the index. + + Besides, the output is a lot less useful than you might think. + +... Can I use Varnish to do HTTPS ? + + Not at present, and while we keep an eye on this, there are no + current plans to add HTTPS support, until we can find a way where + it adds significant value, relative to running a stand-alone + HTTPS proxy such as ngnix or pound. + +... Can Varnish load balance between multiple backends ? + + Yes, you need VCL code like this:: + + director foobar round-robin { + { .backend = { .host = "www1.example.com; .port = "http"; } } + { .backend = { .host = "www2.example.com; .port = "http"; } } + } + + sub vcl_recv { + set req.backend = foobar; + } + + (XXX: reference to docs, once written) + +Why ... +------- + +... Why are regular expressions case-sensitive ? + + Some HTTP headers, such as ```Host:``` and ```Location:``` + contain FQDN's which by definition is not case-sensitive. Other + HTTP headers are case-sensitive, most notably the URLs. Therefore + a "one size fits all" solution is not possible. + + In previous releases, we used the POSIX regular expressions + supplied with the operating system, and decided, because the + most common use of regexps were on ```Host:``` headers, that + they should not be case-sensitive. + + From version 2.1.0 and forward, we use PCRE regular expressions, + where it *is* possible to control case-sensitivity in the + individual regular expressions, so we decided that it would + probably confuse people if we made the default case-insentive. + (We promise not to change our minds about this again.) + + To make a PCRE regex case insensitive, put ```(?i)``` at the start:: + + if (req.http.host ~ "?iexample.com$") { + ... + } + + See the [http://www.pcre.org/pcre.txt PCRE man pages] for more information. + + +... Why does the ```Via:``` header say 1.1 in Varnish 2.1.x ? + + The number in the ```Via:``` header is the HTTP protocol version + supported/applied, not the softwares version number. + +... Why did you call it *Varnish* ? + + Long story, but basically the instigator of Varnish spent a long + time staring at an art-poster with the word "Vernisage" and ended + up checking it in a dictionary, which gives the following three + meanings of the word: + + r.v. var?nished, var?nish?ing, var?nish?es + + 1. To cover with varnish. + 2. To give a smooth and glossy finish to. + 3. To give a deceptively attractive appearance to; gloss over. + + The three point describes happens to your backend system when you + put Varnish in front of it. + +.. todo:: + + +The old Trac FAQ, still to be reformattet: +------------------------------------------ + +:: + + === Does Varnish support compression? === + + This is a simple question with a complicated answer; see [wiki:FAQ/Compression]. + + === Where can I find the log files? === + + Varnish does not log to a file, but to shared memory log. Use the varnishlog utility to print the shared memory log or varnishncsa to present it in the Apache / NCSA "combined" log format. + + === What is the purpose of the X-Varnish HTTP header? === + + The X-Varnish HTTP header allows you to find the correct log-entries for the transaction. For a cache hit, X-Varnish will contain both the ID of the current request and the ID of the request that populated the cache. It makes debugging Varnish a lot easier. + + == Configuration == + + == VCL == + + === How do I load VCL file while Varnish is running? === + + 1. Place the VCL file on the server + 1. Telnet into the managment port. + 1. do a "vcl.load " in managment interface. is whatever you would like to call your new configuration. + 1. do a "vcl.use " to start using your new config. + + + === Does Varnish require the system to have a C compiler? === + + Yes. The VCL compiler generates C source as output, and uses the systems C-compiler to compile that into a shared library. If there is no C compiler, Varnish will not work. + + === ... Isn't that security problem? === + + The days when you could prevent people from running non-approved programs by removing the C compiler from your system ended roughly with the VAX 11/780 computer. + + === What is a VCL file? === + + VCL is an acronym for Varnish Configuration Language. In a VCL file, you configure how Varnish should behave. Sample VCL files will be included in this Wiki at a later stage. + + === Where is the documentation on VCL? === + + Please see "man 7 vcl". + + === Should I use ''pipe'' or ''pass'' in my VCL code? What is the difference? === + + When varnish does a ''pass'' it acts like a normal HTTP proxy. It + reads the request and pushes it onto the backend. The next HTTP + request can then be handled like any other. + + ''pipe'' is only used when Varnish for some reason can't handle the + ''pass''. ''pipe'' reads the request, pushes in onty the backend + _only_ pushes bytes back and forth, with no other actions taken. + + Since most HTTP clients do pipeline several requests into one + connection this might give you an undesirable result - as every + subsequent request will reuse the existing ''pipe''. + + Varnish versions prior to 2.0 does not support handling a request body + with ''pass'' mode, so in those releases ''pipe'' is required for + correct handling. + + In 2.0 and later, ''pass'' will handle the request body correctly. + + If you get 503 errors when making a request which is ''pass''ed, make sure + that you're specifying the backend before returning from vcl_recv with ''pass''. + + + === Are regular expressions case sensitive or not? Can I change it? === + + In 2.1 and newer, regular expressions are case sensitive by default. In earlier versions, they were case insensitive. + + To change this for a single regex in 2.1, use "(?i)" at the start. See the [http://www.pcre.org/pcre.txt PCRE man pages] for more information. + + == How do I... == + + === How can I force a refresh on a object cached by varnish? === + + Refreshing is often called [http://dictionary.reference.com/browse/PURGE purging] a document. You can purge at least 2 different ways in Varnish: + + 1. From the command line you can write: + + {{{ + url.purge ^/$ + }}} + + to purge your '''/''' document. As you might see url.purge takes an + [http://en.wikipedia.org/wiki/Regular_expression regular expression] + as its argument. Hence the !^ and $ at the front and end. If the !^ is ommited, all the documents ending in a / in the cache would be deleted. + + So to delete all the documents in the cache, write: + + {{{ + url.purge .* + }}} + + at the command line. + + 2. HTTP PURGE + + VCL code to allow HTTP PURGE [wiki:VCLExamples is to be found here]. Note that this method does not support wildcard purging. + + === How can I debug the requests of a single client? === + + The "varnishlog" utility may produce a horrendous amount of output. To be able debug our own traffic can be useful. + + The ReqStart token will include the client IP address. To see log entries matching this, type: + + {{{ + $ varnishlog -c -o ReqStart 192.0.2.123 + }}} + + To see the backend requests generated by a client IP address, we can match on the TxHeader token, since the IP address of the client is included in the X-Forwarded-For header in the request sent to the backend. + + At the shell command line, type: + {{{ + $ varnishlog -b -o TxHeader 192.0.2.123 + }}} + + === How can I rewrite URLS before they are sent to the backend? === + + You can use the "regsub()" function to do this. Here's an example for zope, to rewrite URL's for the virtualhostmonster: + + {{{ + if (req.http.host ~ "^(www.)?example.com") { + set req.url = regsub(req.url, "^", "/VirtualHostBase/http/example.com:80/Sites/example.com/VirtualHostRoot"); + } + + }}} + + === I have a site with many hostnames, how do I keep them from multiplying the cache? === + + You can do this by normalizing the "Host" header for all your hostnames. Here's a VCL example: + + {{{ + if (req.http.host ~ "^(www.)?example.com") { + set req.http.host = "example.com"; + } + }}} + + === How can I log the client IP address on the backend? === + + All I see is the IP address of the varnish server. How can I log the client IP address? + + We will need to add the IP address to a header used for the backend request, and configure the backend to log the content of this header instead of the address of the connecting client (which is the varnish server). + + Varnish configuration: + {{{ + sub vcl_recv { + # Add a unique header containing the client address + remove req.http.X-Forwarded-For; + set req.http.X-Forwarded-For = client.ip; + # [...] + } + }}} + + For the apache configuration, we copy the "combined" log format to a new one we call "varnishcombined", for instance, and change the client IP field to use the content of the variable we set in the varnish configuration: + {{{ + LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" varnishcombined + }}} + + And so, in our virtualhost, you need to specify this format instead of "combined" (or "common", or whatever else you use) + {{{ + + ServerName www.example.com + # [...] + CustomLog /var/log/apache2/www.example.com/access.log varnishcombined + # [...] + + }}} + + The [http://www.openinfo.co.uk/apache/index.html mod_extract_forwarded Apache module] might also be useful. + + === How do I add a HTTP header? === + + To add a HTTP header, unless you want to add something about the client/request, it is best done in vcl_fetch as this means it will only be processed every time the object is fetched: + + {{{ + sub vcl_fetch { + # Add a unique header containing the cache servers IP address: + remove obj.http.X-Varnish-IP; + set obj.http.X-Varnish-IP = server.ip; + # Another header: + set obj.http.Foo = "bar"; + } + }}} + + === How do I do to alter the request going to the backend? === + You can use the ''bereq'' object for altering requests going to the backend but from my experience you can only 'set' values to it. + So, if you need to change the requested URL, '''this doesn't work''': + + {{{ + sub vcl_miss { + set bereq.url = regsub(bereq.url,"stream/","/"); + fetch; + } + }}} + + Because you cannot read from bereq.url (in the value part of the assignment). You will get: + {{{ + mgt_run_cc(): failed to load compiled VCL program: + ./vcl.1P9zoqAU.o: undefined symbol: VRT_r_bereq_url + VCL compilation failed + }}} + + Instead, you have to use '''req.url''': + + {{{ + sub vcl_miss { + set bereq.url = regsub(req.url,"stream/","/"); + fetch; + } + }}} + + === How do I force the backend to send Vary headers? === + + We have anectdotal evidence of non-RFC2616 compliant backends, which support content negotiation, but which do not emit a Vary header, unless the request contains Accept headers. + + It may be appropriate to send no-op Accept headers to trick the backend into sending us the Vary header. + + The following should be sufficient for most cases: + + {{{ + Accept: */* + Accept-Language: * + Accept-Charset: * + Accept-Encoding: identity + }}} + + Note that Accept-Encoding can not be set to *, as the backend might then send back a compressed response which the client would be unable to process. + + This can of course be implemented in VCL. + + === How can I customize the error messages that Varnish returns? === + + A custom error page can be generated by adding a vcl_error to your configuration file. The default error page looks like this: + + {{{ + sub vcl_error { + set obj.http.Content-Type = "text/html; charset=utf-8"; + + synthetic {" + + + + + "} obj.status " " obj.response {" + + +

Error "} obj.status " " obj.response {"

+

"} obj.response {"

+

Guru Meditation:

+

XID: "} req.xid {"

+
Varnish
+ + + "}; + deliver; + } + }}} + + === How do I instruct varnish to ignore the query parameters and only cache one instance of an object? === + + This can be achieved by removing the query parameters using a regexp: + + {{{ + sub vcl_recv { + set req.url = regsub(req.url, "\?.*", ""); + } + }}} + + === Do you have any examples? === + + Many varnish users have contributed [wiki:VCLExamples examples] from their VCLs to solve common problems. A ready made recipe to address your question may be included. + + == Troubleshooting == + + === Why does it look like Varnish sends all requests to the backend? I thought it was a cache? === + + There are 2 common reasons for this: + 1. The object's '''ttl expired'''. A common situation is that the backend does not set an expiry time on the requested image/file/webpage, so Varnish uses the default TTL (normally 120s). + 2. Your site uses '''cookies''': + * By default, varnish will not cache ''responses'' from the backend that come with a '''Set-Cookie''': header. + * By default, varnish will not serve ''requests'' with a '''Cookie:''' header, but pass them to the backend instead. Check out [wiki:VCLExamples these VCL examples] on how to make varnish cache cookied/logged in users sanely. + + === Why am I getting a cache hit, but a request is still going to my backend? === + + Varnish has a feature called ''hit for pass'', which is used when Varnish gets a response from the backend and finds out it cannot be cached. In such cases, Varnish will create a cache object that records that fact, so that the next request goes directly to "pass". + See the entry above for common cases where a backend returns a non-cacheable object. See this [wiki:VCLExampleDefault graphical overview] of how the Varnish request cycle works. + + Since Varnish bundles multiple requests for the same URL to the backend, a common case where a client will get a ''hit for pass'' is: + * Client 1 requests url /foo + * Client 2..N request url /foo + * Varnish tasks a worker to fetch /foo for Client 1 + * Client 2..N are now queued pending response from the worker + * Worker returns object to varnish which turns out to be non-cacheable. + * Client 2..N are now given the ''hit for pass'' object instructing them to go to the backend + + The ''hit for pass'' object will stay cached for the duration of it's ttl. This means that subsequent clients requesting /foo will be sent straight to the backend as long as the ''hit for pass'' object exists. + The [wiki:StatsExplained varnishstat program] can tell you how many ''hit for pass'' objects varnish has served. You can lower the ttl for such an object if '''you are sure this is needed''', using the following logic: + + {{{ + sub vcl_fetch { + if (!obj.cacheable) { + # Limit the lifetime of all 'hit for pass' objects to 10 seconds + obj.ttl = 10s; + pass; + } + } + + }}} + Modified: trunk/varnish-cache/doc/sphinx/index.rst =================================================================== --- trunk/varnish-cache/doc/sphinx/index.rst 2010-04-28 12:26:17 UTC (rev 4746) +++ trunk/varnish-cache/doc/sphinx/index.rst 2010-04-29 08:52:22 UTC (rev 4747) @@ -19,6 +19,7 @@ installation/index.rst tutorial/index.rst reference/index.rst + faq/index.rst glossary/index.rst Indices and tables From phk at varnish-cache.org Fri Apr 30 07:17:07 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 30 Apr 2010 09:17:07 +0200 Subject: r4748 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-30 09:17:07 +0200 (Fri, 30 Apr 2010) New Revision: 4748 Modified: trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc Log: Another p* test does not like the ban lurker Modified: trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc 2010-04-29 08:52:22 UTC (rev 4747) +++ trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc 2010-04-30 07:17:07 UTC (rev 4748) @@ -11,6 +11,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ + -arg "-pban_lurker_sleep=0" \ -arg "-spersistent,${tmpdir}/_.per,10m" -vcl+backend { } -start client c1 { From phk at varnish-cache.org Fri Apr 30 07:53:38 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 30 Apr 2010 09:53:38 +0200 Subject: r4749 - trunk/varnish-cache/bin/varnishtest Message-ID: Author: phk Date: 2010-04-30 09:53:38 +0200 (Fri, 30 Apr 2010) New Revision: 4749 Modified: trunk/varnish-cache/bin/varnishtest/vtc.c Log: Don't use tempnam(3) it results in a bogus compile time warning, because we are not trying to create a file but a directory. Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-30 07:17:07 UTC (rev 4748) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-30 07:53:38 UTC (rev 4749) @@ -612,6 +612,7 @@ double tmax, t0, t00; unsigned dur = 30; const char *nmax; + char tmpdir[BUFSIZ]; char cmd[BUFSIZ]; setbuf(stdout, NULL); @@ -646,8 +647,8 @@ init_macro(); init_sema(); - setenv("TMPDIR", "/tmp", 0); - vtc_tmpdir = tempnam(NULL, "vtc"); + bprintf(tmpdir, "/tmp/vtc.%d.%08x", getpid(), (unsigned)random()); + vtc_tmpdir = tmpdir; AN(vtc_tmpdir); AZ(mkdir(vtc_tmpdir, 0700)); macro_def(vltop, NULL, "tmpdir", vtc_tmpdir); From phk at varnish-cache.org Fri Apr 30 08:15:15 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 30 Apr 2010 10:15:15 +0200 Subject: r4750 - in trunk/varnish-cache/bin/varnishtest: . tests Message-ID: Author: phk Date: 2010-04-30 10:15:13 +0200 (Fri, 30 Apr 2010) New Revision: 4750 Modified: trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc trunk/varnish-cache/bin/varnishtest/tests/p00000.vtc trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc trunk/varnish-cache/bin/varnishtest/tests/v00010.vtc trunk/varnish-cache/bin/varnishtest/vtc_varnish.c Log: Introduce a -storage spec, and default it -sfile,,10m to aovid mapping more VM than a 32bit machine can cope with, if /tmp is huge. Modified: trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/b00000.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -9,7 +9,7 @@ txresp -body "012345\n" } -start -varnish v1 -arg "-smalloc,1m" -vcl+backend {} -start +varnish v1 -storage "-smalloc,1m" -vcl+backend {} -start varnish v1 -cliok "param.set diag_bitmap 0x2" Modified: trunk/varnish-cache/bin/varnishtest/tests/p00000.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00000.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00000.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -11,7 +11,8 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ - -arg "-spersistent,${tmpdir}/_.per,10m" -vcl+backend { } -start + -storage "-spersistent,${tmpdir}/_.per,10m" \ + -vcl+backend { } -start varnish v1 -stop Modified: trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00001.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -12,7 +12,8 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ -arg "-pban_lurker_sleep=0" \ - -arg "-spersistent,${tmpdir}/_.per,10m" -vcl+backend { } -start + -storage "-spersistent,${tmpdir}/_.per,10m" \ + -vcl+backend { } -start client c1 { txreq -url "/" Modified: trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -11,8 +11,8 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ - -arg "-spersistent,${tmpdir}/_.per1,10m" \ - -arg "-spersistent,${tmpdir}/_.per2,10m" \ + -storage "-spersistent,${tmpdir}/_.per1,10m" \ + -storage "-spersistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } -start client c1 { Modified: trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00003.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -11,7 +11,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ - -arg "-spersistent,${tmpdir}/_.per,10m" \ + -storage "-spersistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00004.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -13,7 +13,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ - -arg "-spersistent,${tmpdir}/_.per,10m" \ + -storage "-spersistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00005.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -11,7 +11,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x30000" \ - -arg "-spersistent,${tmpdir}/_.per,10m" \ + -storage "-spersistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { sub vcl_fetch { Modified: trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/p00006.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -13,7 +13,7 @@ varnish v1 \ - -arg "-spersistent,${tmpdir}/_.per,10m" \ + -storage "-spersistent,${tmpdir}/_.per,10m" \ -arg "-pban_lurker_sleep=0" \ -vcl+backend { } -start Modified: trunk/varnish-cache/bin/varnishtest/tests/v00010.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/v00010.vtc 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/tests/v00010.vtc 2010-04-30 08:15:13 UTC (rev 4750) @@ -13,7 +13,7 @@ txresp -hdr "Foo: foo" -body "abcdef\n" } -start -varnish v1 -arg "-smalloc,1m" -vcl+backend { +varnish v1 -storage "-smalloc,1m" -vcl+backend { sub vcl_fetch { if (beresp.http.panic) { Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-04-30 07:53:38 UTC (rev 4749) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2010-04-30 08:15:13 UTC (rev 4750) @@ -33,6 +33,7 @@ #include +#include #include #include #include @@ -68,6 +69,8 @@ struct varnish_stats *stats; + struct vsb *storage; + struct vsb *args; int fds[4]; pid_t pid; @@ -171,9 +174,15 @@ vtc_log(v->vl, 0, "Varnish name must start with 'v'"); v->args = vsb_newauto(); + + v->storage = vsb_newauto(); + vsb_printf(v->storage, "-sfile,%s,10M", v->workdir); + vsb_finish(v->storage); + v->cli_fd = -1; VTAILQ_INSERT_TAIL(&varnishes, v, list); + return (v); } @@ -269,6 +278,7 @@ vsb_printf(vsb, " -S %s/_S", v->workdir); vsb_printf(vsb, " -M %s:%s", abuf, pbuf); vsb_printf(vsb, " -P %s/varnishd.pid", v->workdir); + vsb_printf(vsb, " %s", vsb_data(v->storage)); vsb_printf(vsb, " %s", vsb_data(v->args)); vsb_finish(vsb); AZ(vsb_overflowed(vsb)); @@ -665,6 +675,13 @@ for (; *av != NULL; av++) { if (vtc_error) break; + if (!strcmp(*av, "-storage")) { + vsb_clear(v->storage); + vsb_cat(v->storage, av[1]); + vsb_finish(v->storage); + av++; + continue; + } if (!strcmp(*av, "-arg")) { AN(av[1]); AZ(v->pid); From phk at varnish-cache.org Fri Apr 30 08:15:37 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 30 Apr 2010 10:15:37 +0200 Subject: r4751 - trunk/varnish-cache/bin/varnishtest Message-ID: Author: phk Date: 2010-04-30 10:15:37 +0200 (Fri, 30 Apr 2010) New Revision: 4751 Modified: 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 Log: A round of various cleanups Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -54,12 +55,11 @@ #define MAX_FILESIZE (1024 * 1024) #define MAX_TOKENS 200 -static const char *vtc_file; static char *vtc_desc; int vtc_error; /* Error encountered */ int vtc_stop; /* Stops current test without error */ pthread_t vtc_thread; -char *vtc_tmpdir; +char vtc_tmpdir[PATH_MAX]; static struct vtclog *vltop; static pthread_mutex_t vtc_mtx; static pthread_cond_t vtc_cond; @@ -529,7 +529,6 @@ t0 = TIM_mono(); vtc_stop = 0; - vtc_file = fn; vtc_desc = NULL; vtc_log(vltop, 1, "TEST %s starting", fn); pe.buf = read_file(fn); @@ -539,18 +538,19 @@ pe.fn = fn; t = TIM_real() + dur; - ts.tv_sec = floor(t); - ts.tv_nsec = (t - ts.tv_sec) * 1e9; + ts.tv_sec = (long)floor(t); + ts.tv_nsec = (long)((t - ts.tv_sec) * 1e9); AZ(pthread_mutex_lock(&vtc_mtx)); AZ(pthread_create(&pt, NULL, exec_file_thread, &pe)); i = pthread_cond_timedwait(&vtc_cond, &vtc_mtx, &ts); - vtc_thread = NULL; + memset(&vtc_thread, 0, sizeof vtc_thread); if (i == 0) { AZ(pthread_mutex_unlock(&vtc_mtx)); AZ(pthread_join(pt, &v)); } else { + AZ(pthread_mutex_unlock(&vtc_mtx)); if (i != ETIMEDOUT) vtc_log(vltop, 1, "Weird condwait return: %d %s", i, strerror(i)); @@ -580,7 +580,6 @@ else if (vtc_verbosity == 0) printf("# top TEST %s passed (%.3fs)\n", fn, t0); - vtc_file = NULL; free(vtc_desc); return (t0); } @@ -612,7 +611,6 @@ double tmax, t0, t00; unsigned dur = 30; const char *nmax; - char tmpdir[BUFSIZ]; char cmd[BUFSIZ]; setbuf(stdout, NULL); @@ -647,9 +645,7 @@ init_macro(); init_sema(); - bprintf(tmpdir, "/tmp/vtc.%d.%08x", getpid(), (unsigned)random()); - vtc_tmpdir = tmpdir; - AN(vtc_tmpdir); + bprintf(vtc_tmpdir, "/tmp/vtc.%d.%08x", getpid(), (unsigned)random()); AZ(mkdir(vtc_tmpdir, 0700)); macro_def(vltop, NULL, "tmpdir", vtc_tmpdir); @@ -679,7 +675,6 @@ if (vtc_error == 0 || vtc_verbosity == 0) { bprintf(cmd, "rm -rf %s", vtc_tmpdir); AZ(system(cmd)); - free(vtc_tmpdir); } if (vtc_error) Modified: trunk/varnish-cache/bin/varnishtest/vtc.h =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.h 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc.h 2010-04-30 08:15:37 UTC (rev 4751) @@ -58,7 +58,7 @@ extern int vtc_error; /* Error, bail out */ extern int vtc_stop; /* Abandon current test, no error */ extern pthread_t vtc_thread; -extern char *vtc_tmpdir; +extern char vtc_tmpdir[PATH_MAX]; void init_sema(void); Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_client.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc_client.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -31,6 +31,7 @@ #include "svnid.h" SVNID("$Id$") +#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -31,6 +31,7 @@ #include "svnid.h" SVNID("$Id$") +#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -31,6 +31,7 @@ #include "svnid.h" SVNID("$Id$") +#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_sema.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc_sema.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -31,6 +31,7 @@ #include "svnid.h" SVNID("$Id$") +#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_server.c 2010-04-30 08:15:13 UTC (rev 4750) +++ trunk/varnish-cache/bin/varnishtest/vtc_server.c 2010-04-30 08:15:37 UTC (rev 4751) @@ -31,6 +31,7 @@ #include "svnid.h" SVNID("$Id$") +#include #include #include #include From phk at varnish-cache.org Fri Apr 30 08:16:11 2010 From: phk at varnish-cache.org (phk at varnish-cache.org) Date: Fri, 30 Apr 2010 10:16:11 +0200 Subject: r4752 - trunk/varnish-cache/bin/varnishtest/tests Message-ID: Author: phk Date: 2010-04-30 10:16:11 +0200 (Fri, 30 Apr 2010) New Revision: 4752 Modified: trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc Log: Another ban-lurker-hater. Modified: trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc 2010-04-30 08:15:37 UTC (rev 4751) +++ trunk/varnish-cache/bin/varnishtest/tests/p00002.vtc 2010-04-30 08:16:11 UTC (rev 4752) @@ -11,6 +11,7 @@ varnish v1 \ -arg "-pdiag_bitmap=0x20000" \ + -arg "-pban_lurker_sleep=0" \ -storage "-spersistent,${tmpdir}/_.per1,10m" \ -storage "-spersistent,${tmpdir}/_.per2,10m" \ -vcl+backend { } -start