From phk at projects.linpro.no Fri May 1 09:56:36 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 1 May 2009 11:56:36 +0200 (CEST) Subject: r4044 - trunk/varnish-cache/bin/varnishtest Message-ID: <20090501095636.D594A1F7B45@projects.linpro.no> Author: phk Date: 2009-05-01 11:56:36 +0200 (Fri, 01 May 2009) New Revision: 4044 Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c Log: Don't overrun rxbuf Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-04-30 10:55:22 UTC (rev 4043) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-05-01 09:56:36 UTC (rev 4044) @@ -321,7 +321,7 @@ vtc_log(hp->vl, 0, "HTTP rx failed (%s)", strerror(errno)); assert(i > 0); - assert(hp->prxbuf < hp->nrxbuf); + assert(hp->prxbuf + n < hp->nrxbuf); i = read(hp->fd, hp->rxbuf + hp->prxbuf, n); if (i == 0) return (i); From phk at projects.linpro.no Fri May 1 09:57:11 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 1 May 2009 11:57:11 +0200 (CEST) Subject: r4045 - trunk/varnish-cache/bin/varnishtest Message-ID: <20090501095711.A88611F76ED@projects.linpro.no> Author: phk Date: 2009-05-01 11:57:11 +0200 (Fri, 01 May 2009) New Revision: 4045 Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c Log: And allocate a larger rxbuf while at it. Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-05-01 09:56:36 UTC (rev 4044) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-05-01 09:57:11 UTC (rev 4045) @@ -769,7 +769,7 @@ hp->vl = vl; hp->client = client; hp->timeout = 3000; - hp->nrxbuf = 8192; + hp->nrxbuf = 64*1024; hp->vsb = vsb_newauto(); hp->rxbuf = malloc(hp->nrxbuf); /* XXX */ AN(hp->rxbuf); From phk at projects.linpro.no Fri May 1 10:34:12 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Fri, 1 May 2009 12:34:12 +0200 (CEST) Subject: r4046 - in trunk/varnish-cache/bin: varnishd varnishtest varnishtest/tests Message-ID: <20090501103412.907C61F7B12@projects.linpro.no> Author: phk Date: 2009-05-01 12:34:12 +0200 (Fri, 01 May 2009) New Revision: 4046 Added: trunk/varnish-cache/bin/varnishtest/tests/b00029.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishtest/vtc_http.c Log: Change the way we close client sessions. Previously we always used SO_LINGER to make sure that all queued data got transmitted, no matter under which circumstances we closed the client connection. Change this so that SO_LINGER is only activated for orderly connection closure (ie: "Connection: close" from client or error handling), in all other cases (usually the client connecting on us, abandon any data queued for transmission. This _may_ reduce the tendency of worker threads to get hung up on network failures a little bit. Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2009-05-01 09:57:11 UTC (rev 4045) +++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2009-05-01 10:34:12 UTC (rev 4046) @@ -68,7 +68,9 @@ static pthread_t vca_thread_acct; static struct timeval tv_sndtimeo; static struct timeval tv_rcvtimeo; -static struct linger linger; +static const struct linger linger = { + .l_onoff = 1, +}; static unsigned char need_sndtimeo, need_rcvtimeo, need_linger, need_test; Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-05-01 09:57:11 UTC (rev 4045) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-05-01 10:34:12 UTC (rev 4046) @@ -242,8 +242,15 @@ sp->t_req = NAN; - if (sp->fd >= 0 && sp->doclose != NULL) + if (sp->fd >= 0 && sp->doclose != NULL) { + /* + * This is an orderly close of the connection; ditch linger + * before we close, to get queued data transmitted. + */ + struct linger lin = { 0, 0 }; + AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &lin, sizeof lin)); vca_close_session(sp, sp->doclose); + } if (sp->fd < 0) { SES_Charge(sp); VSL_stats->sess_closed++; Added: trunk/varnish-cache/bin/varnishtest/tests/b00029.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/b00029.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/b00029.vtc 2009-05-01 10:34:12 UTC (rev 4046) @@ -0,0 +1,18 @@ +# $Id$ + +test "Test orderly connection closure" + + +server s1 { + rxreq + txresp -bodylen 130000 +} -start + +varnish v1 -vcl+backend { } -start + +client c1 { + txreq -hdr "Connection: close" + delay 3 + rxresp + expect resp.bodylen == 130000 +} -run Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-05-01 09:57:11 UTC (rev 4045) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-05-01 10:34:12 UTC (rev 4046) @@ -769,7 +769,7 @@ hp->vl = vl; hp->client = client; hp->timeout = 3000; - hp->nrxbuf = 64*1024; + hp->nrxbuf = 640*1024; hp->vsb = vsb_newauto(); hp->rxbuf = malloc(hp->nrxbuf); /* XXX */ AN(hp->rxbuf); From phk at projects.linpro.no Mon May 4 07:43:17 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 May 2009 09:43:17 +0200 (CEST) Subject: r4047 - in trunk/varnish-cache: bin/varnishd include lib/libvarnish Message-ID: <20090504074317.196BE37F45@projects.linpro.no> Author: phk Date: 2009-05-04 09:43:16 +0200 (Mon, 04 May 2009) New Revision: 4047 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c trunk/varnish-cache/bin/varnishd/cache_pipe.c trunk/varnish-cache/include/libvarnish.h trunk/varnish-cache/lib/libvarnish/tcp.c Log: r4046 forgot to reset SO_LINGER for pipe handling which basically broke pipehandling. Fixes #505 Modified: trunk/varnish-cache/bin/varnishd/cache_center.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_center.c 2009-05-01 10:34:12 UTC (rev 4046) +++ trunk/varnish-cache/bin/varnishd/cache_center.c 2009-05-04 07:43:16 UTC (rev 4047) @@ -247,8 +247,7 @@ * This is an orderly close of the connection; ditch linger * before we close, to get queued data transmitted. */ - struct linger lin = { 0, 0 }; - AZ(setsockopt(sp->fd, SOL_SOCKET, SO_LINGER, &lin, sizeof lin)); + TCP_linger(sp->fd, 0); vca_close_session(sp, sp->doclose); } if (sp->fd < 0) { Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_pipe.c 2009-05-01 10:34:12 UTC (rev 4046) +++ trunk/varnish-cache/bin/varnishd/cache_pipe.c 2009-05-04 07:43:16 UTC (rev 4047) @@ -98,8 +98,12 @@ sp->t_resp = TIM_real(); memset(fds, 0, sizeof fds); + + TCP_linger(vc->fd, 0); fds[0].fd = vc->fd; fds[0].events = POLLIN | POLLERR; + + TCP_linger(sp->fd, 0); fds[1].fd = sp->fd; fds[1].events = POLLIN | POLLERR; Modified: trunk/varnish-cache/include/libvarnish.h =================================================================== --- trunk/varnish-cache/include/libvarnish.h 2009-05-01 10:34:12 UTC (rev 4046) +++ trunk/varnish-cache/include/libvarnish.h 2009-05-04 07:43:16 UTC (rev 4047) @@ -61,6 +61,7 @@ int TCP_filter_http(int sock); void TCP_blocking(int sock); void TCP_nonblocking(int sock); +void TCP_linger(int sock, int linger); #ifdef SOL_SOCKET void TCP_name(const struct sockaddr *addr, unsigned l, char *abuf, unsigned alen, char *pbuf, unsigned plen); Modified: trunk/varnish-cache/lib/libvarnish/tcp.c =================================================================== --- trunk/varnish-cache/lib/libvarnish/tcp.c 2009-05-01 10:34:12 UTC (rev 4046) +++ trunk/varnish-cache/lib/libvarnish/tcp.c 2009-05-04 07:43:16 UTC (rev 4047) @@ -222,3 +222,17 @@ AZ(setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof timeout)); #endif } + +/*-------------------------------------------------------------------- + * Set or reset SO_LINGER flag + */ + +void +TCP_linger(int sock, int linger) +{ + struct linger lin; + + memset(&lin, 0, sizeof lin); + lin.l_onoff = linger; + AZ(setsockopt(sock, SOL_SOCKET, SO_LINGER, &lin, sizeof lin)); +} From phk at projects.linpro.no Mon May 4 08:05:29 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 4 May 2009 10:05:29 +0200 (CEST) Subject: r4048 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20090504080529.92FDD37F45@projects.linpro.no> Author: phk Date: 2009-05-04 10:05:29 +0200 (Mon, 04 May 2009) New Revision: 4048 Added: trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c Log: Fix a parse error in VCL:purge() string version. Fixes #502 Modified: trunk/varnish-cache/bin/varnishd/cache_vrt.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_vrt.c 2009-05-04 07:43:16 UTC (rev 4047) +++ trunk/varnish-cache/bin/varnishd/cache_vrt.c 2009-05-04 08:05:29 UTC (rev 4048) @@ -133,7 +133,9 @@ return (p); } -/*--------------------------------------------------------------------*/ +/*-------------------------------------------------------------------- + * XXX: Optimize the single element case ? + */ /*lint -e{818} ap,hp could be const */ static char * @@ -918,20 +920,25 @@ } b = BAN_New(); good = 0; - for (i = 1; ; i += 3) { - a1 = av[i]; + for (i = 1; ;) { + a1 = av[i++]; if (a1 == NULL) break; good = 0; - a2 = av[i + 1]; + a2 = av[i++]; if (a2 == NULL) break; - a3 = av[i + 2]; + a3 = av[i++]; if (a3 == NULL) break; if (BAN_AddTest(NULL, b, a1, a2, a3)) break; good = 1; + if (av[i] == NULL) + break; + good = 0; + if (strcmp(av[i++], "&&")) + break; } if (!good) /* XXX: report error how ? */ Added: trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc =================================================================== --- trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc (rev 0) +++ trunk/varnish-cache/bin/varnishtest/tests/r00502.vtc 2009-05-04 08:05:29 UTC (rev 4048) @@ -0,0 +1,30 @@ +# $Id$ + +test "multi element purge" + +server s1 { + rxreq + txresp -hdr "foo: bar1" -body "1" + rxreq + txresp -hdr "foo: bar2" -body "22" +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + purge("req.url == / && obj.http.foo ~ bar1"); + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == "bar1" + txreq + rxresp + expect resp.http.foo == "bar2" + txreq + rxresp + expect resp.http.foo == "bar2" +} -run + +varnish v1 -cliok purge.list From sky at projects.linpro.no Mon May 4 13:48:25 2009 From: sky at projects.linpro.no (sky at projects.linpro.no) Date: Mon, 4 May 2009 15:48:25 +0200 (CEST) Subject: r4049 - trunk/varnish-cache/bin/varnishd Message-ID: <20090504134825.8CE9237F45@projects.linpro.no> Author: sky Date: 2009-05-04 15:48:25 +0200 (Mon, 04 May 2009) New Revision: 4049 Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c trunk/varnish-cache/bin/varnishd/cache_response.c Log: Move the setting of the correct headers for ESI from ESI parsing time to delivery time. This is in anticipation for set req.esi = off; Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_esi.c 2009-05-04 08:05:29 UTC (rev 4048) +++ trunk/varnish-cache/bin/varnishd/cache_esi.c 2009-05-04 13:48:25 UTC (rev 4049) @@ -739,13 +739,6 @@ if (ew->incmt) esi_error(ew, ew->t.e, -1, "ESI 1.0 unterminated -
-| Name | -Tests | -Pass | -Fail | -Time | -Description | -Notes | -
|---|---|---|---|---|---|---|
| - | - | - | - | s | -- | - |
| Total | -- | - | - | s | -- | - |