From fgsch at lodoss.net Tue Sep 1 12:20:39 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Tue, 01 Sep 2015 14:20:39 +0200 Subject: [master] 199de9b Spelling and formatting Message-ID: commit 199de9bef274ea923d87a06495aea8226c8ff8f7 Author: Federico G. Schwindt Date: Fri Aug 28 08:41:58 2015 +0100 Spelling and formatting diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 7b6eeba..b71cc85 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -3,7 +3,8 @@ Changes in Varnish 4.1 (unreleased) =================================== -Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. +Varnish 4.1 is the continuation of the new streaming architecture seen +in Varnish 4.0. Proactive security features @@ -12,25 +13,26 @@ Proactive security features New in 4.1 is support for different kinds of privilege separation methods, collectively described as jails. -On most systems, the Varnish parent process will now drop effective privileges -to normal user mode when not doing operations needing special access. +On most systems, the Varnish parent process will now drop effective +privileges to normal user mode when not doing operations needing special +access. The Varnish worker child should now be run as a separate `vcache` user. -``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities now must -be run in a context with `varnish` group membership. +``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities +now must be run in a context with `varnish` group membership. Warm and cold VCL configurations ================================ -Traditionally Varnish have had the concept of active and inactive loaded VCLs. -Any loaded VCL lead to state being kept, and a separate set of health checks (if -configured) were being run against the backends. +Traditionally Varnish have had the concept of active and inactive +loaded VCLs. Any loaded VCL lead to state being kept, and a separate +set of health checks (if configured) were being run against the backends. -To avoid the extra state and backend polling, a loaded VCL is now either warm -or cold. Runtime state (incl. backend counters) and health checks are not -present for cold VCLs. +To avoid the extra state and backend polling, a loaded VCL is now either +warm or cold. Runtime state (incl. backend counters) and health checks +are not present for cold VCLs. A warm VCL will automatically be set to cold after `vcl_cooldown` seconds. @@ -60,16 +62,17 @@ Example:: available auto/cold 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 -VMOD writers should read up on the new vcl_event system to release unnecessary -state when a VCL is transitioned to cold (see ref:`ref-vmod-event-functions`). +VMOD writers should read up on the new vcl_event system to +release unnecessary state when a VCL is transitioned to cold (see +:ref:`ref-vmod-event-functions`). PROXY protocol support ====================== -Socket support for PROXY protocol connections has been added. PROXY defines a -short preamble on the TCP connection where (usually) a SSL/TLS terminating -proxy can signal the real client address. +Socket support for PROXY protocol connections has been added. PROXY +defines a short preamble on the TCP connection where (usually) a SSL/TLS +terminating proxy can signal the real client address. The ``-a`` startup argument syntax has been expanded to allow for this:: @@ -94,11 +97,12 @@ in ``vcl_recv`` to see if traffic came in over the HTTP listening socket VMOD backends ============= -Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 -moved directors from VCL to VMODs, and VMODs can now also create backends. It -is possible to both create the same backends than VCL but dynamically, or -create backends that don't necesserally speak HTTP/1 over TCP to fetch -resources. More details in the :ref:`ref-writing-a-director` documentation. +Before Varnish 4.1, backends could only be declared in native VCL. Varnish +4.0 moved directors from VCL to VMODs, and VMODs can now also create +backends. It is possible to both create the same backends than VCL but +dynamically, or create backends that don't necessarily speak HTTP/1 over +TCP to fetch resources. More details in the :ref:`ref-writing-a-director` +documentation. Surrogate keys @@ -109,8 +113,8 @@ Not yet documented. Passing data between ESI requests ================================= -A new `req_top` identifier is available in VCL, which is a reference -to `req` in the top-level ESI request. +A new `req_top` identifier is available in VCL, which is a reference to +`req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request and any ESI subrequests it lead to. @@ -119,7 +123,9 @@ and any ESI subrequests it lead to. Other noteworthy small changes ============================== -* Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. -* Varnish will now discard remaining/older open backend connections when a failing connection is found. +* Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 + to set object grace time. +* Varnish will now discard remaining/older open backend connections when + a failing connection is found. * -smalloc storage is now recommended over -sfile on Linux systems. From lkarsten at varnish-software.com Wed Sep 2 11:36:32 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 02 Sep 2015 13:36:32 +0200 Subject: [master] a6162d5 Add contents for 3.0.7 from 3.0 branch. Message-ID: commit a6162d5baeff4dbcd8d7ac39aa24ec8c0c46b288 Author: Lasse Karstensen Date: Wed Sep 2 13:34:48 2015 +0200 Add contents for 3.0.7 from 3.0 branch. Fixes: #1782 diff --git a/doc/changes.rst b/doc/changes.rst index a2e4598..745d1bc 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -451,6 +451,38 @@ Open issues .. _1268: https://www.varnish-cache.org/trac/ticket/1268 +============================================ +Changes from 3.0.7-rc1 to 3.0.7 (2015-03-23) +============================================ + +- No changes. + +============================================ +Changes from 3.0.6 to 3.0.7-rc1 (2015-03-18) +============================================ + +- Requests with multiple Content-Length headers will now fail. + +- Stop recognizing a single CR (\r) as a HTTP line separator. + This opened up a possible cache poisioning attack in stacked installations + where sslterminator/varnish/backend had different CR handling. + +- Improved error detection on master-child process communication, leading to + faster recovery (child restart) if communication loses sync. + +- Fix a corner-case where Content-Length was wrong for HTTP 1.0 clients, + when using gzip and streaming. Bug 1627_. + +- More robust handling of hop-by-hop headers. + +- [packaging] Coherent Redhat pidfile in init script. Bug 1690_. + +- Avoid memory leak when adding bans. + +.. _1627: http://varnish-cache.org/trac/ticket/1627 +.. _1690: http://varnish-cache.org/trac/ticket/1690 + + =========================================== Changes from 3.0.6rc1 to 3.0.6 (2014-10-16) =========================================== From fgsch at lodoss.net Wed Sep 2 14:51:55 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 02 Sep 2015 16:51:55 +0200 Subject: [master] 91085b2 Silence dns test output when offline Message-ID: commit 91085b2b00bc1d572ef3bba3511f2068d55ff645 Author: Federico G. Schwindt Date: Wed Sep 2 15:51:17 2015 +0100 Silence dns test output when offline diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index e1f15d1..cfdea02 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -416,10 +416,8 @@ dns_works(void) const char *msg; error = VSS_resolver("phk.freebsd.dk", NULL, dns_cb, &ret, &msg); - if (error || msg != NULL || ret != 1) { - fprintf(stderr, "DNS-test fails\n"); + if (error || msg != NULL || ret != 1) return (0); - } return (1); } From fgsch at lodoss.net Wed Sep 2 14:51:55 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 02 Sep 2015 16:51:55 +0200 Subject: [master] 1858d35 GC unused prototypes Message-ID: commit 1858d35ca043ecacabe35d53cf2460acf880b1c6 Author: Federico G. Schwindt Date: Wed Sep 2 15:51:49 2015 +0100 GC unused prototypes diff --git a/include/vrt.h b/include/vrt.h index 4b429dd..2d0a012 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -253,9 +253,7 @@ void VRT_ban_string(VRT_CTX, const char *); void VRT_purge(VRT_CTX, double ttl, double grace, double keep); void VRT_count(VRT_CTX, unsigned); -int VRT_rewrite(const char *, const char *); void VRT_synth(VRT_CTX, unsigned, const char *); -int VRT_switch_config(const char *); struct http *VRT_selecthttp(VRT_CTX, enum gethdr_e); const char *VRT_GetHdr(VRT_CTX, const struct gethdr_s *); From lkarsten at varnish-software.com Thu Sep 3 13:42:42 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Sep 2015 15:42:42 +0200 Subject: [master] 81c0e4a Improve client workspace overflow handling. Message-ID: commit 81c0e4a64e5f5af967324b502661b243ffdbef00 Author: Lasse Karstensen Date: Thu Sep 3 15:02:49 2015 +0200 Improve client workspace overflow handling. Instead of asserting, return a 500 error to the client if running out of client workspace. This also extends vmod_debug with workspace handling functions, and adds two test cases that use these functions. As discussed at VDD15Q3. Reviewed by Martin. diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 324947b..c931971 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -58,6 +58,23 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, return (0); } +static void +v1d_error(struct req *req, const char *msg) { + static const char r_500[] = + "HTTP/1.1 500 Internal Server Error\r\n" + "Server: Varnish\r\n" + "Connection: close\r\n\r\n"; + + VSLb(req->vsl, SLT_Error, "%s", msg); + VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); + VSLb(req->vsl, SLT_RespStatus, "500"); + VSLb(req->vsl, SLT_RespReason, "Internal Server Error"); + + (void)write(req->sp->fd, r_500, sizeof r_500 - 1); + req->doclose = SC_TX_EOF; + return; +} + /*-------------------------------------------------------------------- */ @@ -105,6 +122,11 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); + if (WS_Overflowed(req->ws)) { + v1d_error(req, "workspace_client overflow"); + return; + } + req->acct.resp_hdrbytes += HTTP1_Write(req->wrk, req->resp, HTTP1_Resp); if (DO_DEBUG(DBG_FLUSH_HEAD)) (void)V1L_Flush(req->wrk); diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c index 2bcaf6e..04d2533 100644 --- a/bin/varnishd/http1/cache_http1_line.c +++ b/bin/varnishd/http1/cache_http1_line.c @@ -80,7 +80,8 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, res = WS_Snapshot(ws); v1l = WS_Alloc(ws, sizeof *v1l); - AN(v1l); + if (v1l == NULL) + return; INIT_OBJ(v1l, V1L_MAGIC); v1l->ws = ws; @@ -89,9 +90,12 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, u = WS_Reserve(ws, 0); u = PRNDDN(u); u /= sizeof(struct iovec); - if (u > IOV_MAX) + if (u == 0) { + WS_Release(ws, 0); + WS_MarkOverflow(ws); + return; + } else if (u > IOV_MAX) u = IOV_MAX; - AN(u); v1l->iov = (void*)PRNDUP(ws->f); v1l->siov = u; v1l->ciov = u; @@ -102,6 +106,7 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, v1l->t0 = t0; v1l->vsl = vsl; wrk->v1l = v1l; + return; } unsigned diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc new file mode 100644 index 0000000..27f339f --- /dev/null +++ b/bin/varnishtest/tests/c00070.vtc @@ -0,0 +1,55 @@ +varnishtest "Test workspace functions in vmod_debug" + +server s1 { + rxreq + txresp + + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import ${vmod_debug}; + sub vcl_backend_response { + set beresp.http.free_backend = debug.workspace_free(backend); + } + + sub vcl_deliver { + set resp.http.free_client = debug.workspace_free(client); + set resp.http.free_session = debug.workspace_free(session); + set resp.http.free_thread = debug.workspace_free(thread); + + set resp.http.overflowed = debug.workspace_overflowed(client); + debug.workspace_allocate(client, 2048); + + if (req.url == "/bar") { + debug.workspace_overflow(client); + } + } +} -start + +logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" { + expect 0 * Begin + expect * = Error "workspace_client overflow" + expect * = End +} -start + +client c1 { + txreq -url /foo + rxresp + expect resp.http.overflowed == "false" + + expect resp.http.free_client > 57000 + expect resp.http.free_backend > 57000 + expect resp.http.free_session > 250 + expect resp.http.free_thread > 2000 +} -run + +client c2 { + txreq -url /bar + rxresp + expect resp.status == 500 +} -run + +logexpect l1 -wait + diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc new file mode 100644 index 0000000..59e3281 --- /dev/null +++ b/bin/varnishtest/tests/c00071.vtc @@ -0,0 +1,47 @@ +varnishtest "Test actual client workspace overflow" + +server s1 { + rxreq + txresp + + rxreq + txresp + + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import ${vmod_debug}; + sub vcl_deliver { + debug.workspace_allocate(client, debug.workspace_free(client) - 200); + + if (req.url ~ "/bar") { + set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + } + else if (req.url ~ "/baz") { + set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"); + } + set resp.http.x-of = debug.workspace_overflowed(client); + } +} -start + +client c1 { + txreq -url /foo + rxresp + expect resp.status == 200 + expect resp.http.x-of == "false" + + txreq -url /bar + rxresp + expect resp.status == 500 + expect resp.http.x-of == +} -run + +client c2 { + txreq -url /baz + rxresp + expect resp.status == 500 + expect resp.http.x-of == +} -run + diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 8b32e92..dad36ec 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -122,3 +122,19 @@ Return the dynamic backend. $Method VOID .refresh(STRING addr, STRING port) Dynamically refresh & (always!) replace the backend by a new one. + +$Function VOID workspace_allocate(ENUM { client, backend, session, thread }, INT SIZE) + +Allocate and zero out SIZE bytes from a workspace. + +$Function BOOL workspace_overflowed(ENUM { client, backend, session, thread }) + +Return if the workspace overflow mark is set or not. + +$Function VOID workspace_overflow(ENUM { client, backend, session, thread }) + +Mark a workspace as overflowed. + +$Function INT workspace_free(ENUM { client, backend, session, thread }) + +Find how much unallocated space there is left in a workspace. diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index c9b1028..732d89a 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -290,3 +290,72 @@ vmod_sleep(VRT_CTX, VCL_DURATION t) CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC); VTIM_sleep(t); } + +static struct ws *wsfind(VRT_CTX, VCL_ENUM which) { + if (!strcmp(which, "client")) { + return ctx->ws; + } else if (!strcmp(which, "backend")) { + return ctx->bo->ws; + } else if (!strcmp(which, "session")) { + return ctx->req->sp->ws; + } else if (!strcmp(which, "thread")) { + return ctx->req->wrk->aws; + } else + WRONG("No such workspace."); +} + +void +vmod_workspace_allocate(VRT_CTX, VCL_ENUM which, VCL_INT size) +{ + struct ws *ws; + char *s; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + + WS_Assert(ws); + AZ(ws->r); + + s = WS_Alloc(ws, size); + if (!s) + return; + memset(s, '\0', size); +} + +VCL_INT +vmod_workspace_free(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + + WS_Assert(ws); + AZ(ws->r); + + return pdiff(ws->f, ws->e); +} + +VCL_BOOL +vmod_workspace_overflowed(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + WS_Assert(ws); + + return (WS_Overflowed(ws)); +} + +void +vmod_workspace_overflow(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + WS_Assert(ws); + + WS_MarkOverflow(ws); +} From fgsch at lodoss.net Thu Sep 3 20:16:08 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 03 Sep 2015 22:16:08 +0200 Subject: [master] a3282ae Remove superfluous returns Message-ID: commit a3282aed553c7265fbe6111fc49c4008992c28f6 Author: Federico G. Schwindt Date: Thu Sep 3 21:15:27 2015 +0100 Remove superfluous returns diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 139e18b..c747ead 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -567,7 +567,6 @@ ccf_config_load(struct cli *cli, const char * const *av, void *priv) ASSERT_CLI(); if (VCL_Load(cli, av[2], av[3], av[4])) VCLI_SetResult(cli, CLIS_PARAM); - return; } static void __match_proto__(cli_func_t) @@ -640,7 +639,6 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv) Lck_Unlock(&vcl_mtx); } VSB_delete(vsb); - return; } static void __match_proto__(cli_func_t) diff --git a/bin/varnishd/hash/hash_classic.c b/bin/varnishd/hash/hash_classic.c index 9121ec1..ef817ea 100644 --- a/bin/varnishd/hash/hash_classic.c +++ b/bin/varnishd/hash/hash_classic.c @@ -78,7 +78,6 @@ hcl_init(int ac, char * const *av) } hcl_nhash = u; fprintf(stderr, "Classic hash: %u buckets\n", hcl_nhash); - return; } /*-------------------------------------------------------------------- diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index c931971..5d4e4f2 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -59,7 +59,8 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, } static void -v1d_error(struct req *req, const char *msg) { +v1d_error(struct req *req, const char *msg) +{ static const char r_500[] = "HTTP/1.1 500 Internal Server Error\r\n" "Server: Varnish\r\n" @@ -72,7 +73,6 @@ v1d_error(struct req *req, const char *msg) { (void)write(req->sp->fd, r_500, sizeof r_500 - 1); req->doclose = SC_TX_EOF; - return; } /*-------------------------------------------------------------------- diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c index 04d2533..9c49fca 100644 --- a/bin/varnishd/http1/cache_http1_line.c +++ b/bin/varnishd/http1/cache_http1_line.c @@ -106,7 +106,6 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, v1l->t0 = t0; v1l->vsl = vsl; wrk->v1l = v1l; - return; } unsigned diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index d029861..433581e 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -381,5 +381,4 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) req->sp->sess_step = S_STP_H1NEWREQ; wrk->task.func = SES_Proto_Req; wrk->task.priv = req; - return; } diff --git a/bin/varnishd/waiter/cache_waiter_ports.c b/bin/varnishd/waiter/cache_waiter_ports.c index 0a647ef..f9e3b52 100644 --- a/bin/varnishd/waiter/cache_waiter_ports.c +++ b/bin/varnishd/waiter/cache_waiter_ports.c @@ -131,7 +131,6 @@ vws_port_ev(struct vws *vws, struct waiter *w, port_event_t *ev, double now) { WAITER_REMCLOSE : WAITER_ACTION, now); } - return; } static void * diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index 9559016..ce4c2eb 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -397,7 +397,6 @@ vxp_expr_not(struct vxp *vxp, struct vex **pvex) } vxp_expr_group(vxp, pvex); - return; } /* diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index ea3e679..4a026b0 100644 --- a/lib/libvcc/vcc_action.c +++ b/lib/libvcc/vcc_action.c @@ -49,7 +49,6 @@ parse_call(struct vcc *tl) Fb(tl, 1, "if (VGC_function_%.*s(ctx))\n", PF(tl->t)); Fb(tl, 1, "\treturn (1);\n"); vcc_NextToken(tl); - return; } /*--------------------------------------------------------------------*/ diff --git a/lib/libvcc/vcc_backend_util.c b/lib/libvcc/vcc_backend_util.c index de361a5..c079b20 100644 --- a/lib/libvcc/vcc_backend_util.c +++ b/lib/libvcc/vcc_backend_util.c @@ -117,7 +117,6 @@ vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs) vcc_ErrToken(tl, t_field); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, t_field); - return; } void From lkarsten at varnish-software.com Fri Sep 4 09:47:08 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 11:47:08 +0200 Subject: [master] dd0e126 Clarify Github PR procedure. Message-ID: commit dd0e126a9b3a44c63a5f972aa3f423d61a11407d Author: Lasse Karstensen Date: Fri Sep 4 11:37:36 2015 +0200 Clarify Github PR procedure. diff --git a/CONTRIBUTING b/CONTRIBUTING index 3f15742..d7c0277 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -13,5 +13,11 @@ Official development tree is here: Patches can be sent to varnish-dev at varnish-cache.org. -Documentation fixes and other small items for the documentation team may be -sent as Github pull requests. + +Github pull requests +-------------------- + +Documentation updates and other non-trivial items for the documentation +team may be sent as Github pull requests. + +Pull requests outside of this scope will be closed without review. From lkarsten at varnish-software.com Fri Sep 4 09:54:36 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 11:54:36 +0200 Subject: [master] d455255 Moving Redhat packaging files out of the tree. Message-ID: commit d455255536e23f1ca785b43f7ddd10f9a3ef50ab Author: Lasse Karstensen Date: Fri Sep 4 11:51:30 2015 +0200 Moving Redhat packaging files out of the tree. Redhat packaging files for the official varnish-cache.org RPMs will from now on live in a separate git repository. This decouples source releases (including release tagging) and the packaging work, which makes the release process easier. diff --git a/README.Packaging b/README.Packaging new file mode 100644 index 0000000..dbe4680 --- /dev/null +++ b/README.Packaging @@ -0,0 +1,35 @@ +Packaging +========= + +Varnish Cache packaging files are kept outside of the main distribution. + +The main reason for this is to decouple the development work from the packaging work. + +We want to be able to tag a release and do a tarball release without having +to wait for the packagers to finish their work/changes. + + +Official packages +----------------- + +The official Debian and Redhat packages are built by the Varnish Cache team +and made available on http://repo.varnish-cache.org/ . + +Packaging files for Debian: + + git://git.varnish-cache.org/varnish-cache-debian.git + +Packaging files for Redhat: + + https://github.com/varnish/varnish-cache-redhat + +Scripts that run the builds are available on: + + https://github.com/varnish/pkg-varnish-cache + + +Third-party packages +-------------------- + +Varnish Cache is built and packaged in many different operating systems and +distributions. Please see the wiki for more information. diff --git a/redhat/Makefile.am b/redhat/Makefile.am deleted file mode 100644 index 62997e1..0000000 --- a/redhat/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -# - -EXTRA_DIST = \ - README.redhat \ - varnish.initrc \ - varnish.logrotate \ - varnish_reload_vcl \ - varnish.spec \ - varnish.sysconfig \ - varnishlog.initrc \ - varnishncsa.initrc \ - varnish.params \ - varnish.service \ - varnishncsa.service \ - varnishlog.service \ - find-provides diff --git a/redhat/README.redhat b/redhat/README.redhat deleted file mode 100644 index 1f9c016..0000000 --- a/redhat/README.redhat +++ /dev/null @@ -1,59 +0,0 @@ -GCC -=== -Varnish requires a GCC-compiler compatible with the compiler used to -build varnish with. This means GCC 3.4.6 on a standard RHEL4 system. - -Varnish should work fine with GCC 3.3 and above. - -Building a RPM package from a git checkout -========================================== - -You may build an rpm package direct from a git checkout. Here is an -example on how you may do this: - -git clone git://git.varnish-cache.org/varnish-cache -cd varnish-cache -sed -i "s/^Release: .*/Release: 0.git$(date +%Y%m%d)%{?dist}/" \ - redhat/varnish.spec -./autogen.sh && ./configure -make dist && rpmbuild -ts varnish-trunk.tar.gz - -This builds a source rpm. Then you can, for example on a RHEL5 system, -do something like this: - -rpmbuild --define "dist .el5" --rebuild /path/to/varnish-3.0-0.git20110203.src.rpm - - -Configuration of addresses and ports -==================================== -In this package, varnish is configured to make the accelerator daemon -listen to port 6081. The administration interface listens to port 6082 -on 127.0.0.1. Addresses and ports can be changed in -/etc/sysconfig/varnish. - -The admin interface can be accessed by standard telnet. - -The default config will try to forward http requests to -localhost:80. You may change this in /etc/varnish/vcl.conf. Please -read the vcl(7) man page for more information on the vcl language. - -To gain actual value from varnish, you may want to move the listening -port to port 80, and your webserver to 8080 or similar. - -Running with jemalloc on ppc or ppc64 on fedora: Edit and recompile -=================================================================== -To get a package through to Fedora, it has to build in Red Hat's Koji -build environment. Their ppc and ppc64 builders run mock on a RHEL -ppc64 kernel. Our use of jemalloc does not work on this kernel, and -the build stays unsuccessful. As ppc64 is not the primary target of -varnish development, it may take some time to get this bug fixed. -To get the package through to Fedora, jemalloc is disabled in the ppc -and ppc64 builds. - -Now, varnish with jemalloc enabled is known to work at least on the -ppc (32bit) kernel in Fedora 9. If you run on ppc, and have a workload -that suits jemalloc better, you might want to change the specfile and -recompile. We would very much like feedback from anyone running -varnish on Fedora's own ppc64 kernel. - - diff --git a/redhat/find-provides b/redhat/find-provides deleted file mode 100755 index 2545e99..0000000 --- a/redhat/find-provides +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh - -# This script is used to inject the Varnish ABI into the provides. - -set -x - -if [ -x /usr/lib/rpm/redhat/find-provides ]; then - /usr/lib/rpm/redhat/find-provides "$@" -elif [ -x /usr/lib/rpm/find-provides ]; then - /usr/lib/rpm/find-provides "$@" -fi - -cd $(dirname $0)/.. - -printf '#include "vcs_version.h"\nVCS_Version\n' \ - | cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/' - -printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \ - | cpp - -Iinclude \ - | sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g' diff --git a/redhat/varnish.initrc b/redhat/varnish.initrc deleted file mode 100755 index 67b530a..0000000 --- a/redhat/varnish.initrc +++ /dev/null @@ -1,172 +0,0 @@ -#! /bin/sh -# -# varnish Control the Varnish Cache -# -# chkconfig: - 90 10 -# description: Varnish is a high-perfomance HTTP accelerator -# processname: varnishd -# config: /etc/sysconfig/varnish -# pidfile: /var/run/varnish.pid - -### BEGIN INIT INFO -# Provides: varnish -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Should-Start: $syslog -# Short-Description: start and stop varnishd -# Description: Varnish is a high-perfomance HTTP accelerator -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile=/var/run/varnish.pid - -exec="/usr/sbin/varnishd" -reload_exec="/usr/sbin/varnish_reload_vcl" -prog="varnishd" -config="/etc/sysconfig/varnish" -lockfile="/var/lock/subsys/varnish" - -# Include varnish defaults -[ -e /etc/sysconfig/varnish ] && . /etc/sysconfig/varnish - - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - if [ ! -f $config ] - then - echo $config not found - exit 6 - fi - echo -n "Starting Varnish Cache: " - - # Open files (usually 1024, which is way too small for varnish) - ulimit -n ${NFILES:-131072} - - # Varnish wants to lock shared memory log in memory. - ulimit -l ${MEMLOCK:-82000} - - # Maximum number of threads (default in CentOS is 1024, which - # is often too small for varnish) - ulimit -u ${NPROCS:-unlimited} - - # If defined, set maximum core size. - if [ -n "${DAEMON_COREFILE_LIMIT}" ] - then - ulimit -c ${DAEMON_COREFILE_LIMIT} - fi - - # $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one - # has to set up a backend, or /tmp will be used, which is a bad idea. - if [ "$DAEMON_OPTS" = "" ]; then - echo "\$DAEMON_OPTS empty." - echo -n "Please put configuration options in $config" - return 6 - else - # Varnish always gives output on STDOUT - daemon --pidfile $pidfile $exec -P $pidfile "$DAEMON_OPTS" > /dev/null 2>&1 - retval=$? - if [ $retval -eq 0 ] - then - touch $lockfile - echo_success - echo - else - echo_failure - echo - fi - return $retval - fi -} - -stop() { - echo -n "Stopping Varnish Cache: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - if [ "$RELOAD_VCL" = "1" ] - then - $reload_exec - else - force_reload - fi -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -configtest() { - if [ -f "$VARNISH_VCL_CONF" ]; then - $exec -f "$VARNISH_VCL_CONF" -C "$DAEMON_OPTS" -n /tmp > /dev/null && echo "Syntax ok" - else - echo "VARNISH_VCL_CONF is unset or does not point to a file" - fi -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - configtest) - configtest - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnish.logrotate b/redhat/varnish.logrotate deleted file mode 100644 index f214d1b..0000000 --- a/redhat/varnish.logrotate +++ /dev/null @@ -1,10 +0,0 @@ -/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -HUP `cat /var/run/varnishlog.pid 2>/dev/null` 2> /dev/null || true - /bin/kill -HUP `cat /var/run/varnishncsa.pid 2>/dev/null` 2> /dev/null || true - endscript -} diff --git a/redhat/varnish.params b/redhat/varnish.params deleted file mode 100644 index 27a14dd..0000000 --- a/redhat/varnish.params +++ /dev/null @@ -1,35 +0,0 @@ -# Varnish environment configuration description. This was derived from -# the old style sysconfig/defaults settings - -# Set this to 1 to make systemd reload try to switch vcl without restart. -RELOAD_VCL=1 - -# Main configuration file. You probably want to change it. -VARNISH_VCL_CONF=/etc/varnish/default.vcl - -# Default address and port to bind to. Blank address means all IPv4 -# and IPv6 interfaces, otherwise specify a host name, an IPv4 dotted -# quad, or an IPv6 address in brackets. -# VARNISH_LISTEN_ADDRESS=192.168.1.5 -VARNISH_LISTEN_PORT=6081 - -# Admin interface listen address and port -VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -VARNISH_ADMIN_LISTEN_PORT=6082 - -# Shared secret file for admin interface -VARNISH_SECRET_FILE=/etc/varnish/secret - -# Backend storage specification, see Storage Types in the varnishd(5) -# man page for details. -VARNISH_STORAGE="file,/var/lib/varnish/varnish_storage.bin,1G" - -# Default TTL used when the backend does not specify one -VARNISH_TTL=120 - -# User and group for the varnishd worker processes -VARNISH_USER=varnish -VARNISH_GROUP=varnish - -# Other options, see the man page varnishd(1) -#DAEMON_OPTS="-p thread_pool_min=5 -p thread_pool_max=500 -p thread_pool_timeout=300" diff --git a/redhat/varnish.service b/redhat/varnish.service deleted file mode 100644 index 659dba2..0000000 --- a/redhat/varnish.service +++ /dev/null @@ -1,46 +0,0 @@ -[Unit] -Description=Varnish a high-perfomance HTTP accelerator -After=syslog.target network.target - -[Service] - -# -# If you want to make changes to this file, please copy it to -# /etc/systemd/system/varnish.service and make your changes there. -# This will override the file kept at /lib/systemd/system/varnish.service -# -# Enviroment variables may be found in /etc/varnish/varnish.params -# - -# Maximum number of open files (for ulimit -n) -LimitNOFILE=131072 - -# Locked shared memory (for ulimit -l) -# Default log size is 82MB + header -LimitMEMLOCK=82000 - -# Maximum size of the corefile. -LimitCORE=infinity - -EnvironmentFile=/etc/varnish/varnish.params - -Type=forking -PIDFile=/var/run/varnish.pid -PrivateTmp=true -ExecStart=/usr/sbin/varnishd \ - -P /var/run/varnish.pid \ - -f $VARNISH_VCL_CONF \ - -a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ - -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ - -t $VARNISH_TTL \ - -u $VARNISH_USER \ - -g $VARNISH_GROUP \ - -S $VARNISH_SECRET_FILE \ - -s $VARNISH_STORAGE \ - $DAEMON_OPTS - -ExecReload=/usr/sbin/varnish_reload_vcl - -[Install] -WantedBy=multi-user.target - diff --git a/redhat/varnish.spec b/redhat/varnish.spec deleted file mode 100644 index 9bce64d..0000000 --- a/redhat/varnish.spec +++ /dev/null @@ -1,645 +0,0 @@ -%define XXXv_rc rc1 -%define vd_rc %{?v_rc:-%{?v_rc}} -%define _use_internal_dependency_generator 0 -%define __find_provides %{_builddir}/varnish-%{version}%{?v_rc:-%{?v_rc}}/redhat/find-provides -Summary: High-performance HTTP accelerator -Name: varnish -Version: 4.0.1 -#Release: 0.20140328%{?v_rc}%{?dist} -Release: 1%{?v_rc}%{?dist} -License: BSD -Group: System Environment/Daemons -URL: https://www.varnish-cache.org/ -#Source0: http://repo.varnish-cache.org/source/%{name}-%{version}.tar.gz -Source0: %{name}-%{version}%{?vd_rc}.tar.gz -#Source0: %{name}-trunk.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: automake -BuildRequires: autoconf -BuildRequires: jemalloc-devel -BuildRequires: libedit-devel -BuildRequires: libtool -BuildRequires: ncurses-devel -BuildRequires: pcre-devel -BuildRequires: pkgconfig -BuildRequires: python-docutils >= 0.6 -BuildRequires: python-sphinx -Requires: jemalloc -Requires: libedit -Requires: logrotate -Requires: ncurses -Requires: pcre -Requires: varnish-libs = %{version}-%{release} -Requires(pre): shadow-utils -Requires(post): /sbin/chkconfig, /usr/bin/uuidgen -Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -%if %{undefined suse_version} -Requires(preun): initscripts -%endif -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -Requires(post): systemd-units -Requires(post): systemd-sysv -Requires(preun): systemd-units -Requires(postun): systemd-units -BuildRequires: systemd-units -%endif - -# Varnish actually needs gcc installed to work. It uses the C compiler -# at runtime to compile the VCL configuration files. This is by design. -Requires: gcc - -%description -This is Varnish Cache, a high-performance HTTP accelerator. - -Varnish Cache stores web pages in memory so web servers don't have to -create the same web page over and over again. Varnish serves pages -much faster than any application server; giving the website a -significant speed up. - -Documentation wiki and additional information about Varnish is -available on the following web site: https://www.varnish-cache.org/ - -%package libs -Summary: Libraries for %{name} -Group: System Environment/Libraries -BuildRequires: ncurses-devel -#Obsoletes: libvarnish1 - -%description libs -Libraries for %{name}. -Varnish Cache is a high-performance HTTP accelerator - -%package libs-devel -Summary: Development files for %{name}-libs -Group: System Environment/Libraries -BuildRequires: ncurses-devel -Requires: varnish-libs = %{version}-%{release} -Requires: python - -%description libs-devel -Development files for %{name}-libs -Varnish Cache is a high-performance HTTP accelerator - -%package docs -Summary: Documentation files for %name -Group: System Environment/Libraries - -%description docs -Documentation files for %name - -#%package libs-static -#Summary: Files for static linking of %{name} library functions -#Group: System Environment/Libraries -#BuildRequires: ncurses-devel -#Requires: varnish-libs-devel = %{version}-%{release} -# -#%description libs-static -#Files for static linking of varnish library functions -#Varnish Cache is a high-performance HTTP accelerator - -%prep -%setup -n varnish-%{version}%{?vd_rc} -#%setup -q -n varnish-trunk - -%build -# No pkgconfig/libpcre.pc in rhel4 -%if 0%{?rhel} == 4 - export PCRE_CFLAGS="`pcre-config --cflags`" - export PCRE_LIBS="`pcre-config --libs`" -%endif - -%if 0%{?rhel} == 6 -export CFLAGS="$CFLAGS -O2 -g -Wp,-D_FORTIFY_SOURCE=0" -%endif - -# Remove "--disable static" if you want to build static libraries -# jemalloc is not compatible with Red Hat's ppc64 RHEL kernel :-( -%ifarch ppc64 ppc - %configure --disable-static --localstatedir=/var/lib --without-jemalloc --without-rst2html -%else - %configure --disable-static --localstatedir=/var/lib --without-rst2html -%endif - -# 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; -# s|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool - -make %{?_smp_mflags} V=1 - -%if 0%{?fedora}%{?rhel} != 0 && 0%{?rhel} <= 4 && 0%{?fedora} <= 8 - # Old style daemon function - sed -i 's,--pidfile \$pidfile,,g; - s,status -p \$pidfile,status,g; - s,killproc -p \$pidfile,killproc,g' \ - redhat/varnish.initrc redhat/varnishlog.initrc redhat/varnishncsa.initrc -%endif - -rm -rf doc/sphinx/build/html/_sources -mv doc/sphinx/build/html doc -rm -rf doc/sphinx/build - -%check -# rhel5 on ppc64 is just too strange -%ifarch ppc64 - %if 0%{?rhel} > 4 - cp bin/varnishd/.libs/varnishd bin/varnishd/lt-varnishd - %endif -%endif - -# The redhat ppc builders seem to have some ulimit problems? -# These tests work on a rhel4 ppc/ppc64 instance outside the builders -%ifarch ppc64 ppc - %if 0%{?rhel} == 4 - rm bin/varnishtest/tests/c00031.vtc - rm bin/varnishtest/tests/r00387.vtc - %endif -%endif - -make check %{?_smp_mflags} LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcc/.libs:../../lib/libvgz/.libs" VERBOSE=1 - -%install -rm -rf %{buildroot} -make install DESTDIR=%{buildroot} INSTALL="install -p" - -# None of these for fedora -find %{buildroot}/%{_libdir}/ -name '*.la' -exec rm -f {} ';' - -# Remove this line to build a devel package with symlinks -#find %{buildroot}/%{_libdir}/ -name '*.so' -type l -exec rm -f {} ';' - -mkdir -p %{buildroot}/var/lib/varnish -mkdir -p %{buildroot}/var/log/varnish -mkdir -p %{buildroot}/var/run/varnish -mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ -install -D -m 0644 etc/example.vcl %{buildroot}%{_sysconfdir}/varnish/default.vcl -install -D -m 0644 redhat/varnish.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/varnish - -# systemd support -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -mkdir -p %{buildroot}%{_unitdir} -install -D -m 0644 redhat/varnish.service %{buildroot}%{_unitdir}/varnish.service -install -D -m 0644 redhat/varnish.params %{buildroot}%{_sysconfdir}/varnish/varnish.params -install -D -m 0644 redhat/varnishncsa.service %{buildroot}%{_unitdir}/varnishncsa.service -install -D -m 0644 redhat/varnishlog.service %{buildroot}%{_unitdir}/varnishlog.service -sed -i 's,sysconfig/varnish,varnish/varnish.params,' redhat/varnish_reload_vcl -# default is standard sysvinit -%else -install -D -m 0644 redhat/varnish.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/varnish -install -D -m 0755 redhat/varnish.initrc %{buildroot}%{_initrddir}/varnish -install -D -m 0755 redhat/varnishlog.initrc %{buildroot}%{_initrddir}/varnishlog -install -D -m 0755 redhat/varnishncsa.initrc %{buildroot}%{_initrddir}/varnishncsa -%endif -install -D -m 0755 redhat/varnish_reload_vcl %{buildroot}%{_sbindir}/varnish_reload_vcl - -echo %{_libdir}/varnish > %{buildroot}%{_sysconfdir}/ld.so.conf.d/varnish-%{_arch}.conf - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{_sbindir}/* -%{_bindir}/* -%{_var}/lib/varnish -%{_var}/log/varnish -%{_mandir}/man1/*.1* -%{_mandir}/man3/*.3* -%{_mandir}/man7/*.7* -%doc LICENSE README redhat/README.redhat ChangeLog -%{_docdir}/varnish/ -%dir %{_sysconfdir}/varnish/ -%config(noreplace) %{_sysconfdir}/varnish/default.vcl -%config(noreplace) %{_sysconfdir}/logrotate.d/varnish - -# systemd from fedora 17 and rhel 7 -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -%{_unitdir}/varnish.service -%{_unitdir}/varnishncsa.service -%{_unitdir}/varnishlog.service -%config(noreplace)%{_sysconfdir}/varnish/varnish.params - -# default is standard sysvinit -%else -%config(noreplace) %{_sysconfdir}/sysconfig/varnish -%{_initrddir}/varnish -%{_initrddir}/varnishlog -%{_initrddir}/varnishncsa -%endif - -%files libs -%defattr(-,root,root,-) -%{_libdir}/*.so.* -%{_libdir}/varnish -%doc LICENSE -%config %{_sysconfdir}/ld.so.conf.d/varnish-%{_arch}.conf - -%files libs-devel -%defattr(-,root,root,-) -%{_libdir}/lib*.so -%dir %{_includedir}/varnish -%{_includedir}/varnish/* -%{_libdir}/pkgconfig/varnishapi.pc -/usr/share/varnish -/usr/share/aclocal - -%doc LICENSE - -%files docs -%defattr(-,root,root,-) -%doc LICENSE -%doc doc/sphinx -%doc doc/html -%doc doc/changes*.html - -#%files libs-static -#%{_libdir}/libvarnish.a -#%{_libdir}/libvarnishapi.a -#%{_libdir}/libvarnishcompat.a -#%{_libdir}/libvcc.a -#%doc LICENSE - -%pre -getent group varnish >/dev/null || groupadd -r varnish -getent passwd varnish >/dev/null || \ - useradd -r -g varnish -d /var/lib/varnish -s /sbin/nologin \ - -c "Varnish Cache" varnish -exit 0 - -%post -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -%else -/sbin/chkconfig --add varnish -/sbin/chkconfig --add varnishlog -/sbin/chkconfig --add varnishncsa -%endif -test -f /etc/varnish/secret || (uuidgen > /etc/varnish/secret && chmod 0600 /etc/varnish/secret) - -%triggerun -- varnish < 3.0.2-1 -# Save the current service runlevel info -# User must manually run systemd-sysv-convert --apply varnish -# to migrate them to systemd targets -%{_bindir}/systemd-sysv-convert --save varnish >/dev/null 2>&1 ||: - -# If the package is allowed to autostart: -#/bin/systemctl --no-reload enable varnish.service >/dev/null 2>&1 ||: - -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del varnish >/dev/null 2>&1 || : -#/bin/systemctl try-restart varnish.service >/dev/null 2>&1 || : - -%preun -if [ $1 -lt 1 ]; then - # Package removal, not upgrade - %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 - /bin/systemctl --no-reload disable varnish.service > /dev/null 2>&1 || : - /bin/systemctl stop varnish.service > /dev/null 2>&1 || : - %else - /sbin/service varnish stop > /dev/null 2>&1 - /sbin/service varnishlog stop > /dev/null 2>&1 - /sbin/service varnishncsa stop > /dev/null 2>%1 - /sbin/chkconfig --del varnish - /sbin/chkconfig --del varnishlog - /sbin/chkconfig --del varnishncsa - %endif -fi - -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig - -%changelog -* Mon Mar 12 2012 Ingvar Hagelund - 3.0.2-2 -- Added PrivateTmp=true to varnishd unit file, closing #782539 -- Fixed comment typos in varnish unit file - -* Tue Mar 06 2012 Ingvar Hagelund - 3.0.2-1 -- New upstream version 3.0.2 -- Removed INSTALL as requested by rpmlint -- Added a ld.so.conf.d fragment file listing libdir/varnish -- Removed redundant doc/html/_sources -- systemd support from fedora 17 -- Stopped using macros for make and install, according to - Fedora's packaging guidelines -- Changes merged from upstream: - - Added suse_version macro - - Added comments on building from a git checkout - - mkpasswd -> uuidgen for fewer dependencies - - Fixed missing quotes around cflags for pcre - - Removed unnecessary 32/64 bit parallell build hack as this is fixed upstream - - Fixed typo in configure call, disable -> without - - Added lib/libvgz/.libs to LD_LIBRARY_PATH in make check - - Added section 3 manpages - - Configure with --without-rst2man --without-rst2html - - changelog entries -- Removed unnecessary patch for system jemalloc, upstream now supports this - -* Fri Feb 10 2012 Petr Pisar - 2.1.5-4 -- Rebuild against PCRE 8.30 - -* Sat Jan 14 2012 Fedora Release Engineering - 2.1.5-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Mon Feb 07 2011 Fedora Release Engineering - 2.1.5-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Tue Feb 01 2011 Ingvar Hagelund - 2.1.5-1 -- New upstream release -- New download location -- Moved varnish_reload_vcl to sbin -- Removed patches included upstream -- Use jemalloc as system installed library - -* Mon Nov 15 2010 Ingvar Hagelund - 3.0.0-0.svn20101115r5543 -- Merged some changes from fedora -- Upped general version to 3.0 prerelease in trunk - -* Thu Nov 04 2010 Ingvar Hagelund - 2.1.4-4 -- Added a patch fixing a missing echo in the init script that - masked failure output from the script -- Added a patch from upstream, fixing a problem with Content-Length - headers (upstream r5461, upstream bug #801) -- Added a patch from upstream, adding empty Default-Start and Default-Stop - to initscripts for better lsb compliance -- Added varnish_reload_vcl from trunk -- Synced descriptions from release spec - -* Thu Oct 28 2010 Ingvar Hagelund - 2.1.4-3 -- Fixed missing manpages because of no rst2man in rhel4 and 5 - -* Mon Oct 25 2010 Ingvar Hagelund - 2.1.4-2 -- Removed RHEL6/ppc64 specific patch that has been included upstream - -* Mon Oct 25 2010 Ingvar Hagelund - 2.1.4-1 -- New upstream release -- New URL for source tarball and main website -- Prebuilt html docs now included, use that instead of running sphinx -- Putting sphinx generated doc in a separate subpackage -- Replaced specific include files with a wildcard glob -- Needs python-sphinx and deps to build sphinx documentation - -* Tue Aug 24 2010 Ingvar Hagelund - 2.1.3-2 -- Added a RHEL6/ppc64 specific patch that changes the hard coded - stack size in tests/c00031.vtc - -* Thu Jul 29 2010 Ingvar Hagelund - 2.1.4-0.svn20100824r5117 -- Replaced specific include files with a wildcard glob -- Needs python-sphinx and deps to build sphinx documentation -- Builds html and latex documentation. Put that in a subpackage varnish-docs - -* Thu Jul 29 2010 Ingvar Hagelund - 2.1.3-1 -- New upstream release -- Add a patch for jemalloc on s390 that lacks upstream - -* Wed May 05 2010 Ingvar Hagelund - 2.1.2-1 -- New upstream release -- Remove patches merged upstream - -* Tue Apr 27 2010 Ingvar Hagelund - 2.1.1-1 -- New upstream release -- Added a fix for missing pkgconfig/libpcre.pc on rhel4 -- Added a patch from trunk making the rpm buildable on lowspec - build hosts (like Red Hat's ppc build farm nodes) -- Removed patches that are merged upstream - -* 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) -- Removed tests c00031.vtc and r00387on rhel4/ppc as they fail - on the Red Hat ppc builders (but works on my rhel4 ppc instance) -- Added a patch that fixes broken changes-2.0.6.html in doc - -* Mon Dec 14 2009 Ingvar Hagelund - 2.0.6-1 -- New upstream release -- Removed patches for libjemalloc, as they are added upstream - -* Mon Nov 09 2009 Ingvar Hagelund - 2.0.5-1 -- New upstream release - -* Thu Aug 13 2009 Ingvar Hagelund - 2.0.4-4 -- Added a sparc specific patch to libjemalloc. - -* Sun Jul 26 2009 Fedora Release Engineering - 2.0.4-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Thu Jun 04 2009 Ingvar Hagelund - 2.0.4-2 -- Added a s390 specific patch to libjemalloc. - -* Fri Mar 27 2009 Ingvar Hagelund - 2.0.4-1 - New upstream release 2.0.4 - -* Wed Feb 25 2009 Fedora Release Engineering - 2.0.3-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Wed Feb 11 2009 Ingvar Hagelund - 2.0.3-1 - New upstream release 2.0.3. A bugfix and feature enhancement release - -* Fri Dec 12 2008 Ingvar Hagelund - 2.0.2-2 - Added a fix for a timeout bug, backported from trunk - -* Mon Nov 10 2008 Ingvar Hagelund - 2.0.2-1 - New upstream release 2.0.2. A bugfix release - -* Sun Nov 02 2008 Ingvar Hagelund - 2.0.1-2 -- Removed the requirement for kernel => 2.6.0. All supported - platforms meets this, and it generates strange errors in EPEL - -* Fri Oct 17 2008 Ingvar Hagelund - 2.0.1-1 -- 2.0.1 released, a bugfix release. New upstream sources -- Package now also available in EPEL - -* Thu Oct 16 2008 Ingvar Hagelund - 2.0-2 -- Readded the debugflag patch. It's so practical -- Added a strange workaround for make check on ppc64 - -* Wed Oct 15 2008 Ingvar Hagelund - 2.0-1 -- 2.0 released. New upstream sources -- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat -- Synced to upstream again. No more patches needed - -* Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 -- 2.0-rc1 released. New upstream sources -- Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes -- Added a patch for test a00008, from r3269 -- Removed condrestart in postscript at upgrade. We don't want that - -* Fri Sep 26 2008 Ingvar Hagelund - 2.0-0.10.beta2 -- 2.0-beta2 released. New upstream sources -- Whitespace changes to make rpmlint more happy - -* Fri Sep 12 2008 Ingvar Hagelund - 2.0-0.9.20080912svn3184 -- Added varnisncsa init script (Colin Hill) -- Corrected varnishlog init script (Colin Hill) - -* Tue Sep 09 2008 Ingvar Hagelund - 2.0-0.8.beta1 -- Added a patch from r3171 that fixes an endian bug on ppc and ppc64 -- Added a hack that changes the varnishtest ports for 64bits builds, - so they can run in parallell with 32bits build on same build host - -* Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.7.beta1 -- Added a patch from r3156 and r3157, hiding a legit errno in make check - -* Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.6.beta1 -- Added a commented option for max coresize in the sysconfig script -- Added a comment in README.redhat about upgrading from 1.x to 2.0 - -* Fri Aug 29 2008 Ingvar Hagelund - 2.0-0.5.beta1 -- Bumped version numbers and source url for first beta release \o/ -- Added a missing directory to the libs-devel package (Michael Schwendt) -- Added the LICENSE file to the libs-devel package -- Moved make check to its proper place -- Removed superfluous definition of lockfile in initscripts - -* Wed Aug 27 2008 Ingvar Hagelund - 2.0-0.4.20080827svn3136 -- Fixed up init script for varnishlog too - -* Mon Aug 25 2008 Ingvar Hagelund - 2.0-0.3.20080825svn3125 -- Fixing up init script according to newer Fedora standards -- The build now runs the test suite after compiling -- Requires initscripts -- Change default.vcl from nothing but comments to point to localhost:80, - -* Mon Aug 18 2008 Ingvar Hagelund - 2.0-0.2.tp2 -- Changed source, version and release to match 2.0-tp2 - -* Thu Aug 14 2008 Ingvar Hagelund - 2.0-0.1.20080814svn -- default.vcl has moved -- Added groff to build requirements - -* Tue Feb 19 2008 Fedora Release Engineering - 1.1.2-6 -- Autorebuild for GCC 4.3 - -* Sat Dec 29 2007 Ingvar Hagelund - 1.1.2-5 -- Added missing configuration examples -- Corrected the license to "BSD" - -* Fri Dec 28 2007 Ingvar Hagelund - 1.1.2-4 -- Build for fedora update - -* Fri Dec 28 2007 Ingvar Hagelund - 1.1.2-2 -- Added missing changelog items - -* Thu Dec 20 2007 Stig Sandbeck Mathisen - 1.1.2-1 -- Bumped the version number to 1.1.2. -- Addeed build dependency on libxslt - -* Fri Sep 07 2007 Ingvar Hagelund - 1.1.1-3 -- Added a patch, changeset 1913 from svn trunk. This makes varnish - more stable under specific loads. - -* Thu Sep 06 2007 Ingvar Hagelund - 1.1.1-2 -- Removed autogen call (only diff from relase tarball) - -* Mon Aug 20 2007 Ingvar Hagelund - 1.1.1-1 -- Bumped the version number to 1.1.1. - -* Tue Aug 14 2007 Ingvar Hagelund - 1.1.svn -- Update for 1.1 branch -- Added the devel package for the header files and static library files -- Added a varnish user, and fixed the init script accordingly - -* Thu Jul 05 2007 Dag-Erling Sm?rgrav - 1.1-1 -- Bump Version and Release for 1.1 - -* Mon May 28 2007 Ingvar Hagelund - 1.0.4-3 -- Fixed initrc-script bug only visible on el4 (fixes #107) - -* Sun May 20 2007 Ingvar Hagelund - 1.0.4-2 -- Repack from unchanged 1.0.4 tarball -- Final review request and CVS request for Fedora Extras -- Repack with extra obsoletes for upgrading from older sf.net package - -* Fri May 18 2007 Dag-Erling Sm?rgrav - 1.0.4-1 -- Bump Version and Release for 1.0.4 - -* Wed May 16 2007 Ingvar Hagelund - 1.0.svn-20070517 -- Wrapping up for 1.0.4 -- Changes in sysconfig and init scripts. Syncing with files in - trunk/debian - -* Fri May 11 2007 Ingvar Hagelund - 1.0.svn-20070511 -- Threw latest changes into svn trunk -- Removed the conversion of manpages into utf8. They are all utf8 in trunk - -* Wed May 09 2007 Ingvar Hagelund - 1.0.3-7 -- Simplified the references to the subpackage names -- Added init and logrotate scripts for varnishlog - -* Mon Apr 23 2007 Ingvar Hagelund - 1.0.3-6 -- Removed unnecessary macro lib_name -- Fixed inconsistently use of brackets in macros -- Added a condrestart to the initscript -- All manfiles included, not just the compressed ones -- Removed explicit requirement for ncurses. rpmbuild figures out the - correct deps by itself. -- Added ulimit value to initskript and sysconfig file -- Many thanks to Matthias Saou for valuable input - -* Mon Apr 16 2007 Ingvar Hagelund - 1.0.3-5 -- Added the dist tag -- Exchanged RPM_BUILD_ROOT variable for buildroot macro -- Removed stripping of binaries to create a meaningful debug package -- Removed BuildRoot and URL from subpackages, they are picked from the - main package -- Removed duplication of documentation files in the subpackages -- 'chkconfig --list' removed from post script -- Package now includes _sysconfdir/varnish/ -- Trimmed package information -- Removed static libs and .so-symlinks. They can be added to a -devel package - later if anybody misses them - -* Wed Feb 28 2007 Ingvar Hagelund - 1.0.3-4 -- More small specfile fixes for Fedora Extras Package - Review Request, see bugzilla ticket 230275 -- Removed rpath (only visible on x86_64 and probably ppc64) - -* Tue Feb 27 2007 Ingvar Hagelund - 1.0.3-3 -- Made post-1.0.3 changes into a patch to the upstream tarball -- First Fedora Extras Package Review Request - -* Fri Feb 23 2007 Ingvar Hagelund - 1.0.3-2 -- A few other small changes to make rpmlint happy - -* Thu Feb 22 2007 Ingvar Hagelund - 1.0.3-1 -- New release 1.0.3. See the general ChangeLog -- Splitted the package into varnish, libvarnish1 and - libvarnish1-devel - -* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-7 -- Added a Vendor tag - -* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-6 -- Added redhat subdir to svn -- Removed default vcl config file. Used the new upstream variant instead. -- Based build on svn. Running autogen.sh as start of build. Also added - libtool, autoconf and automake to BuildRequires. -- Removed rule to move varnishd to sbin. This is now fixed in upstream -- Changed the sysconfig script to include a lot more nice features. - Most of these were ripped from the Debian package. Updated initscript - to reflect this. - -* Tue Oct 10 2006 Ingvar Hagelund - 1.0.1-3 -- Moved Red Hat specific files to its own subdirectory - -* Tue Sep 26 2006 Ingvar Hagelund - 1.0.1-2 -- Added gcc requirement. -- Changed to an even simpler example vcl in to /etc/varnish (thanks, perbu) -- Added a sysconfig entry - -* Fri Sep 22 2006 Ingvar Hagelund - 1.0.1-1 -- Initial build. diff --git a/redhat/varnish.sysconfig b/redhat/varnish.sysconfig deleted file mode 100644 index 6aa2354..0000000 --- a/redhat/varnish.sysconfig +++ /dev/null @@ -1,111 +0,0 @@ -# Configuration file for varnish -# -# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this -# shell script fragment. -# - -# Maximum number of open files (for ulimit -n) -NFILES=131072 - -# Locked shared memory (for ulimit -l) -# Default log size is 82MB + header -MEMLOCK=82000 - -# Maximum number of threads (for ulimit -u) -NPROCS="unlimited" - -# Maximum size of corefile (for ulimit -c). Default in Fedora is 0 -# DAEMON_COREFILE_LIMIT="unlimited" - -# Set this to 1 to make init script reload try to switch vcl without restart. -# To make this work, you need to set the following variables -# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS, -# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short, -# use Alternative 3, Advanced configuration, below -RELOAD_VCL=1 - -# This file contains 4 alternatives, please use only one. - -## Alternative 1, Minimal configuration, no VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# content server on localhost:8080. Use a fixed-size cache file. -# -#DAEMON_OPTS="-a :6081 \ -# -T localhost:6082 \ -# -b localhost:8080 \ -# -u varnish -g varnish \ -# -s file,/var/lib/varnish/varnish_storage.bin,1G" - - -## Alternative 2, Configuration with VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# one content server selected by the vcl file, based on the request. Use a -# fixed-size cache file. -# -#DAEMON_OPTS="-a :6081 \ -# -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" - - -## Alternative 3, Advanced configuration -# -# See varnishd(1) for more information. -# -# # Main configuration file. You probably want to change it :) -VARNISH_VCL_CONF=/etc/varnish/default.vcl -# -# # Default address and port to bind to -# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify -# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. -# VARNISH_LISTEN_ADDRESS= -VARNISH_LISTEN_PORT=6081 -# -# # Telnet admin interface listen address and port -VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -VARNISH_ADMIN_LISTEN_PORT=6082 -# -# # Shared secret file for admin interface -VARNISH_SECRET_FILE=/etc/varnish/secret -# -# # The minimum number of worker threads to start -VARNISH_MIN_THREADS=50 -# -# # The Maximum number of worker threads to start -VARNISH_MAX_THREADS=1000 -# -# # Idle timeout for worker threads -VARNISH_THREAD_TIMEOUT=120 -# -# # Cache file size: in bytes, optionally using k / M / G / T suffix, -# # or in percentage of available disk space using the % suffix. -VARNISH_STORAGE_SIZE=256M -# -# # Backend storage specification -VARNISH_STORAGE="malloc,${VARNISH_STORAGE_SIZE}" -# -# # Default TTL used when the backend does not specify one -VARNISH_TTL=120 -# -# # DAEMON_OPTS is used by the init script. If you add or remove options, make -# # sure you update this section, too. -DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ - -f ${VARNISH_VCL_CONF} \ - -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ - -t ${VARNISH_TTL} \ - -p thread_pool_min=${VARNISH_MIN_THREADS} \ - -p thread_pool_max=${VARNISH_MAX_THREADS} \ - -p thread_pool_timeout=${VARNISH_THREAD_TIMEOUT} \ - -u varnish -g varnish \ - -S ${VARNISH_SECRET_FILE} \ - -s ${VARNISH_STORAGE}" -# - - -## Alternative 4, Do It Yourself. See varnishd(1) for more information. -# -# DAEMON_OPTS="" diff --git a/redhat/varnish_reload_vcl b/redhat/varnish_reload_vcl deleted file mode 100755 index 2f47f3e..0000000 --- a/redhat/varnish_reload_vcl +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# reload vcl revisited -# A script that loads new vcl based on data from /etc/sysconfig/varnish -# Ingvar Hagelund -# -# This is free software, distributed under the standard 2 clause BSD license, -# see the LICENSE file in the Varnish documentation directory -# -# The following environment variables have to be set: -# RELOAD_VCL, VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_PORT -# The following are optional: -# VARNISH_SECRET_FILE, VARNISH_ADMIN_LISTEN_ADDRESS -# -# Requires GNU bash and GNU date -# - -debug=false - -missing() { - echo "Missing configuration variable: $1" - exit 2 -} - -print_debug() { - echo " -Parsed configuration: -RELOAD_VCL=\"$RELOAD_VCL\" -VARNISH_VCL_CONF=\"$VARNISH_VCL_CONF\" -VARNISH_ADMIN_LISTEN_ADDRESS=\"$VARNISH_ADMIN_LISTEN_ADDRESS\" -VARNISH_ADMIN_LISTEN_PORT=\"$VARNISH_ADMIN_LISTEN_PORT\" -VARNISH_SECRET_FILE=\"$VARNISH_SECRET_FILE\" -" -} - -# Fallback to the default configuration -if [ -z "$VARNISH_VCL_CONF" ]; then - . /etc/sysconfig/varnish -fi - -$debug && print_debug - -# Check configuration -if [ ! "$RELOAD_VCL" = "1" ]; then - echo "Error: RELOAD_VCL is not set to 1" - exit 2 - -elif [ -z "$VARNISH_VCL_CONF" ]; then - echo "Error: VARNISH_VCL_CONF is not set" - exit 2 - -elif [ ! -s "$VARNISH_VCL_CONF" ]; then - echo "Eror: VCL config $VARNISH_VCL_CONF is unreadable or empty" - exit 2 - -elif [ -z "$VARNISH_ADMIN_LISTEN_ADDRESS" ]; then - echo "Warning: VARNISH_ADMIN_LISTEN_ADDRESS is not set, using 127.0.0.1" - VARNISH_ADMIN_LISTEN_ADDRESS="127.0.0.1" - -elif [ -z "$VARNISH_ADMIN_LISTEN_PORT" ]; then - echo "Error: VARNISH_ADMIN_LISTEN_PORT is not set" - exit 2 - -elif [ -z "$VARNISH_SECRET_FILE" ]; then - echo "Warning: VARNISH_SECRET_FILE is not set" - secret="" - -elif [ ! -s "$VARNISH_SECRET_FILE" ]; then - echo "Error: varnish secret file $VARNISH_SECRET_FILE is unreadable or empty" - exit 2 -else - secret="-S $VARNISH_SECRET_FILE" -fi - -# Done parsing, set up command -VARNISHADM="varnishadm $secret -T $VARNISH_ADMIN_LISTEN_ADDRESS:$VARNISH_ADMIN_LISTEN_PORT" - -# Now do the real work -new_config="reload_$(date +%FT%H:%M:%S)" - -# Check if we are able to connect at all -if $VARNISHADM vcl.list > /dev/null; then - $debug && echo vcl.list succeeded -else - echo "Unable to run $VARNISHADM vcl.list" - exit 1 -fi - -if $VARNISHADM vcl.list | awk ' { print $3 } ' | grep -q $new_config; then - echo Trying to use new config $new_config, but that is already in use - exit 2 -fi - -current_config=$( $VARNISHADM vcl.list | awk ' /^active/ { print $3 } ' ) - -echo "Loading vcl from $VARNISH_VCL_CONF" -echo "Current running config name is $current_config" -echo "Using new config name $new_config" - -if $VARNISHADM vcl.load $new_config $VARNISH_VCL_CONF; then - $debug && echo "$VARNISHADM vcl.load succeded" -else - echo "$VARNISHADM vcl.load failed" - exit 1 -fi - -if $VARNISHADM vcl.use $new_config; then - $debug && echo "$VARNISHADM vcl.use succeded" -else - echo "$VARNISHADM vcl.use failed" - exit 1 -fi -$VARNISHADM vcl.list -echo Done -exit 0 - diff --git a/redhat/varnishlog.initrc b/redhat/varnishlog.initrc deleted file mode 100644 index 2b5fc51..0000000 --- a/redhat/varnishlog.initrc +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -# -# varnishlog Control the Varnish logging daemon -# -# chkconfig: - 90 10 -# description: Varnish Cache logging daemon -# processname: varnishlog -# config: -# pidfile: /var/run/varnishlog.pid - -### BEGIN INIT INFO -# Provides: varnishlog -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Short-Description: start and stop varnishlog -# Description: Varnish Cache logging daemon -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile="/var/run/varnishlog.pid" -lockfile="/var/lock/subsys/varnishlog" -logfile="/var/log/varnish/varnish.log" - -exec="/usr/bin/varnishlog" -prog="varnishlog" - -DAEMON_OPTS="-a -w $logfile -D -P $pidfile" - -# Include varnishlog defaults -[ -e /etc/sysconfig/varnishlog ] && . /etc/sysconfig/varnishlog - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - echo -n "Starting varnish logging daemon: " - - daemon --pidfile $pidfile $exec "$DAEMON_OPTS" - echo - return $retval -} - -stop() { - echo -n "Stopping varnish logging daemon: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnishlog.service b/redhat/varnishlog.service deleted file mode 100644 index c7a0193..0000000 --- a/redhat/varnishlog.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Varnish HTTP accelerator logging daemon -After=varnish.service - -[Service] -Type=forking -PIDFile=/run/varnishlog.pid -ExecStart=/usr/bin/varnishlog -a -w /var/log/varnish/varnish.log -D -P /run/varnishlog.pid - -[Install] -WantedBy=multi-user.target diff --git a/redhat/varnishncsa.initrc b/redhat/varnishncsa.initrc deleted file mode 100644 index b23fa48..0000000 --- a/redhat/varnishncsa.initrc +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -# -# varnishncsa Control the Varnish NCSA logging daemon -# -# chkconfig: - 90 10 -# description: Varnish Cache logging daemon -# processname: varnishncsa -# config: -# pidfile: /var/run/varnishncsa.pid - -### BEGIN INIT INFO -# Provides: varnishncsa -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Short-Description: start and stop varnishncsa -# Description: Varnish Cache NCSA logging daemon -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile="/var/run/varnishncsa.pid" -lockfile="/var/lock/subsys/varnishncsa" -logfile="/var/log/varnish/varnishncsa.log" - -exec="/usr/bin/varnishncsa" -prog="varnishncsa" - -DAEMON_OPTS="-a -w $logfile -D -P $pidfile" - -# Include varnishncsa defaults -[ -e /etc/sysconfig/varnishncsa ] && . /etc/sysconfig/varnishncsa - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - echo -n "Starting varnish ncsa logging daemon: " - - daemon --pidfile $pidfile $exec "$DAEMON_OPTS" - echo - return $retval -} - -stop() { - echo -n "Stopping varnish ncsa logging daemon: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnishncsa.service b/redhat/varnishncsa.service deleted file mode 100644 index e2ebdcd..0000000 --- a/redhat/varnishncsa.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Varnish HTTP accelerator NCSA daemon -After=varnish.service - -[Service] -Type=forking -PIDFile=/run/varnishncsa.pid -ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa.pid - -[Install] -WantedBy=multi-user.target From lkarsten at varnish-software.com Fri Sep 4 09:59:29 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 11:59:29 +0200 Subject: [master] 7ba6b84 Remove last traces of redhat packaging files. Message-ID: commit 7ba6b842ee813ad738c9231414d727b2f959a6bc Author: Lasse Karstensen Date: Fri Sep 4 11:59:05 2015 +0200 Remove last traces of redhat packaging files. diff --git a/Makefile.am b/Makefile.am index 7624ec5..e49505f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include lib bin etc doc man redhat +SUBDIRS = include lib bin etc doc man pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc @@ -20,15 +20,6 @@ DISTCHECK_CONFIGURE_FLAGS = \ install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish -distcheck-hook: - V="@PACKAGE_VERSION@" ; \ - V="$${V%%-*}" ; \ - if ! grep "^Version: $$V$$" $(top_distdir)/redhat/varnish.spec && \ - [ "@PACKAGE_VERSION@" != "trunk" ]; then \ - echo "$$V" ; \ - echo "redhat/varnish.spec does not have a version number matching the package" ; \ - exit 1 ; \ - fi distcleancheck_listfiles = \ find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \ diff --git a/configure.ac b/configure.ac index 6c4d5f2..48af690 100644 --- a/configure.ac +++ b/configure.ac @@ -658,7 +658,6 @@ AC_CONFIG_FILES([ lib/libvmod_std/Makefile lib/libvmod_directors/Makefile man/Makefile - redhat/Makefile varnishapi.pc varnishapi-uninstalled.pc ]) From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 0fe9fb9 Clarifying comments, and move a function call to a more natural location. Message-ID: commit 0fe9fb938a8bfb54f7814f91cb2e74d2176d8862 Author: Poul-Henning Kamp Date: Tue Jul 7 20:41:40 2015 +0000 Clarifying comments, and move a function call to a more natural location. diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index e7301ac..b05acea 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -51,7 +51,7 @@ static VTAILQ_HEAD(, backend) backends = VTAILQ_HEAD_INITIALIZER(backends); static struct lock backends_mtx; /*-------------------------------------------------------------------- - * Create/Delete a new director::backend instance. + * Create a new static or dynamic director::backend instance. */ struct director * @@ -117,6 +117,11 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) return (b->director); } +/*-------------------------------------------------------------------- + * Delete a dynamic director::backend instance. Undeleted dynamic and + * static instances are GC'ed when the VCL is discarded (in cache_vcl.c) + */ + void VRT_delete_backend(VRT_CTX, struct director **dp) { @@ -130,6 +135,7 @@ VRT_delete_backend(VRT_CTX, struct director **dp) CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC); VCL_DelBackend(ctx->vcl, be); + VBE_Delete(be); } /*--------------------------------------------------------------------- diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 7d87cb0..3ab89ff 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -210,7 +210,6 @@ VCL_DelBackend(struct vcl *vcl, struct backend *be) Lck_Lock(&vcl_mtx); VTAILQ_REMOVE(&vcl->backend_list, be, vcl_list); Lck_Unlock(&vcl_mtx); - VBE_Delete(be); } static void From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 9a08b88 Convert the admin_health enum to a "const char* enum" to reduce conversions between enum and text. Message-ID: commit 9a08b88ff55714a3fda4bc8b86b17608bab2d625 Author: Poul-Henning Kamp Date: Tue Jul 7 21:04:13 2015 +0000 Convert the admin_health enum to a "const char* enum" to reduce conversions between enum and text. diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index bd8a8c5..79c4ae2 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -66,10 +66,10 @@ VBE_Healthy(const struct backend *backend, double *changed) if (changed != NULL) *changed = backend->health_changed; - if (backend->admin_health == ah_probe && !backend->healthy) + if (backend->admin_health == vbe_ah_probe && !backend->healthy) return (0); - if (backend->admin_health == ah_sick) + if (backend->admin_health == vbe_ah_sick) return (0); return (1); @@ -346,16 +346,8 @@ vbe_panic(const struct director *d, struct vsb *vsb) VSB_printf(vsb, " ipv6 = %s\n", bp->ipv6_addr); VSB_printf(vsb, " port = %s\n", bp->port); VSB_printf(vsb, " hosthdr = %s\n", bp->hosthdr); - VSB_printf(vsb, " health=%s, admin_health=", - bp->healthy ? "healthy" : "sick"); - if (bp->admin_health == ah_probe) - VSB_printf(vsb, "probe"); - else if (bp->admin_health == ah_sick) - VSB_printf(vsb, "sick"); - else if (bp->admin_health == ah_healthy) - VSB_printf(vsb, "healthy"); - else - VSB_printf(vsb, "*invalid*"); + VSB_printf(vsb, " health=%s, admin_health=%s", + bp->healthy ? "healthy" : "sick", bp->admin_health); VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed); } diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index cc27de6..9443ac2 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -46,12 +46,9 @@ struct tcp_pool; * An instance of a backend from a VCL program. */ -enum admin_health { - ah_invalid = 0, - ah_healthy, - ah_sick, - ah_probe -}; +extern const char * const vbe_ah_healthy; +extern const char * const vbe_ah_sick; +extern const char * const vbe_ah_probe; struct backend { unsigned magic; @@ -71,7 +68,7 @@ struct backend { struct vbp_target *probe; unsigned healthy; - enum admin_health admin_health; + const char *admin_health; double health_changed; struct VSC_C_vbe *vsc; diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index b05acea..a22af3c 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -50,6 +50,10 @@ static VTAILQ_HEAD(, backend) backends = VTAILQ_HEAD_INITIALIZER(backends); static struct lock backends_mtx; +const char * const vbe_ah_healthy = "healthy"; +const char * const vbe_ah_sick = "sick"; +const char * const vbe_ah_probe = "probe"; + /*-------------------------------------------------------------------- * Create a new static or dynamic director::backend instance. */ @@ -91,7 +95,7 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) b->healthy = 1; b->health_changed = VTIM_real(); - b->admin_health = ah_probe; + b->admin_health = vbe_ah_probe; vbp = vrt->probe; if (vbp == NULL) @@ -196,17 +200,17 @@ VBE_Delete(struct backend *be) * String to admin_health */ -static enum admin_health +static const char * vbe_str2adminhealth(const char *wstate) { - if (strcasecmp(wstate, "healthy") == 0) - return (ah_healthy); - if (strcasecmp(wstate, "sick") == 0) - return (ah_sick); - if (strcmp(wstate, "auto") == 0) - return (ah_probe); - return (ah_invalid); +#define FOO(x, y) if (strcasecmp(wstate, #x) == 0) return (vbe_ah_##y) + FOO(healthy, healthy); + FOO(sick, sick); + FOO(probe, probe); + FOO(auto, probe); + return (NULL); +#undef FOO } /*--------------------------------------------------------------------- @@ -275,14 +279,7 @@ do_list(struct cli *cli, struct backend *b, void *priv) VCLI_Out(cli, "\n%-30s", b->display_name); - if (b->admin_health == ah_probe) - VCLI_Out(cli, " %-10s", "probe"); - else if (b->admin_health == ah_sick) - VCLI_Out(cli, " %-10s", "sick"); - else if (b->admin_health == ah_healthy) - VCLI_Out(cli, " %-10s", "healthy"); - else - VCLI_Out(cli, " %-10s", "invalid"); + VCLI_Out(cli, " %-10s", b->admin_health); if (b->probe == NULL) VCLI_Out(cli, " %s", "Healthy (no probe)"); @@ -327,14 +324,16 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv) static int __match_proto__() do_set_health(struct cli *cli, struct backend *b, void *priv) { - enum admin_health state; + const char **ah; unsigned prev; (void)cli; - state = *(enum admin_health*)priv; + AN(priv); + ah = priv; + AN(*ah); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); prev = VBE_Healthy(b, NULL); - b->admin_health = state; + b->admin_health = *ah; if (prev != VBE_Healthy(b, NULL)) b->health_changed = VTIM_real(); @@ -344,7 +343,7 @@ do_set_health(struct cli *cli, struct backend *b, void *priv) static void cli_backend_set_health(struct cli *cli, const char * const *av, void *priv) { - enum admin_health state; + const char *ah; int n; (void)av; @@ -352,13 +351,13 @@ cli_backend_set_health(struct cli *cli, const char * const *av, void *priv) ASSERT_CLI(); AN(av[2]); AN(av[3]); - state = vbe_str2adminhealth(av[3]); - if (state == ah_invalid) { + ah = vbe_str2adminhealth(av[3]); + if (ah == NULL) { VCLI_Out(cli, "Invalid state %s", av[3]); VCLI_SetResult(cli, CLIS_PARAM); return; } - n = backend_find(cli, av[2], do_set_health, &state); + n = backend_find(cli, av[2], do_set_health, &ah); if (n == 0) { VCLI_Out(cli, "No Backends matches"); VCLI_SetResult(cli, CLIS_PARAM); From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 4c7c283 Polish admin_health stuff a little bit Message-ID: commit 4c7c28382d01efb27455fd85ca7dadd2dea26a13 Author: Poul-Henning Kamp Date: Tue Jul 7 21:17:26 2015 +0000 Polish admin_health stuff a little bit diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 522fad2..0cfbd40 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -1053,7 +1053,7 @@ void VCL_Ref(struct vcl *); void VCL_Refresh(struct vcl **); void VCL_Rel(struct vcl **); void VCL_AddBackend(struct vcl *, struct backend *); -void VCL_DelBackend(struct vcl *, struct backend *); +void VCL_DelBackend(struct vcl *, const struct backend *); const char *VCL_Return_Name(unsigned); #define VCL_MET_MAC(l,u,b) \ diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 79c4ae2..bf7b537 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -55,27 +55,6 @@ } while (0) /*-------------------------------------------------------------------- - * Test if backend is healthy and report when it last changed - */ - -unsigned -VBE_Healthy(const struct backend *backend, double *changed) -{ - CHECK_OBJ_NOTNULL(backend, BACKEND_MAGIC); - - if (changed != NULL) - *changed = backend->health_changed; - - if (backend->admin_health == vbe_ah_probe && !backend->healthy) - return (0); - - if (backend->admin_health == vbe_ah_sick) - return (0); - - return (1); -} - -/*-------------------------------------------------------------------- * Get a connection to the backend */ diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index 9443ac2..06f50e1 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -46,10 +46,6 @@ struct tcp_pool; * An instance of a backend from a VCL program. */ -extern const char * const vbe_ah_healthy; -extern const char * const vbe_ah_sick; -extern const char * const vbe_ah_probe; - struct backend { unsigned magic; #define BACKEND_MAGIC 0x64c4c7c6 diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index a22af3c..aba8e8b 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -50,9 +50,9 @@ static VTAILQ_HEAD(, backend) backends = VTAILQ_HEAD_INITIALIZER(backends); static struct lock backends_mtx; -const char * const vbe_ah_healthy = "healthy"; -const char * const vbe_ah_sick = "sick"; -const char * const vbe_ah_probe = "probe"; +static const char * const vbe_ah_healthy = "healthy"; +static const char * const vbe_ah_sick = "sick"; +static const char * const vbe_ah_probe = "probe"; /*-------------------------------------------------------------------- * Create a new static or dynamic director::backend instance. @@ -205,7 +205,7 @@ vbe_str2adminhealth(const char *wstate) { #define FOO(x, y) if (strcasecmp(wstate, #x) == 0) return (vbe_ah_##y) - FOO(healthy, healthy); + FOO(healthy, healthy); FOO(sick, sick); FOO(probe, probe); FOO(auto, probe); @@ -213,6 +213,30 @@ vbe_str2adminhealth(const char *wstate) #undef FOO } +/*-------------------------------------------------------------------- + * Test if backend is healthy and report when it last changed + */ + +unsigned +VBE_Healthy(const struct backend *backend, double *changed) +{ + CHECK_OBJ_NOTNULL(backend, BACKEND_MAGIC); + + if (changed != NULL) + *changed = backend->health_changed; + + if (backend->admin_health == vbe_ah_probe) + return (backend->healthy); + + if (backend->admin_health == vbe_ah_sick) + return (0); + + if (backend->admin_health == vbe_ah_healthy) + return (1); + + WRONG("Wrong admin health"); +} + /*--------------------------------------------------------------------- * A general function for finding backends and doing things with them. * diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 3ab89ff..0a5eac9 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -203,7 +203,7 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be) } void -VCL_DelBackend(struct vcl *vcl, struct backend *be) +VCL_DelBackend(struct vcl *vcl, const struct backend *be) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 09b01e7 Count the backend n_conn down when fd's are returned. Message-ID: commit 09b01e7d747e60d06845cf2ea57cd0b506098f49 Author: Poul-Henning Kamp Date: Tue Jul 7 21:44:55 2015 +0000 Count the backend n_conn down when fd's are returned. diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index bf7b537..29f22f7 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -165,6 +165,8 @@ vbe_dir_finish(const struct director *d, struct worker *wrk, VSC_C_main->backend_recycle++; VBT_Recycle(wrk, bp->tcp_pool, &vbc); } + assert(bp->n_conn > 0); + bp->n_conn--; #define ACCT(foo) bp->vsc->foo += bo->acct.foo; #include "tbl/acct_fields_bereq.h" #undef ACCT From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 2899efd Relive the VMODs of the responsibility of tracking dynamic backends connection count. Message-ID: commit 2899efd1055dab6b8ba47caace51e580ae3b56cd Author: Poul-Henning Kamp Date: Tue Jul 7 22:43:35 2015 +0000 Relive the VMODs of the responsibility of tracking dynamic backends connection count. Instead we mark the dynamic backends unhealthy with the status "deleted", hide it from CLI displays, prevent new connections from being opened and clean the backend up when the connection count goes to zero. Radically different from patch from: Dridi diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 0cfbd40..6574278 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -675,6 +675,7 @@ void VCA_Shutdown(void); /* cache_backend_cfg.c */ void VBE_InitCfg(void); +void VBE_Poll(void); /* cache_backend_poll.c */ void VBP_Init(void); @@ -1052,8 +1053,6 @@ void VCL_Poll(void); void VCL_Ref(struct vcl *); void VCL_Refresh(struct vcl **); void VCL_Rel(struct vcl **); -void VCL_AddBackend(struct vcl *, struct backend *); -void VCL_DelBackend(struct vcl *, const struct backend *); const char *VCL_Return_Name(unsigned); #define VCL_MET_MAC(l,u,b) \ diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index 06f50e1..97e70c1 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -57,7 +57,7 @@ struct backend { VRT_BACKEND_FIELDS() - const struct vcl *vcl; + struct vcl *vcl; char *display_name; unsigned n_conn; @@ -109,13 +109,14 @@ void VBE_Event(struct backend *, enum vcl_event_e); #endif void VBE_Delete(struct backend *be); -/* cache_backend_poll.c */ +/* cache_backend_probe.c */ void VBP_Insert(struct backend *b, struct vrt_backend_probe const *p, struct tcp_pool *); void VBP_Remove(struct backend *b); void VBP_Control(const struct backend *b, int stop); void VBP_Status(struct cli *cli, const struct backend *, int details); +/* cache_backend_tcp.c */ struct tcp_pool *VBT_Ref(const struct suckaddr *ip4, const struct suckaddr *ip6); void VBT_Rel(struct tcp_pool **tpp); @@ -125,3 +126,7 @@ void VBT_Close(struct tcp_pool *tp, struct vbc **vbc); struct vbc *VBT_Get(struct tcp_pool *, double tmo, const struct backend *, struct worker *); void VBT_Wait(struct worker *, struct vbc *); + +/* cache_vcl.c */ +void VCL_AddBackend(struct vcl *, struct backend *); +void VCL_DelBackend(const struct backend *); diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index aba8e8b..23d0d44 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -53,6 +53,7 @@ static struct lock backends_mtx; static const char * const vbe_ah_healthy = "healthy"; static const char * const vbe_ah_sick = "sick"; static const char * const vbe_ah_probe = "probe"; +static const char * const vbe_ah_deleted = "deleted"; /*-------------------------------------------------------------------- * Create a new static or dynamic director::backend instance. @@ -131,6 +132,7 @@ VRT_delete_backend(VRT_CTX, struct director **dp) { struct director *d; struct backend *be; + int r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(dp); @@ -138,8 +140,20 @@ VRT_delete_backend(VRT_CTX, struct director **dp) *dp = NULL; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(be, d->priv, BACKEND_MAGIC); - VCL_DelBackend(ctx->vcl, be); - VBE_Delete(be); + Lck_Lock(&be->mtx); + be->admin_health = vbe_ah_deleted; + be->health_changed = VTIM_real(); + r = be->n_conn; + if (r > 0) { + /* move to front of list for fast access */ + VTAILQ_REMOVE(&backends, be, list); + VTAILQ_INSERT_HEAD(&backends, be, list); + } + Lck_Unlock(&be->mtx); + if (r == 0) { + VCL_DelBackend(be); + VBE_Delete(be); + } } /*--------------------------------------------------------------------- @@ -231,6 +245,9 @@ VBE_Healthy(const struct backend *backend, double *changed) if (backend->admin_health == vbe_ah_sick) return (0); + if (backend->admin_health == vbe_ah_deleted) + return (0); + if (backend->admin_health == vbe_ah_healthy) return (1); @@ -275,6 +292,8 @@ backend_find(struct cli *cli, const char *matcher, bf_func *func, void *priv) AZ(VSB_finish(vsb)); Lck_Lock(&backends_mtx); VTAILQ_FOREACH(b, &backends, list) { + if (b->admin_health == vbe_ah_deleted) + continue; if (fnmatch(VSB_data(vsb), b->display_name, 0)) continue; found++; @@ -357,7 +376,8 @@ do_set_health(struct cli *cli, struct backend *b, void *priv) AN(*ah); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); prev = VBE_Healthy(b, NULL); - b->admin_health = *ah; + if (b->admin_health != vbe_ah_deleted) + b->admin_health = *ah; if (prev != VBE_Healthy(b, NULL)) b->health_changed = VTIM_real(); @@ -404,6 +424,27 @@ static struct cli_proto backend_cmds[] = { /*---------------------------------------------------------------------*/ void +VBE_Poll(void) +{ + struct backend *be; + Lck_Lock(&backends_mtx); + while (1) { + be = VTAILQ_FIRST(&backends); + if (be == NULL) + break; + if (be->admin_health != vbe_ah_deleted) + break; + if (be->n_conn > 0) + break; + VCL_DelBackend(be); + VBE_Delete(be); + } + Lck_Unlock(&backends_mtx); +} + +/*---------------------------------------------------------------------*/ + +void VBE_InitCfg(void) { diff --git a/bin/varnishd/cache/cache_cli.c b/bin/varnishd/cache/cache_cli.c index 5fbad58..3ba8cdd 100644 --- a/bin/varnishd/cache/cache_cli.c +++ b/bin/varnishd/cache/cache_cli.c @@ -78,6 +78,7 @@ cli_cb_before(const struct cli *cli) ASSERT_CLI(); VSL(SLT_CLI, 0, "Rd %s", cli->cmd); VCL_Poll(); + VBE_Poll(); Lck_Lock(&cli_mtx); } diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 0a5eac9..b450361 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -47,6 +47,7 @@ #include "vcli.h" #include "vcli_priv.h" +static const char * const vcl_temp_init = "init"; static const char * const vcl_temp_cold = "cold"; static const char * const vcl_temp_warm = "warm"; static const char * const vcl_temp_cooling = "cooling"; @@ -199,14 +200,18 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be) if (vcl->temp == vcl_temp_warm) { /* Only when adding backend to already warm VCL */ VBE_Event(be, VCL_EVENT_WARM); - } + } else if (vcl->temp != vcl_temp_init) + WRONG("Dynamic Backends can only be added to warm VCLs"); } void -VCL_DelBackend(struct vcl *vcl, const struct backend *be) +VCL_DelBackend(const struct backend *be) { - CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); + struct vcl *vcl; + CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); + vcl = be->vcl; + CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); Lck_Lock(&vcl_mtx); VTAILQ_REMOVE(&vcl->backend_list, be, vcl_list); Lck_Unlock(&vcl_mtx); @@ -395,7 +400,7 @@ vcl_set_state(struct vcl *vcl, const char *state) } break; case '1': - if (vcl->temp != vcl_temp_cold) + if (vcl->temp == vcl_temp_cooling) vcl->temp = vcl_temp_warm; else { vcl->temp = vcl_temp_warm; @@ -440,7 +445,7 @@ VCL_Load(struct cli *cli, const char *name, const char *fn, const char *state) XXXAN(vcl->loaded_name); VTAILQ_INIT(&vcl->backend_list); - vcl->temp = vcl_temp_cold; + vcl->temp = vcl_temp_init; INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.method = VCL_MET_INIT; From phk at FreeBSD.org Fri Sep 4 13:54:49 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:49 +0200 Subject: [4.1] 35716c7 Add testcase for this ticket, the error was fixed in the previous commit. Message-ID: commit 35716c713ca505a135101e40f32670ca5671bfd1 Author: Poul-Henning Kamp Date: Tue Jul 7 22:49:22 2015 +0000 Add testcase for this ticket, the error was fixed in the previous commit. Fixes: #1755 diff --git a/bin/varnishtest/tests/r01755.vtc b/bin/varnishtest/tests/r01755.vtc new file mode 100644 index 0000000..87828a4 --- /dev/null +++ b/bin/varnishtest/tests/r01755.vtc @@ -0,0 +1,29 @@ +varnishtest "The (struct backend).n_conn counter is never decremented" + +server s1 { + rxreq + txresp + + rxreq + txresp +} -start + +varnish v1 -vcl { + backend s1 { + .host = "${s1_addr}"; + .port = "${s1_port}"; + .max_connections = 1; + } +} -start + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 + + txreq -url "/bar" + rxresp + expect resp.status == 200 +} -run + +varnish v1 -expect backend_busy == 0 From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 5781f95 Drop the backend mutex while mopping up deleted dynamic backends. Message-ID: commit 5781f95bf20fbb8bd07c9a3cf1e04b9c61e4815c Author: Poul-Henning Kamp Date: Wed Jul 8 20:15:18 2015 +0000 Drop the backend mutex while mopping up deleted dynamic backends. Spotted by: Dridi diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index 23d0d44..a9199d3 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -427,8 +427,8 @@ void VBE_Poll(void) { struct backend *be; - Lck_Lock(&backends_mtx); while (1) { + Lck_Lock(&backends_mtx); be = VTAILQ_FIRST(&backends); if (be == NULL) break; @@ -436,6 +436,7 @@ VBE_Poll(void) break; if (be->n_conn > 0) break; + Lck_Unlock(&backends_mtx); VCL_DelBackend(be); VBE_Delete(be); } From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:50 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 94a5f27 Add a debug.sleep(DURATION) synchronization helper Message-ID: commit 94a5f275aed3bfd1a49b486e76be31d4a64ac0c3 Author: Dridi Boukelmoune Date: Mon Jul 6 08:24:54 2015 +0200 Add a debug.sleep(DURATION) synchronization helper diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 67edd62..305deaa 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -105,3 +105,7 @@ Register the vmod to receive expiry callbacks $Function VOID init_fail() Function to fail vcl_init{} + +$Function VOID sleep(DURATION) + +Block the current worker thread. diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index f9f3361..ce2e22b 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -36,6 +36,7 @@ #include "vcl.h" #include "vrt.h" #include "vsb.h" +#include "vtim.h" #include "vcc_if.h" struct priv_vcl { @@ -269,3 +270,11 @@ event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) priv->free = priv_vcl_free; return (0); } + +VCL_VOID __match_proto__(td_debug_sleep) +vmod_sleep(VRT_CTX, VCL_DURATION t) +{ + + CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC); + VTIM_sleep(t); +} From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:50 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] d07f3e3 Add the refcount to a backend panic message Message-ID: commit d07f3e38abdfa3361f40e5d66c4f5ca6cc5d41ef Author: Dridi Boukelmoune Date: Mon Jul 6 08:42:21 2015 +0200 Add the refcount to a backend panic message diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 29f22f7..611c089 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -330,6 +330,7 @@ vbe_panic(const struct director *d, struct vsb *vsb) VSB_printf(vsb, " health=%s, admin_health=%s", bp->healthy ? "healthy" : "sick", bp->admin_health); VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed); + VSB_printf(vsb, " refcount = %d\n", bp->refcount); } /*--------------------------------------------------------------------*/ From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] cfa2211 Polish flexelint stuff for vmods Message-ID: commit cfa22119fa24894976911a99e75c67d9ebaa6eac Author: Poul-Henning Kamp Date: Fri Jul 10 06:44:29 2015 +0000 Polish flexelint stuff for vmods diff --git a/bin/flint.lnt b/bin/flint.lnt index 1da0545..ce30d3a 100644 --- a/bin/flint.lnt +++ b/bin/flint.lnt @@ -4,27 +4,6 @@ -printf(2, VSB_printf) - -/////////////////////////////////////////////////////////////////////// -// Weirdness relating to varnish includes etc. - --header(../../config.h) -+libh ../../config.h --efile(451, ../../config.h) // No include guard - --efile(451, "tbl/*.h") // No include guard - -/////////////////////////////////////////////////////////////////////// -// assert() support, common to libvarnish and libvarnishapi --sem(VAS_Fail, r_no) --emacro(506, assert) // constant value boolean --emacro(827, assert) // loop not reachable --emacro(774, assert) // booelan always true --emacro(731, assert) // booelan arg to eq/non-eq --emacro(731, xxxassert) // arg to eq/non-eq --emacro(527, WRONG) // unreachable code - - /////////////////////////////////////////////////////////////////////// // miniobj @@ -40,22 +19,6 @@ -emacro(755, VWMB) // glob macro not ref /////////////////////////////////////////////////////////////////////// -// VSB - --esym(759, VSB_*) // header decl could be moved --esym(765, VSB_*) // exten could be made static --esym(714, VSB_*) // symb not ref --sem(VSB_new, @p == (1p ? 1p : malloc(1))) --sem(VSB_delete, custodial(1)) - --esym(534, VSB_cat) // Ignore retval --esym(534, VSB_bcat) --esym(534, VSB_putc) --esym(534, VSB_printf) --esym(534, VSB_vprintf) --esym(534, VSB_putc) - -/////////////////////////////////////////////////////////////////////// // System library/POSIX related /////////////////////////////////////////////////////////////////////// @@ -65,19 +28,6 @@ // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) --esym(534, printf) // Ignore retval --esym(534, fprintf) --esym(534, sprintf) - --esym(534, memset) --esym(534, memcpy) --esym(534, memmove) - --esym(534, strcat) --esym(534, strcpy) --esym(534, strlcpy) --esym(534, strncpy) - +typename(844) -etype(844, struct pthread *) -sem(pthread_create, custodial(4)) diff --git a/bin/varnishd/flint.lnt b/bin/varnishd/flint.lnt index 5181c9e..70ec5b6 100644 --- a/bin/varnishd/flint.lnt +++ b/bin/varnishd/flint.lnt @@ -118,7 +118,6 @@ -e455 // thread lock -e458 // unprotected read --e763 // Redundant declaration for symbol '...' previously declared -e728 // Symbol ... not explicitly initialized -e716 // while(1) ... -e785 // Too few initializers for aggregate @@ -149,7 +148,6 @@ // cache_vcl.c -esym(528, vcl_call_method) // Not referenced -esym(528, vcl_handlingname) // Not referenced --e641 // Converting enum 'cli_status_e' to int -e441 // for clause irregularity: loop variable '___' not found in 2nd for expression diff --git a/flint.lnt b/flint.lnt index 5366617..9530745 100644 --- a/flint.lnt +++ b/flint.lnt @@ -2,8 +2,66 @@ * Toplevel control file for FlexeLint */ +/////////////////////////////////////////////////////////////////////// +// build/config related + -efile(451, "tbl/*.h") // No include guard --esym(785,VSL_tags) // Sparse array + +-efile(451, ../../config.h) // No include guard +-header(../../config.h) ++libh(../../config.h) + +/////////////////////////////////////////////////////////////////////// +// General stylistic issues +-e726 // Extraneous comma ignored +-e641 // Converting enum '...' to int +-e763 // // Redundant declaration for symbol '...' previously declared + +/////////////////////////////////////////////////////////////////////// +// Ignored return values in system libraries + +-esym(534, printf) +-esym(534, fprintf) +-esym(534, sprintf) + +-esym(534, memset) +-esym(534, memcpy) +-esym(534, memmove) + +-esym(534, strcat) +-esym(534, strcpy) +-esym(534, strlcpy) +-esym(534, strncpy) + +/////////////////////////////////////////////////////////////////////// +// + +-sem(VAS_Fail, r_no) // does not return +-emacro(506, assert) // constant value boolean +-emacro(827, assert) // loop not reachable +-emacro(774, assert) // booelan always true +-emacro(731, assert) // booelan arg to eq/non-eq +-emacro(731, xxxassert) // arg to eq/non-eq +-emacro(527, WRONG) // unreachable code + +/////////////////////////////////////////////////////////////////////// +// + +-esym(759, VSB_*) // header decl could be moved +-esym(765, VSB_*) // exten could be made static +-esym(714, VSB_*) // symb not ref +-sem(VSB_new, @p == (1p ? 1p : malloc(1))) +-sem(VSB_delete, custodial(1)) + +// ignore retval +-esym(534, VSB_cat) +-esym(534, VSB_bcat) +-esym(534, VSB_putc) +-esym(534, VSB_printf) +-esym(534, VSB_vprintf) +-esym(534, VSB_putc) + + /////////////////////////////////////////////////////////////////////// // @@ -25,3 +83,6 @@ -emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types) -emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types) +/////////////////////////////////////////////////////////////////////// + +-esym(785,VSL_tags) // Sparse array diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index a5eb8bb..ce27df2 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -217,6 +217,7 @@ class Vmod(object): vfn = 'Vmod_%s_Func' % self.nam + fo.write("/*lint -esym(754, %s::*) */\n" % vfn) fo.write("\nstatic const struct %s Vmod_Func =" % vfn) fo.write(self.c_initializer()) fo.write("\n") @@ -235,7 +236,7 @@ class Vmod(object): fo.write("\n") nm = "Vmod_" + self.nam + "_Data" - fo.write("extern const struct vmod_data " + nm + ";\n\n") + fo.write("/*lint -esym(759, %s) */\n" % nm) fo.write("const struct vmod_data " + nm + " = {\n") fo.write("\t.vrt_major = VRT_MAJOR_VERSION,\n"); fo.write("\t.vrt_minor = VRT_MINOR_VERSION,\n"); @@ -288,7 +289,8 @@ class Vmod(object): return s def c_strspec(self): - s = "static const char * const Vmod_Spec[] = {\n" + s = "/*lint -save -e786 -e840 */\n" + s += "static const char * const Vmod_Spec[] = {\n" for o in self.objs: s += o.c_strspec(self.nam) + ",\n\n" @@ -304,6 +306,7 @@ class Vmod(object): s += "\t0\n" s += "};\n" + s += "/*lint -restore */\n" return s def doc(self, l): @@ -898,8 +901,9 @@ def runmain(inputvcc, outputname="vcc_if"): write_c_file_warning(fc) write_c_file_warning(fh) - fh.write('struct vmod_priv;\n') - fh.write("\n") + fh.write('struct vmod_priv;\n\n') + + fh.write('extern const struct vmod_data Vmod_%s_Data;\n\n' % vx[0].nam) vx[0].c_proto(fh) diff --git a/lib/libvmod_debug/flint.sh b/lib/libvmod_debug/flint.sh new file mode 100755 index 0000000..b4bc3e7 --- /dev/null +++ b/lib/libvmod_debug/flint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +flexelint \ + -u \ + ../../flint.lnt \ + -I. \ + -I../.. \ + -I../../include \ + -I../../bin/varnishd \ + *.c diff --git a/lib/libvmod_std/flint.sh b/lib/libvmod_std/flint.sh new file mode 100755 index 0000000..b4bc3e7 --- /dev/null +++ b/lib/libvmod_std/flint.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +flexelint \ + -u \ + ../../flint.lnt \ + -I. \ + -I../.. \ + -I../../include \ + -I../../bin/varnishd \ + *.c From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 10c54c3 More FlexeLint polishing Message-ID: commit 10c54c3ce8e4e961614f9c1e5667607f41601644 Author: Poul-Henning Kamp Date: Fri Jul 10 07:07:58 2015 +0000 More FlexeLint polishing diff --git a/bin/flint.lnt b/bin/flint.lnt index ce30d3a..0bc6639 100644 --- a/bin/flint.lnt +++ b/bin/flint.lnt @@ -22,9 +22,6 @@ // System library/POSIX related /////////////////////////////////////////////////////////////////////// -// vararg simulation is imperfect (XXX: why ??) --emacro((???), va_arg) // 415, 416, 416, 661, 662, 796, 797 ... - // Fix strchr() semtics, it can only return NULL if arg2 != 0 -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) diff --git a/bin/varnishd/flint.lnt b/bin/varnishd/flint.lnt index 70ec5b6..5904b1e 100644 --- a/bin/varnishd/flint.lnt +++ b/bin/varnishd/flint.lnt @@ -63,11 +63,9 @@ //-sem (pthread_mutex_lock, thread_lock) -sem (pthread_mutex_trylock, thread_lock) -sem (VBE_DropRefLocked, thread_unlock) --e459 // unlocked access from func-ptr -e454 // mutex not released (...ReleaseLocked) -e457 // unprotected access -e777 // float equality comparison --e679 // Suspicious Truncation in arithmetic expression combining with pointer -esym(458, params) // unlocked access @@ -133,7 +131,6 @@ -emacro(506, isnan, isfinite) // constant value boolean -emacro(736, isfinite) // loss of precision --emacro(747, isnan) // significant coersion -emacro(774, HTTPH) // always false -emacro(527, ARGV_ERR) // unreachable @@ -153,12 +150,9 @@ // Review all below this line /////////////////////////////////////////////// --e732 // 183 Loss of sign (___) (___ to ___) -e737 // 143 Loss of sign in promotion from ___ to ___ -e713 // 42 Loss of precision (___) (___ to ___) -e574 // 48 Signed-unsigned mix with relational --e712 // 96 Loss of precision (___) (___ to ___) --e747 // 297 Significant prototype coercion (___) ___ to ___ -e840 // Use of nul character in a string literal (see: vcc_if.c) -e663 // Suspicious array to pointer conversion -e778 // Constant expression evaluates to 0 in operation '___' diff --git a/flint.lnt b/flint.lnt index 9530745..000968a 100644 --- a/flint.lnt +++ b/flint.lnt @@ -15,11 +15,16 @@ // General stylistic issues -e726 // Extraneous comma ignored -e641 // Converting enum '...' to int --e763 // // Redundant declaration for symbol '...' previously declared +-e763 // Redundant declaration for symbol '...' previously declared + +// +e958 // padding /////////////////////////////////////////////////////////////////////// -// Ignored return values in system libraries +// System/Posix/Iso-C library related + +-emacro(747, isnan) // significant coersion +// ignore retval -esym(534, printf) -esym(534, fprintf) -esym(534, sprintf) @@ -86,3 +91,13 @@ /////////////////////////////////////////////////////////////////////// -esym(785,VSL_tags) // Sparse array + +/////////////////////////////////////////////////////////////////////// +// Noise reduction, review periodically + +-e459 // unlocked access from func-ptr +-e679 // Suspicious Truncation in arithmetic expression combining with pointer +-e712 // Loss of precision (___) (___ to ___) +-e732 // Loss of sign (___) (___ to ___) +-e747 // Significant prototype coercion (___) ___ to ___ + From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] bc48754 Improve some struct packings Message-ID: commit bc487541f53f09e63235986de44a67300ff550f6 Author: Poul-Henning Kamp Date: Fri Jul 10 07:33:19 2015 +0000 Improve some struct packings diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 6574278..2df4481 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -227,13 +227,13 @@ struct http_conn { enum sess_close doclose; unsigned maxbytes; unsigned maxhdr; + enum body_status body_status; struct ws *ws; char *rxbuf_b; char *rxbuf_e; char *pipeline_b; char *pipeline_e; ssize_t content_length; - enum body_status body_status; struct vfp_ctx vfc[1]; void *priv; @@ -518,6 +518,9 @@ struct req { unsigned magic; #define REQ_MAGIC 0x2751aaa1 + enum req_step req_step; + volatile enum req_body_state_e req_body_status; + enum sess_close doclose; int restarts; int esi_level; struct req *top; /* esi_level == 0 request */ @@ -526,6 +529,9 @@ struct req { #include "tbl/req_flags.h" #undef REQ_FLAG + uint16_t err_code; + const char *err_reason; + struct sess *sp; struct worker *wrk; struct pool_task task; @@ -533,10 +539,8 @@ struct req { const struct transport *transport; void *transport_priv; - enum req_step req_step; VTAILQ_ENTRY(req) w_list; - volatile enum req_body_state_e req_body_status; struct objcore *body_oc; /* The busy objhead we sleep on */ @@ -549,14 +553,10 @@ struct req { uint8_t digest[DIGEST_LEN]; - enum sess_close doclose; double d_ttl; ssize_t req_bodybytes; /* Parsed req bodybytes */ - uint16_t err_code; - const char *err_reason; - const struct director *director_hint; struct vcl *vcl; @@ -582,6 +582,11 @@ struct req { struct objcore *objcore; struct objcore *stale_oc; + /* Deliver pipeline */ + struct vdp_entry_s vdp; + struct vdp_entry *vdp_nxt; + unsigned vdp_errval; + /* Delivery mode */ unsigned res_mode; #define RES_LEN (1<<1) @@ -592,11 +597,6 @@ struct req { #define RES_GUNZIP (1<<6) #define RES_PIPE (1<<7) - /* Deliver pipeline */ - struct vdp_entry_s vdp; - struct vdp_entry *vdp_nxt; - unsigned vdp_errval; - /* Transaction VSL buffer */ struct vsl_log vsl[1]; diff --git a/include/vsb.h b/include/vsb.h index 4b0099f..72a2a99 100644 --- a/include/vsb.h +++ b/include/vsb.h @@ -37,8 +37,8 @@ struct vsb { unsigned magic; #define VSB_MAGIC 0x4a82dd8a - char *s_buf; /* storage buffer */ int s_error; /* current error code */ + char *s_buf; /* storage buffer */ ssize_t s_size; /* size of storage buffer */ ssize_t s_len; /* current length of string */ #define VSB_FIXEDLEN 0x00000000 /* fixed length buffer (default) */ From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:50 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 7fd5d87 Typo Message-ID: commit 7fd5d87f5de0faec5cc3ec6afb1f3e926d61357f Author: Dridi Boukelmoune Date: Fri Jul 10 17:56:51 2015 +0200 Typo diff --git a/bin/varnishtest/witness.py b/bin/varnishtest/witness.py index 081429e..6723ef0 100644 --- a/bin/varnishtest/witness.py +++ b/bin/varnishtest/witness.py @@ -12,7 +12,7 @@ from __future__ import print_function d = dict() a = dict() -fi = open("_w") +fi = open("_.w") fo = open("/tmp/_.dot", "w") fo.write('''digraph { From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:50 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 5ec70b3 Mention the witness facility in varnishtest(1) Message-ID: commit 5ec70b34f39a2d682b2b16ac0b2f7f5a29faa071 Author: Dridi Boukelmoune Date: Fri Jul 10 18:04:19 2015 +0200 Mention the witness facility in varnishtest(1) diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index f75a621..14c4ee4 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -50,6 +50,8 @@ The following options are available: -v Verbose mode: always report test log +-W Enable the witness facility for locking + -h Show help file File to use as a script From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] c66fc9f Drop x- prefix following RFC6648 Message-ID: commit c66fc9f3066dff1106d8d58cb5b3a189d9b6a1c7 Author: Federico G. Schwindt Date: Fri Jul 10 17:17:04 2015 +0100 Drop x- prefix following RFC6648 diff --git a/doc/sphinx/users-guide/purging.rst b/doc/sphinx/users-guide/purging.rst index 43df304..578bf50 100644 --- a/doc/sphinx/users-guide/purging.rst +++ b/doc/sphinx/users-guide/purging.rst @@ -121,11 +121,11 @@ object is not available in the `ban lurker` thread. You can use the following template to write `ban lurker` friendly bans:: sub vcl_backend_response { - set beresp.http.x-url = bereq.url; + set beresp.http.url = bereq.url; } sub vcl_deliver { - unset resp.http.x-url; # Optional + unset resp.http.url; # Optional } sub vcl_recv { @@ -133,15 +133,15 @@ You can use the following template to write `ban lurker` friendly bans:: if (client.ip !~ purge) { return(synth(403, "Not allowed")); } - ban("obj.http.x-url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple + ban("obj.http.url ~ " + req.url); # Assumes req.url is a regex. This might be a bit too simple } } To inspect the current ban list, issue the ``ban.list`` command in the CLI. This will produce a status of all current bans:: - 0xb75096d0 1318329475.377475 10 obj.http.x-url ~ test - 0xb7509610 1318329470.785875 20G obj.http.x-url ~ test + 0xb75096d0 1318329475.377475 10 obj.http.url ~ test + 0xb7509610 1318329470.785875 20G obj.http.url ~ test The ban list contains the ID of the ban, the timestamp when the ban entered the ban list. A count of the objects that has reached this point diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index 91fbe30..0ad385f 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -46,14 +46,14 @@ $Function STRING toupper(STRING_LIST s) Description Converts the string *s* to uppercase. Example - set beresp.http.x-scream = std.toupper("yes!"); + set beresp.http.scream = std.toupper("yes!"); $Function STRING tolower(STRING_LIST s) Description Converts the string *s* to lowercase. Example - set beresp.http.x-nice = std.tolower("VerY"); + set beresp.http.nice = std.tolower("VerY"); $Function VOID set_ip_tos(INT tos) @@ -73,7 +73,7 @@ $Function REAL random(REAL lo, REAL hi) Description Returns a random real number between *lo* and *hi*. Example - set beresp.http.x-random-number = std.random(1, 100); + set beresp.http.random-number = std.random(1, 100); $Function VOID log(STRING_LIST s) @@ -102,7 +102,7 @@ Description function the caching in the function doesn't take this into account. Also, files are not re-read. Example - set beresp.http.x-served-by = std.fileread("/etc/hostname"); + set beresp.http.served-by = std.fileread("/etc/hostname"); $Function VOID collect(HEADER hdr) @@ -131,7 +131,7 @@ Description Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example - | if (std.integer(req.http.x-foo, 0) > 5) { + | if (std.integer(req.http.foo, 0) > 5) { | ... | } @@ -152,7 +152,7 @@ Description Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example - | if (std.real(req.http.x-foo, 0.0) > 5.5) { + | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } @@ -161,21 +161,21 @@ $Function TIME real2time(REAL r) Description Converts the real *r* to a time. Example - set req.http.x-time = std.real2time(1140618699.00); + set req.http.time = std.real2time(1140618699.00); $Function INT time2integer(TIME t) Description Converts the time *t* to a integer. Example - set req.http.x-int = std.time2integer(now); + set req.http.int = std.time2integer(now); $Function REAL time2real(TIME t) Description Converts the time *t* to a real. Example - set req.http.x-real = std.time2real(now); + set req.http.real = std.time2real(now); $Function BOOL healthy(BACKEND be) @@ -231,11 +231,11 @@ Description Note that the comparison is case sensitive. Example - | if (std.strstr(req.url, req.http.x-restrict)) { + | if (std.strstr(req.url, req.http.restrict)) { | ... | } - This will check if the content of req.http.x-restrict occurs + This will check if the content of req.http.restrict occurs anywhere in req.url. $Function TIME time(STRING s, TIME fallback) From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 8d7a165 Typos Message-ID: commit 8d7a165903fd2d7f941f3f17433a36df45a44ef2 Author: Federico G. Schwindt Date: Fri Jul 10 17:22:17 2015 +0100 Typos diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 6494524..05b04da 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -39,7 +39,7 @@ OPTIONS 80 (http) is used. An additional protocol type can be set for the listening socket with PROTO. Valid protocol types are: HTTP/1 (default), and PROXY. - Multiple listening adresses can be specificed by using multiple -a arguments. + Multiple listening addresses can be specified by using multiple -a arguments. -b @@ -252,7 +252,7 @@ specific options. Available jails are: the master process whenever possible. The optional `user` argument specifies which alternative user to - use. It defauls to ``varnish`` + use. It defaults to ``varnish`` The optional `ccgroup` argument specifies a group to add to varnish subprocesses requiring access to a c-compiler. There is no default. @@ -347,7 +347,7 @@ Varnish and bundled tools will, in most cases, exit with one of the following codes * `0` OK -* `1` Some error which could be system-dependend and/or transient +* `1` Some error which could be system-dependent and/or transient * `2` Serious configuration / parameter error - retrying with the same configuration / parameters is most likely useless From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 9c7f0d5 Reword Message-ID: commit 9c7f0d516c99e9b1608f3d629e973440bc4adf9d Author: Federico G. Schwindt Date: Fri Jul 10 17:25:25 2015 +0100 Reword Partially from minusf via github diff --git a/doc/sphinx/users-guide/run_security.rst b/doc/sphinx/users-guide/run_security.rst index 5b9dfad..d83ea18 100644 --- a/doc/sphinx/users-guide/run_security.rst +++ b/doc/sphinx/users-guide/run_security.rst @@ -65,10 +65,10 @@ memory. By using a "localhost" address, you restrict CLI access to the local machine. -You can also bind the CLI port to an IP number reachable across +You can also bind the CLI port to an IP address reachable across the net, and let other machines connect directly. -This gives you no secrecy, ie, the CLI commands will +This gives you no secrecy, i.e. the CLI commands will go across the network as ASCII text with no encryption, but the -S/PSK authentication requires the remote end to know the shared secret. @@ -88,10 +88,8 @@ to your central Varnish management facility. .. XXX:Maybe a sample command here with a brief explanation? benc -The connection is also in this case without secrecy, but -the remote end must still satisfy -S/PSK authentication. - -.. XXX:Without encryption instead of secrecy? benc +The connection in this case is also without encryption, but +the remote end must still authenticate using -S/PSK. Finally, if you run varnishd with the '-d' option, you get a CLI command on stdin/stdout, but since you started the process, it From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 7f5a147 Sync with upstream Message-ID: commit 7f5a1475d1fdfa1a3751a8bc6013170e53143453 Author: Federico G. Schwindt Date: Fri Jul 10 18:17:02 2015 +0100 Sync with upstream diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index be311c5..870d718 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -24,7 +24,7 @@ # detectdevice.vcl - regex based device detection for Varnish # https://github.com/varnish/varnish-devicedetect/ # -# Author: Lasse Karstensen +# Author: Lasse Karstensen sub devicedetect { unset req.http.X-UA-Device; @@ -39,7 +39,10 @@ sub devicedetect { /* If the cookie header is now empty, or just whitespace, unset it. */ if (req.http.Cookie ~ "^ *$") { unset req.http.Cookie; } } else { - if (req.http.User-Agent ~ "(?i)(ads|google|bing|msn|yandex|baidu|ro|career|)bot" || + if (req.http.User-Agent ~ "\(compatible; Googlebot-Mobile/2.1; \+http://www.google.com/bot.html\)" || + (req.http.User-Agent ~ "iPhone" && req.http.User-Agent ~ "\(compatible; Googlebot/2.1; \+http://www.google.com/bot.html")) { + set req.http.X-UA-Device = "mobile-bot"; } + elsif (req.http.User-Agent ~ "(?i)(ads|google|bing|msn|yandex|baidu|ro|career|)bot" || req.http.User-Agent ~ "(?i)(baidu|jike|symantec)spider" || req.http.User-Agent ~ "(?i)scanner" || req.http.User-Agent ~ "(?i)(web)crawler") { @@ -51,13 +54,14 @@ sub devicedetect { elsif (req.http.User-Agent ~ "(?i)android.*(mobile|mini)") { set req.http.X-UA-Device = "mobile-android"; } // android 3/honeycomb was just about tablet-only, and any phones will probably handle a bigger page layout. elsif (req.http.User-Agent ~ "(?i)android 3") { set req.http.X-UA-Device = "tablet-android"; } - /* see http://my.opera.com/community/openweb/idopera/ */ + /* Opera Mobile */ elsif (req.http.User-Agent ~ "Opera Mobi") { set req.http.X-UA-Device = "mobile-smartphone"; } // May very well give false positives towards android tablets. Suggestions welcome. elsif (req.http.User-Agent ~ "(?i)android") { set req.http.X-UA-Device = "tablet-android"; } elsif (req.http.User-Agent ~ "PlayBook; U; RIM Tablet") { set req.http.X-UA-Device = "tablet-rim"; } elsif (req.http.User-Agent ~ "hp-tablet.*TouchPad") { set req.http.X-UA-Device = "tablet-hp"; } elsif (req.http.User-Agent ~ "Kindle/3") { set req.http.X-UA-Device = "tablet-kindle"; } + elsif (req.http.User-Agent ~ "Touch.+Tablet PC") { set req.http.X-UA-Device = "tablet-microsoft"; } elsif (req.http.User-Agent ~ "Mobile.+Firefox") { set req.http.X-UA-Device = "mobile-firefoxos"; } elsif (req.http.User-Agent ~ "^HTC" || req.http.User-Agent ~ "Fennec" || From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 8a165ad Update URLs Message-ID: commit 8a165adb5a893cea2e9ca76208d4d728d7800275 Author: Federico G. Schwindt Date: Fri Jul 10 18:20:37 2015 +0100 Update URLs diff --git a/doc/sphinx/installation/install.rst b/doc/sphinx/installation/install.rst index f5886cb..398e9af 100644 --- a/doc/sphinx/installation/install.rst +++ b/doc/sphinx/installation/install.rst @@ -36,7 +36,7 @@ on `repo.varnish-cache.org `_. See the online `_ for more information. Varnish is included in the `EPEL -`_ repository, however due to +`_ repository, however due to incompatible syntax changes in newer versions of Varnish, only older versions are available. diff --git a/doc/sphinx/phk/dough.rst b/doc/sphinx/phk/dough.rst index 65b53f8..b629e8b 100644 --- a/doc/sphinx/phk/dough.rst +++ b/doc/sphinx/phk/dough.rst @@ -260,7 +260,7 @@ Poul-Henning, 2014-04-11 .. _Varnish Moral License: http://phk.freebsd.dk/VML -.. _solicited the FreeBSD community: http://people.freebsd.org/~phk/funding.html +.. _solicited the FreeBSD community: https://people.freebsd.org/~phk/funding.html .. _Extremely Large Telescope: http://www.eso.org/public/teles-instr/e-elt/ diff --git a/doc/sphinx/phk/platforms.rst b/doc/sphinx/phk/platforms.rst index 6f448e6..18ee017 100644 --- a/doc/sphinx/phk/platforms.rst +++ b/doc/sphinx/phk/platforms.rst @@ -47,7 +47,7 @@ Platform specific bug reports gets acted on. *Linux* Obviously you can forget about running Varnish on your -`WRT54G `_ +`WRT54G `_ but if you have a real computer, you can expect Varnish to work "ok or better" on any distro that has a package available. diff --git a/doc/sphinx/phk/sphinx.rst b/doc/sphinx/phk/sphinx.rst index b6e23f7..d001826 100644 --- a/doc/sphinx/phk/sphinx.rst +++ b/doc/sphinx/phk/sphinx.rst @@ -64,7 +64,7 @@ link at the bottom of the left menu: (link to random python doc page:) - http://docs.python.org/py3k/reference/expressions.html + https://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 diff --git a/lib/libvarnish/binary_heap.c b/lib/libvarnish/binary_heap.c index 664332b..e3bd2eb 100644 --- a/lib/libvarnish/binary_heap.c +++ b/lib/libvarnish/binary_heap.c @@ -29,7 +29,7 @@ * Implementation of a binary heap API * * See also: - * http://portal.acm.org/citation.cfm?doid=1785414.1785434 + * http://dl.acm.org/citation.cfm?doid=1785414.1785434 * (or: http://queue.acm.org/detail.cfm?id=1814327) */ diff --git a/varnish.m4 b/varnish.m4 index b7ad6f9..fcf6b2d 100644 --- a/varnish.m4 +++ b/varnish.m4 @@ -48,7 +48,7 @@ PKG_CHECK_EXISTS([varnishapi],[],[ is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. -To get pkg-config, see .]) +To get pkg-config, see .]) else AC_MSG_FAILURE( [pkg-config was unable to locate the varnishapi configuration data. From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 6834a80 Log if we retried too many times from v_b_e too Message-ID: commit 6834a80205fa9803e70e341b0f087f97dc702288 Author: Federico G. Schwindt Date: Fri Jul 10 18:26:06 2015 +0100 Log if we retried too many times from v_b_e too diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 0d7ba9f..12703bd 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -808,9 +808,12 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) VDI_Finish(bo->wrk, bo); } - if (wrk->handling == VCL_RET_RETRY && - bo->retries++ < cache_param->max_retries) - return (F_STP_RETRY); + if (wrk->handling == VCL_RET_RETRY) { + if (bo->retries++ < cache_param->max_retries) + return (F_STP_RETRY); + VSLb(bo->vsl, SLT_VCL_Error, + "Too many retries, delivering 503"); + } return (F_STP_FAIL); } From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] f6a7903 Mark [u]sleep() to not check return value by default Message-ID: commit f6a7903640ba5b3b91abcecbdbed0aa99766fbd1 Author: Poul-Henning Kamp Date: Sat Jul 11 20:13:46 2015 +0000 Mark [u]sleep() to not check return value by default diff --git a/flint.lnt b/flint.lnt index 000968a..434c54a 100644 --- a/flint.lnt +++ b/flint.lnt @@ -38,6 +38,9 @@ -esym(534, strlcpy) -esym(534, strncpy) +-esym(534, sleep) +-esym(534, usleep) + /////////////////////////////////////////////////////////////////////// // From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 17fbc57 Make NEEDLESS_RETURN part of vdef.h Message-ID: commit 17fbc579e3409fc6be3d8a7f79caa0d3b5076abb Author: Poul-Henning Kamp Date: Sat Jul 11 20:16:58 2015 +0000 Make NEEDLESS_RETURN part of vdef.h diff --git a/bin/varnishd/common/common.h b/bin/varnishd/common/common.h index a97986c..7b2c371 100644 --- a/bin/varnishd/common/common.h +++ b/bin/varnishd/common/common.h @@ -103,8 +103,6 @@ void mgt_child_inherit(int fd, const char *what); exit(2); \ } while (0) -#define NEEDLESS_RETURN(foo) return (foo) - /* cache/cache_vcl.c */ int VCL_TestLoad(const char *); diff --git a/include/vdef.h b/include/vdef.h index 5d52ddb..f6592b3 100644 --- a/include/vdef.h +++ b/include/vdef.h @@ -78,5 +78,6 @@ */ #define __match_proto__(xxx) /*lint -e{818} */ +#define NEEDLESS_RETURN(foo) return (foo) #endif /* VDEF_H_INCLUDED */ diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c index e662bee..989ee0a 100644 --- a/lib/libvarnishapi/vsl_query.c +++ b/lib/libvarnishapi/vsl_query.c @@ -51,8 +51,6 @@ #include "vsl_api.h" #include "vxp.h" -#define NEEDLESS_RETURN(foo) return(foo) - struct vslq_query { unsigned magic; #define VSLQ_QUERY_MAGIC 0x122322A5 From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] b8d70b0 Polish Message-ID: commit b8d70b078bcf403402644f69259c7f7cdb463662 Author: Poul-Henning Kamp Date: Sat Jul 11 20:19:24 2015 +0000 Polish diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c index f44d220..1309df0 100644 --- a/bin/varnishtest/vtc.c +++ b/bin/varnishtest/vtc.c @@ -438,8 +438,8 @@ cmd_shell(CMD_ARGS) r = system(av[1]); s = WEXITSTATUS(r); if (s != 0) - vtc_log(vl, 0, "CMD '%s' failed with status %d", - av[1], s); + vtc_log(vl, 0, "CMD '%s' failed with status %d (%s)", + av[1], s, strerror(errno)); } /********************************************************************** @@ -635,7 +635,7 @@ exec_file(const char *fn, const char *script, const char *tmpdir, FILE *f; struct extmacro *m; - signal(SIGPIPE, SIG_IGN); + (void)signal(SIGPIPE, SIG_IGN); vtc_loginit(logbuf, loglen); vltop = vtc_logopen("top"); diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c index 157bfa9..fffe9bf 100644 --- a/bin/varnishtest/vtc_process.c +++ b/bin/varnishtest/vtc_process.c @@ -43,8 +43,6 @@ #include "vtc.h" -#include "vss.h" - struct process { unsigned magic; #define PROCESS_MAGIC 0x1617b43e @@ -225,7 +223,7 @@ process_start(struct process *p) */ static void -process_wait(struct process *p) +process_wait(const struct process *p) { void *v; @@ -238,37 +236,34 @@ process_wait(struct process *p) */ static void -process_kill(struct process *p, const char *sig) +process_kill(const struct process *p, const char *sig) { - int s, l; + int s; char buf[64]; CHECK_OBJ_NOTNULL(p, PROCESS_MAGIC); AN(sig); - if (!p->running || !p->pid) { + if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot signal a non-running process"); - return; - } - vtc_log(p->vl, 4, "CMD: kill -%s %d", sig, p->pid); + bprintf(buf, "kill -%s %d", sig, p->pid); + vtc_log(p->vl, 4, "CMD: %s", buf); - l = snprintf(buf, sizeof buf, "kill -%s %d", sig, p->pid); - AN(l < sizeof buf); s = system(buf); if (s != 0) vtc_log(p->vl, 0, "Failed to send signal (exit status: %d)", s); } static inline void -process_stop(struct process *p) +process_stop(const struct process *p) { process_kill(p, "TERM"); } static inline void -process_terminate(struct process *p) +process_terminate(const struct process *p) { process_kill(p, "TERM"); @@ -282,14 +277,12 @@ process_terminate(struct process *p) */ static void -process_write(struct process *p, const char *text) +process_write(const struct process *p, const char *text) { int r, len; - if (!p->running || !p->pid) { + if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot write to a non-running process"); - return; - } len = strlen(text); vtc_log(p->vl, 4, "Writing %d bytes", len); @@ -303,10 +296,8 @@ static void process_close(struct process *p) { - if (!p->running || !p->pid) { + if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot close on a non-running process"); - return; - } AZ(close(p->fds[1])); p->fds[1] = -1; From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] f9fccc0 Try fixing the u00001 instability by retrying polls which fail with EINTR. Message-ID: commit f9fccc0430ca1c963da1f8c67316bd1737bd5e7e Author: Poul-Henning Kamp Date: Sat Jul 11 20:24:54 2015 +0000 Try fixing the u00001 instability by retrying polls which fail with EINTR. I suspect the underlying issue is that SIGCHLD is being sent to a random thread and that happens to be the s1 thread on some platforms. diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index 5a291dc..ec1350a 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -387,6 +387,8 @@ http_rxchar(struct http *hp, int n, int eof) pfd[0].events = POLLIN; pfd[0].revents = 0; i = poll(pfd, 1, hp->timeout); + if (i < 0 && errno == EINTR) + continue; if (i == 0) vtc_log(hp->vl, hp->fatal, "HTTP rx timeout (fd:%d %u ms)", @@ -1215,6 +1217,8 @@ cmd_http_expect_close(CMD_ARGS) fds[0].events = POLLIN | POLLERR; fds[0].revents = 0; i = poll(fds, 1, hp->timeout); + if (i < 0 && errno == EINTR) + continue; if (i == 0) vtc_log(vl, hp->fatal, "Expected close: timeout"); if (i != 1 || !(fds[0].revents & (POLLIN|POLLERR))) From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 74c49a2 Eliminate the backend refcount, n_conn serves as refcount and is all we need. Message-ID: commit 74c49a2e89c24312fda5aefc7b690271bdc47ffa Author: Poul-Henning Kamp Date: Sun Jul 12 08:19:59 2015 +0000 Eliminate the backend refcount, n_conn serves as refcount and is all we need. Send warm dynamic backends "COLD" event before deleting them. diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 611c089..0591ec7 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -103,7 +103,6 @@ vbe_dir_getfd(struct worker *wrk, struct backend *bp, struct busyobj *bo) AN(vc->addr); Lck_Lock(&bp->mtx); - bp->refcount++; bp->n_conn++; bp->vsc->conn++; Lck_Unlock(&bp->mtx); @@ -330,7 +329,7 @@ vbe_panic(const struct director *d, struct vsb *vsb) VSB_printf(vsb, " health=%s, admin_health=%s", bp->healthy ? "healthy" : "sick", bp->admin_health); VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed); - VSB_printf(vsb, " refcount = %d\n", bp->refcount); + VSB_printf(vsb, " n_conn = %u\n", bp->n_conn); } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index 97e70c1..49fc110 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -52,7 +52,6 @@ struct backend { VTAILQ_ENTRY(backend) list; VTAILQ_ENTRY(backend) vcl_list; - int refcount; struct lock mtx; VRT_BACKEND_FIELDS() @@ -129,4 +128,4 @@ void VBT_Wait(struct worker *, struct vbc *); /* cache_vcl.c */ void VCL_AddBackend(struct vcl *, struct backend *); -void VCL_DelBackend(const struct backend *); +void VCL_DelBackend(struct backend *); diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index a9199d3..8b89625 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -70,13 +70,11 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(vrt, VRT_BACKEND_MAGIC); - assert(vrt->ipv4_suckaddr != NULL || vrt->ipv6_suckaddr != NULL); vcl = ctx->vcl; AN(vcl); AN(vrt->vcl_name); - assert(vrt->ipv4_suckaddr != NULL || vrt->ipv6_suckaddr != NULL); /* Create new backend */ ALLOC_OBJ(b, BACKEND_MAGIC); diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index b450361..c10d949 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -205,7 +205,7 @@ VCL_AddBackend(struct vcl *vcl, struct backend *be) } void -VCL_DelBackend(const struct backend *be) +VCL_DelBackend(struct backend *be) { struct vcl *vcl; @@ -215,6 +215,8 @@ VCL_DelBackend(const struct backend *be) Lck_Lock(&vcl_mtx); VTAILQ_REMOVE(&vcl->backend_list, be, vcl_list); Lck_Unlock(&vcl_mtx); + if (vcl->temp == vcl_temp_warm) + VBE_Event(be, VCL_EVENT_COLD); } static void From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 4e8f14c Having researched it rather comprehensively, I have decided that there is no sane way to refcount (dynamic) backends in relation to VCL use at this point in the 4.1 release cycle. Message-ID: commit 4e8f14c495a34728f75856b070a09cfa3c87e64f Author: Poul-Henning Kamp Date: Sun Jul 12 09:07:02 2015 +0000 Having researched it rather comprehensively, I have decided that there is no sane way to refcount (dynamic) backends in relation to VCL use at this point in the 4.1 release cycle. Solve the problem, for now, by cooling dynamic backends off for a minute before actually removing them. Varnish 5 will have to look at proper refcounting of (all) VCL objects. diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index 49fc110..17b90f0 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -50,6 +50,8 @@ struct backend { unsigned magic; #define BACKEND_MAGIC 0x64c4c7c6 + unsigned n_conn; + VTAILQ_ENTRY(backend) list; VTAILQ_ENTRY(backend) vcl_list; struct lock mtx; @@ -59,7 +61,6 @@ struct backend { struct vcl *vcl; char *display_name; - unsigned n_conn; struct vbp_target *probe; unsigned healthy; @@ -71,6 +72,8 @@ struct backend { struct tcp_pool *tcp_pool; struct director director[1]; + + double cooled; }; /*--------------------------------------------------------------------- diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index 8b89625..3db5dbd 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -48,6 +48,8 @@ #include "cache_backend.h" static VTAILQ_HEAD(, backend) backends = VTAILQ_HEAD_INITIALIZER(backends); +static VTAILQ_HEAD(, backend) cool_backends = + VTAILQ_HEAD_INITIALIZER(cool_backends); static struct lock backends_mtx; static const char * const vbe_ah_healthy = "healthy"; @@ -130,7 +132,6 @@ VRT_delete_backend(VRT_CTX, struct director **dp) { struct director *d; struct backend *be; - int r; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); AN(dp); @@ -141,17 +142,10 @@ VRT_delete_backend(VRT_CTX, struct director **dp) Lck_Lock(&be->mtx); be->admin_health = vbe_ah_deleted; be->health_changed = VTIM_real(); - r = be->n_conn; - if (r > 0) { - /* move to front of list for fast access */ - VTAILQ_REMOVE(&backends, be, list); - VTAILQ_INSERT_HEAD(&backends, be, list); - } + be->cooled = VTIM_real() + 60.; + VTAILQ_REMOVE(&backends, be, list); + VTAILQ_INSERT_TAIL(&cool_backends, be, list); Lck_Unlock(&be->mtx); - if (r == 0) { - VCL_DelBackend(be); - VBE_Delete(be); - } } /*--------------------------------------------------------------------- @@ -191,7 +185,10 @@ VBE_Delete(struct backend *be) VBP_Remove(be); Lck_Lock(&backends_mtx); - VTAILQ_REMOVE(&backends, be, list); + if (be->cooled > 0) + VTAILQ_REMOVE(&cool_backends, be, list); + else + VTAILQ_REMOVE(&backends, be, list); VSC_C_main->n_backend--; VBT_Rel(&be->tcp_pool); Lck_Unlock(&backends_mtx); @@ -425,18 +422,21 @@ void VBE_Poll(void) { struct backend *be; + double now = VTIM_real(); + + Lck_Lock(&backends_mtx); while (1) { - Lck_Lock(&backends_mtx); - be = VTAILQ_FIRST(&backends); + be = VTAILQ_FIRST(&cool_backends); if (be == NULL) break; - if (be->admin_health != vbe_ah_deleted) + if (be->cooled > now) break; if (be->n_conn > 0) - break; + continue; Lck_Unlock(&backends_mtx); VCL_DelBackend(be); VBE_Delete(be); + Lck_Lock(&backends_mtx); } Lck_Unlock(&backends_mtx); } From phk at FreeBSD.org Fri Sep 4 13:54:50 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 5811a87 Add Dridi's test-suite for dynamic backends, with some semi-heavy modifications relating to the object refcount issue. Message-ID: commit 5811a87e33056e8aeb8bce3fcfdc0c5023b67a43 Author: Poul-Henning Kamp Date: Sun Jul 12 09:10:03 2015 +0000 Add Dridi's test-suite for dynamic backends, with some semi-heavy modifications relating to the object refcount issue. diff --git a/bin/varnishtest/tests/d00007.vtc b/bin/varnishtest/tests/d00007.vtc new file mode 100644 index 0000000..298fbf7 --- /dev/null +++ b/bin/varnishtest/tests/d00007.vtc @@ -0,0 +1,28 @@ +varnishtest "Test dynamic backends" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + set req.backend_hint = s1.backend(); + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq + rxresp + expect resp.status == 200 +} -run diff --git a/bin/varnishtest/tests/d00008.vtc b/bin/varnishtest/tests/d00008.vtc new file mode 100644 index 0000000..a30edd8 --- /dev/null +++ b/bin/varnishtest/tests/d00008.vtc @@ -0,0 +1,52 @@ +varnishtest "Test dynamic backends hot swap" + +server s1 { + rxreq + expect req.url == "/foo" + txresp +} -start + +server s2 { + rxreq + expect req.url == "/bar" + txresp +} -start + +varnish v1 -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + if (req.method == "SWAP") { + s1.refresh(req.http.X-Addr, req.http.X-Port); + return (synth(200)); + } + set req.backend_hint = s1.backend(); + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 + + txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" + rxresp + expect resp.status == 200 + + txreq -url "/bar" + rxresp + expect resp.status == 200 +} -run + +delay 1 + +varnish v1 -cli backend.list +# varnish v1 -expect MAIN.n_backend == 2 diff --git a/bin/varnishtest/tests/d00009.vtc b/bin/varnishtest/tests/d00009.vtc new file mode 100644 index 0000000..c888d20 --- /dev/null +++ b/bin/varnishtest/tests/d00009.vtc @@ -0,0 +1,58 @@ +varnishtest "Test dynamic backends hot swap while being used" + +server s1 { + rxreq + expect req.url == "/foo" + sema r1 sync 2 + sema r2 sync 2 + txresp +} -start + +server s2 { + rxreq + expect req.url == "/bar" + sema r2 sync 2 + txresp +} -start + +varnish v1 -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + if (req.method == "SWAP") { + s1.refresh(req.http.X-Addr, req.http.X-Port); + return (synth(200)); + } + set req.backend_hint = s1.backend(); + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 +} -start + +client c2 { + sema r1 sync 2 + txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" + rxresp + expect resp.status == 200 + + txreq -url "/bar" + rxresp + expect resp.status == 200 +} -run + +client c1 -wait + +varnish v1 -cli backend.list +# varnish v1 -expect MAIN.n_backend == 2 diff --git a/bin/varnishtest/tests/d00010.vtc b/bin/varnishtest/tests/d00010.vtc new file mode 100644 index 0000000..1db0ea7 --- /dev/null +++ b/bin/varnishtest/tests/d00010.vtc @@ -0,0 +1,59 @@ +varnishtest "Test dynamic backends hot swap during a pipe" + +server s1 { + rxreq + expect req.url == "/foo" + sema r1 sync 2 + sema r2 sync 2 + txresp +} -start + +server s2 { + rxreq + expect req.url == "/bar" + sema r2 sync 2 + txresp +} -start + +varnish v1 -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + if (req.method == "SWAP") { + s1.refresh(req.http.X-Addr, req.http.X-Port); + return (synth(200)); + } + set req.backend_hint = s1.backend(); + return (pipe); + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 +} -start + +client c2 { + sema r1 sync 2 + txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" + rxresp + expect resp.status == 200 + + txreq -url "/bar" + rxresp + expect resp.status == 200 +} -run + +client c1 -wait + +varnish v1 -cli backend.list +#varnish v1 -expect MAIN.n_backend == 2 diff --git a/bin/varnishtest/tests/d00011.vtc b/bin/varnishtest/tests/d00011.vtc new file mode 100644 index 0000000..01d45a1 --- /dev/null +++ b/bin/varnishtest/tests/d00011.vtc @@ -0,0 +1,62 @@ +varnishtest "Test a dynamic backend hot swap after it was picked by a bereq" + +server s1 { +} -start + +server s2 { + rxreq + txresp +} -start + +varnish v1 -vcl { + import ${vmod_std}; + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + if (req.method == "SWAP") { + s1.refresh(req.http.X-Addr, req.http.X-Port); + return (synth(200)); + } + } + + sub vcl_backend_fetch { + set bereq.backend = s1.backend(); + # hot swap should happen while we sleep + debug.sleep(2s); + if (std.healthy(bereq.backend)) { + return(abandon); + } else { + set bereq.backend = s1.backend(); + } + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq + sema r2 sync 2 + rxresp + expect resp.status == 200 +} + +client c2 { + sema r2 sync 2 + delay 0.1 + txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" + rxresp + expect resp.status == 200 +} + +client c1 -start +client c2 -run +client c1 -wait + +varnish v1 -cli backend.list +#varnish v1 -expect MAIN.n_backend == 2 diff --git a/bin/varnishtest/tests/d00012.vtc b/bin/varnishtest/tests/d00012.vtc new file mode 100644 index 0000000..74aaa8d --- /dev/null +++ b/bin/varnishtest/tests/d00012.vtc @@ -0,0 +1,77 @@ +varnishtest "Test a dynamic backend discard during a request" + +# vcl.discard testing inspired by v00006.vtc from commit e1f7207 + +server s1 { + rxreq + expect req.url == "/foo" + sema r1 sync 2 + txresp +} -start + +varnish v1 -arg "-p thread_pools=1" -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + set req.backend_hint = s1.backend(); + } +} -start + +client c1 { + txreq -url "/foo" + rxresp + expect resp.status == 200 +} -start + +varnish v1 -expect MAIN.n_backend == 2 +# expected: vcl1.dummy, vcl1.s1 + +server s2 { + rxreq + expect req.url == "/bar" + txresp +} -start + +varnish v1 -vcl { + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s2 = debug.dyn("${s2_addr}", "${s2_port}"); + } + + sub vcl_recv { + set req.backend_hint = s2.backend(); + } +} + +varnish v1 -cli "vcl.discard vcl1" +sema r1 sync 2 + +client c1 -wait +delay 2 + +varnish v1 -expect MAIN.n_backend == 4 +# expected: vcl1.dummy, vcl1.s1, vcl2.dummy, vcl2.s2 + +varnish v1 -expect n_vcl_avail == 1 +varnish v1 -expect n_vcl_discard == 1 + +client c1 { + txreq -url "/bar" + rxresp + expect resp.status == 200 +} -run + +varnish v1 -cli "vcl.list" +#varnish v1 -expect MAIN.n_backend == 2 +# expected: vcl2.dummy, vcl2.s2 +varnish v1 -expect n_vcl_avail == 1 +varnish v1 -expect n_vcl_discard == 0 diff --git a/bin/varnishtest/tests/d00013.vtc b/bin/varnishtest/tests/d00013.vtc new file mode 100644 index 0000000..25ab33f --- /dev/null +++ b/bin/varnishtest/tests/d00013.vtc @@ -0,0 +1,59 @@ +varnishtest "Test a dynamic backend hot swap after it was hinted to a req" + +server s1 { +} -start + +server s2 { + rxreq + txresp +} -start + +varnish v1 -vcl { + import ${vmod_std}; + import ${vmod_debug}; + + backend dummy { .host = "${bad_ip}"; } + + sub vcl_init { + new s1 = debug.dyn("${s1_addr}", "${s1_port}"); + } + + sub vcl_recv { + if (req.method == "SWAP") { + s1.refresh(req.http.X-Addr, req.http.X-Port); + return (synth(200)); + } + set req.backend_hint = s1.backend(); + # hot swap should happen while we sleep + debug.sleep(2s); + if (std.healthy(req.backend_hint)) { + return(synth(800)); + } else { + set req.backend_hint = s1.backend(); + } + } +} -start + +varnish v1 -expect MAIN.n_backend == 2 + +client c1 { + txreq + sema r2 sync 2 + rxresp + expect resp.status == 200 +} + +client c2 { + sema r2 sync 2 + delay 0.1 + txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" + rxresp + expect resp.status == 200 +} + +client c1 -start +client c2 -run +client c1 -wait + +varnish v1 -cli backend.list +#varnish v1 -expect MAIN.n_backend == 2 diff --git a/lib/libvmod_debug/Makefile.am b/lib/libvmod_debug/Makefile.am index d189102..9115713 100644 --- a/lib/libvmod_debug/Makefile.am +++ b/lib/libvmod_debug/Makefile.am @@ -17,14 +17,15 @@ libvmod_debug_la_LDFLAGS = $(AM_LDFLAGS) -module -export-dynamic -avoid-version libvmod_debug_la_SOURCES = \ vmod_debug.c \ - vmod_debug_obj.c + vmod_debug_obj.c \ + vmod_debug_dyn.c nodist_libvmod_debug_la_SOURCES = \ vcc_if.c \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build -vmod_debug.lo vmod_debug_obj.lo: vcc_if.h +vmod_debug.lo vmod_debug_obj.lo vmod_debug_dyn.lo: vcc_if.h vcc_if.c vcc_if.h vmod_debug.rst vmod_debug.man.rst: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmodtoolargs) $(vmod_srcdir)/vmod.vcc diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 305deaa..3a60814 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -108,4 +108,16 @@ Function to fail vcl_init{} $Function VOID sleep(DURATION) -Block the current worker thread. +Sleep the current worker thread. + +$Object dyn(STRING addr, STRING port) + +Dynamically create a single-backend director + +$Method BACKEND .backend() + +Return the dynamic backend. + +$Method VOID .refresh(STRING addr, STRING port) + +Dynamically refresh & (always!) replace the backend by a new one. diff --git a/lib/libvmod_debug/vmod_debug_dyn.c b/lib/libvmod_debug/vmod_debug_dyn.c new file mode 100644 index 0000000..7e4afea --- /dev/null +++ b/lib/libvmod_debug/vmod_debug_dyn.c @@ -0,0 +1,165 @@ +/*- + * Copyright (c) 2015 Varnish Software AS + * All rights reserved. + * + * Author: Dridi Boukelmoune + * + * 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. + */ + +#include "config.h" + +#include +#include +#include + +#include +#include + +#include "vcl.h" +#include "vrt.h" + +#include "cache/cache.h" +#include "cache/cache_director.h" +#include "cache/cache_backend.h" + +#include "vsa.h" +#include "vcc_if.h" + +struct vmod_debug_dyn { + unsigned magic; +#define VMOD_DEBUG_DYN_MAGIC 0x9b77ccbd + pthread_mutex_t mtx; + char *vcl_name; + struct director *dir; +}; + +static void +dyn_dir_init(VRT_CTX, struct vmod_debug_dyn *dyn, + VCL_STRING addr, VCL_STRING port) +{ + struct addrinfo hints, *res = NULL; + struct suckaddr *sa; + struct director *dir, *dir2; + struct vrt_backend vrt; + + CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); + XXXAN(addr); + XXXAN(port); + + INIT_OBJ(&vrt, VRT_BACKEND_MAGIC); + vrt.port = port; + vrt.vcl_name = dyn->vcl_name; + vrt.hosthdr = vrt.ipv4_addr; + + memset(&hints, 0, sizeof(hints)); + hints.ai_family = AF_INET; + hints.ai_socktype = SOCK_STREAM; + AZ(getaddrinfo(vrt.ipv4_addr, vrt.port, &hints, &res)); + XXXAZ(res->ai_next); + + sa = VSA_Malloc(res->ai_addr, res->ai_addrlen); + AN(sa); + if (VSA_Get_Proto(sa) == AF_INET) { + vrt.ipv4_addr = addr; + vrt.ipv4_suckaddr = sa; + } else if (VSA_Get_Proto(sa) == AF_INET6) { + vrt.ipv6_addr = addr; + vrt.ipv6_suckaddr = sa; + } else + WRONG("Wrong proto family"); + + freeaddrinfo(res); + + dir = VRT_new_backend(ctx, &vrt); + AN(dir); + + /* + * NB: A real dynamic backend should not replace the previous + * instance if the new one is identical. We do it here because + * the d* tests requires a replacement. + */ + AZ(pthread_mutex_lock(&dyn->mtx)); + dir2 = dyn->dir; + dyn->dir = dir; + AZ(pthread_mutex_unlock(&dyn->mtx)); + + if (dir2 != NULL) + VRT_delete_backend(ctx, &dir2); + + free(sa); +} + +VCL_VOID +vmod_dyn__init(VRT_CTX, struct vmod_debug_dyn **dynp, + const char *vcl_name, VCL_STRING addr, VCL_STRING port) +{ + struct vmod_debug_dyn *dyn; + + ASSERT_CLI(); + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + AN(dynp); + AZ(*dynp); + AN(vcl_name); + + ALLOC_OBJ(dyn, VMOD_DEBUG_DYN_MAGIC); + AN(dyn); + REPLACE(dyn->vcl_name, vcl_name); + + AZ(pthread_mutex_init(&dyn->mtx, NULL)); + + dyn_dir_init(ctx, dyn, addr, port); + XXXAN(dyn->dir); + *dynp = dyn; +} + +VCL_VOID +vmod_dyn__fini(struct vmod_debug_dyn **dynp) +{ + struct vmod_debug_dyn *dyn; + + AN(dynp); + CAST_OBJ_NOTNULL(dyn, *dynp, VMOD_DEBUG_DYN_MAGIC); + /* at this point all backends will be deleted by the vcl */ + free(dyn->vcl_name); + AZ(pthread_mutex_destroy(&dyn->mtx)); + FREE_OBJ(dyn); + *dynp = NULL; +} + +VCL_BACKEND __match_proto__() +vmod_dyn_backend(VRT_CTX, struct vmod_debug_dyn *dyn) +{ + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); + AN(dyn->dir); + return (dyn->dir); +} + +VCL_VOID +vmod_dyn_refresh(VRT_CTX, struct vmod_debug_dyn *dyn, + VCL_STRING addr, VCL_STRING port) +{ + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + CHECK_OBJ_NOTNULL(dyn, VMOD_DEBUG_DYN_MAGIC); + dyn_dir_init(ctx, dyn, addr, port); +} From nils.goroll at uplex.de Fri Sep 4 13:54:50 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] a87b589 wrap the vxid on VSL_IDENTMASK Message-ID: commit a87b589b00e788a4294c1b2be68e26a7b4f3fc77 Author: Nils Goroll Date: Sun Jul 12 23:28:16 2015 +0200 wrap the vxid on VSL_IDENTMASK We spilled into the client marker bit when reaching 1<<30 diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c index f95bc77..22d3870 100644 --- a/bin/varnishd/cache/cache_main.c +++ b/bin/varnishd/cache/cache_main.c @@ -129,7 +129,7 @@ VXID_Get(struct worker *wrk, uint32_t mask) Lck_Lock(&vxid_lock); v->next = vxid_base; v->count = vxid_chunk; - vxid_base += v->count; + vxid_base = (vxid_base + v->count) && VSL_IDENTMASK; Lck_Unlock(&vxid_lock); } v->count--; From nils.goroll at uplex.de Fri Sep 4 13:54:50 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 0dd8c0b Fix: wrap the vxid on VSL_IDENTMASK Message-ID: commit 0dd8c0b864a9574df0f2891824b4581d0e846613 Author: Nils Goroll Date: Sun Jul 12 23:51:29 2015 +0200 Fix: wrap the vxid on VSL_IDENTMASK WHOA - sorry diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c index 22d3870..e47f685 100644 --- a/bin/varnishd/cache/cache_main.c +++ b/bin/varnishd/cache/cache_main.c @@ -129,7 +129,7 @@ VXID_Get(struct worker *wrk, uint32_t mask) Lck_Lock(&vxid_lock); v->next = vxid_base; v->count = vxid_chunk; - vxid_base = (vxid_base + v->count) && VSL_IDENTMASK; + vxid_base = (vxid_base + v->count) & VSL_IDENTMASK; Lck_Unlock(&vxid_lock); } v->count--; From fgsch at lodoss.net Fri Sep 4 13:54:50 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 335708c Consistency Message-ID: commit 335708cd604720f46a2cb8a51848495f4dea7d61 Author: Federico G. Schwindt Date: Mon Jul 13 12:53:29 2015 +0100 Consistency diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc index 2e958a7..cfcf2e3 100644 --- a/lib/libvmod_directors/vmod.vcc +++ b/lib/libvmod_directors/vmod.vcc @@ -132,8 +132,8 @@ Description to this director. Example - vdir.add_backend(backend1, 10); - vdir.add_backend(backend2, 5); + vdir.add_backend(backend1, 10.0); + vdir.add_backend(backend2, 5.0); # 2/3 to backend1, 1/3 to backend2. From nils.goroll at uplex.de Fri Sep 4 13:54:50 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] dc5e096 Add a debug bit to always keep the vsm file Message-ID: commit dc5e096ac1f60b900761d938ae4fc16fd06c8e1e Author: Nils Goroll Date: Tue Jul 14 04:06:20 2015 +0200 Add a debug bit to always keep the vsm file diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 450ec9c..3a6890a 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -94,6 +94,12 @@ MGT_FEATURE(enum feature_bits x) return (mgt_param.feature_bits[(unsigned)x>>3] & (0x80U >> ((unsigned)x & 7))); } +static inline int +MGT_DO_DEBUG(enum debug_bits x) +{ + return (mgt_param.debug_bits[(unsigned)x>>3] & + (0x80U >> ((unsigned)x & 7))); +} static void mgt_reap_child(void); @@ -528,7 +534,7 @@ mgt_reap_child(void) mgt_SHM_Destroy(1); VSC_C_mgt->child_panic = ++static_VSC_C_mgt.child_panic; } else { - mgt_SHM_Destroy(0); + mgt_SHM_Destroy(MGT_DO_DEBUG(DBG_VSM_KEEP)); } mgt_SHM_Create(); mgt_SHM_Commit(); diff --git a/include/tbl/debug_bits.h b/include/tbl/debug_bits.h index 9e5b684..fa0d32f 100644 --- a/include/tbl/debug_bits.h +++ b/include/tbl/debug_bits.h @@ -42,4 +42,5 @@ DEBUG_BIT(ESI_CHOP, esi_chop, "Chop ESI fetch to bits") DEBUG_BIT(FLUSH_HEAD, flush_head, "Flush after http1 head") DEBUG_BIT(VTC_MODE, vtc_mode, "Varnishtest Mode") DEBUG_BIT(WITNESS, witness, "Emit WITNESS lock records") +DEBUG_BIT(VSM_KEEP, vsm_keep, "Keep the VSM file on restart") /*lint -restore */ From nils.goroll at uplex.de Fri Sep 4 13:54:50 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 3f1dacd use debug=+vsm_keep with leave_temp (varnishtest -L / -l options) Message-ID: commit 3f1dacddf73294b1d6424196ecec74f4b46cf7f9 Author: Nils Goroll Date: Tue Jul 14 04:07:24 2015 +0200 use debug=+vsm_keep with leave_temp (varnishtest -L / -l options) diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index ce50c6b..df8787c 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -85,9 +85,9 @@ static int vtc_continue; /* Continue on error */ static int vtc_verbosity = 1; /* Verbosity Level */ static int vtc_good; static int vtc_fail; -static int leave_temp; static char *tmppath; static char *cwd = NULL; +int leave_temp; int vtc_witness = 0; /********************************************************************** diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c index ce666e3..05ee65b 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -52,6 +52,8 @@ #include "vtcp.h" #include "vtim.h" +extern int leave_temp; + struct varnish { unsigned magic; #define VARNISH_MAGIC 0x208cd8e3 @@ -396,6 +398,8 @@ varnish_launch(struct varnish *v) v->jail, v->workdir); if (vtc_witness) VSB_cat(vsb, " -p debug=+witness"); + if (leave_temp) + VSB_cat(vsb, " -p debug=+vsm_keep"); VSB_printf(vsb, " -l 2m,1m,-"); VSB_printf(vsb, " -p auto_restart=off"); VSB_printf(vsb, " -p syslog_cli_traffic=off"); From nils.goroll at uplex.de Fri Sep 4 13:54:50 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:50 +0200 Subject: [4.1] 4ef5ae5 vtc: allow VSL arguments in logexpect Message-ID: commit 4ef5ae57a0cf2d3c29c5d2c7dbd65d301ce07150 Author: Nils Goroll Date: Tue Jul 14 15:34:18 2015 +0200 vtc: allow VSL arguments in logexpect diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index b05470d..1e787fc 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -33,6 +33,16 @@ * -g * -q * + * vsl arguments (vsl_arg.c) + * -b Only display backend records + * -c Only display client records + * -C Caseless regular expressions + * -i Include tags + * -I <[taglist:]regex> Include by regex + * -L Incomplete transaction limit + * -T Transaction end timeout + * + * * logexpect lN -v [-g ] [-d 0|1] [-q query] { * expect * } @@ -124,7 +134,8 @@ logexp_delete(struct logexp *le) { CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); AZ(le->run); - AZ(le->vsl); + AN(le->vsl); + VSL_Delete(le->vsl); AZ(le->vslq); logexp_delete_tests(le); free(le->name); @@ -150,7 +161,9 @@ logexp_new(const char *name) le->d_arg = 0; le->g_arg = VSL_g_vxid; le->vsm = VSM_New(); + le->vsl = VSL_New(); AN(le->vsm); + AN(le->vsl); VTAILQ_INSERT_TAIL(&logexps, le, list); return (le); @@ -299,10 +312,6 @@ logexp_close(struct logexp *le) if (le->vslq) VSLQ_Delete(&le->vslq); AZ(le->vslq); - if (le->vsl) { - VSL_Delete(le->vsl); - le->vsl = NULL; - } VSM_Close(le->vsm); } @@ -312,7 +321,7 @@ logexp_start(struct logexp *le) struct VSL_cursor *c; CHECK_OBJ_NOTNULL(le, LOGEXP_MAGIC); - AZ(le->vsl); + AN(le->vsl); AZ(le->vslq); if (le->n_arg == NULL) { @@ -328,7 +337,6 @@ logexp_start(struct logexp *le) vtc_log(le->vl, 0, "VSM_Open: %s", VSM_Error(le->vsm)); return; } - le->vsl = VSL_New(); AN(le->vsl); c = VSL_CursorVSM(le->vsl, le->vsm, (le->d_arg ? 0 : VSL_COPT_TAIL) | VSL_COPT_BATCH); @@ -579,6 +587,14 @@ cmd_logexp(CMD_ARGS) continue; } if (**av == '-') { + if (av[1] != NULL) { + if (VSL_Arg(le->vsl, av[0][1], av[1])) { + av++; + continue; + } + vtc_log(le->vl, 0, VSL_Error(le->vsl)); + return; + } vtc_log(le->vl, 0, "Unknown logexp argument: %s", *av); return; } From nils.goroll at uplex.de Fri Sep 4 13:54:51 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 90e87e3 Assert that literal vxids we parse never have the client/server bit set Message-ID: commit 90e87e30fb92e525016ce1975fa61ad744bdc41d Author: Nils Goroll Date: Tue Jul 14 17:05:52 2015 +0200 Assert that literal vxids we parse never have the client/server bit set This is an additional safeguard against regressions of #1762 diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 459d0b7..bc108f4 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -700,6 +700,7 @@ vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, *ptype = VSL_t_unknown; if (i == 1) return (1); + assert((vxid & ~VSL_IDENTMASK) == 0); *pvxid = vxid; if (i == 2) return (2); From nils.goroll at uplex.de Fri Sep 4 13:54:51 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 65f9cb7 dont use VSL_Error as a format string Message-ID: commit 65f9cb7ae68a8641a0fd5a804354df11c9af9ef1 Author: Nils Goroll Date: Tue Jul 14 17:34:38 2015 +0200 dont use VSL_Error as a format string diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index 1e787fc..bd567ee 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -592,7 +592,7 @@ cmd_logexp(CMD_ARGS) av++; continue; } - vtc_log(le->vl, 0, VSL_Error(le->vsl)); + vtc_log(le->vl, 0, "%s", VSL_Error(le->vsl)); return; } vtc_log(le->vl, 0, "Unknown logexp argument: %s", *av); From nils.goroll at uplex.de Fri Sep 4 13:54:51 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 20362bf Add a regression test for #1762 Message-ID: commit 20362bf807eb6b0772ccdeb221b05173484d5dc3 Author: Nils Goroll Date: Tue Jul 14 18:52:44 2015 +0200 Add a regression test for #1762 Further investigating into root cause scenarios resulted in the following insights: * the bad vxid must have got into vtx->key.vxid by way of `vtx_parse_link` * which is only called for `SLT_Begin` (`vtx_scan_begin()`) and `SLT_Link` (`vtx_scan_link()`) (actually this was known before, but I am now confident that these are the only cases) There is no case in the code as of 4.0.3 release where `SLT_Begin` is emitted with an unmasked vxid, so the issue must be root casue in an `SLT_Link` link record. In both cases where unmasked vxids are emitted for `SLT_Link`, the id comes directly from `VXID_Get()`: * `cache_fetch.c` wid = VXID_Get(&wrk->vxid_pool); VSLb(bo->vsl, SLT_Link, "bereq %u retry", wid); * `cache_req_fsm.c` wid = VXID_Get(&wrk->vxid_pool); // XXX: ReqEnd + ReqAcct ? VSLb_ts_req(req, "Restart", W_TIM_real(wrk)); VSLb(req->vsl, SLT_Link, "req %u restart", wid); So unless I have overseen anything significant, the root cause must have been a vxid spill, which was fixed with 0dd8c0b864a9574df0f2891824b4581d0e846613 (master) / 171f3ac585f2bda639f526c31ad0689aecb8f8b4 (4.0) `VXID()` masking would have avoided the issue to surface. This insight is consistent with two observations: * the issue only surfaced after `varnishd` running for longer periods of time * the issue didn't go away after a restart of the vsl client, a `varnishd` restart was required This gives confidence that the issue has really been understood completely and that the root cause has been fixed. diff --git a/bin/varnishtest/tests/r01762.vtc b/bin/varnishtest/tests/r01762.vtc new file mode 100644 index 0000000..8a3fbd4 --- /dev/null +++ b/bin/varnishtest/tests/r01762.vtc @@ -0,0 +1,106 @@ +varnishtest "test vsl api handling of incomplete vtxes combined with bad vxids" + +server s1 { + rxreq + txresp + + accept + rxreq + delay 5 + txresp +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (bereq.url == "/retry" && + bereq.retries == 0) { + return (retry); + } + } + sub vcl_deliver { + if (req.url == "/restart" && + req.restarts == 0) { + return (restart); + } + } + +} -start + +# xid spill into client marker emitting a bad SLT_Link for bereq retry +# triggering vtx_force by way of a timeout +# +# VSLb(bo->vsl, SLT_Link, "bereq %u retry", wid); + +varnish v1 -cliok "param.set debug +syncvsl" +# vxid wrap at 1<<30 +varnish v1 -cliok "debug.xid 1073741823" + +logexpect l1 -v v1 -g request -T 2 { + expect 0 1 Begin "req 0" + expect * = ReqStart + expect 0 = ReqMethod GET + expect 0 = ReqURL / + expect 0 = ReqProtocol HTTP/1.1 + expect * = ReqHeader "Foo: bar" + expect * = Link "bereq 2 fetch" + expect * = VSL "timeout" + expect * = End "synth" + + expect 0 2 Begin "bereq 1" + expect * 2 Link "bereq 3 retry" + expect * = End + + expect 0 3 Begin "bereq 2 retry" + expect * = End +} -start + +client c1 { + txreq -url "/retry" -hdr "Foo: bar" + rxresp + expect resp.status == 200 +} -run + +logexpect l1 -wait + + +################################################################################ + +# case xid spill into client marker emitting a bad SLT_Link for restart +# +# VSLb(req->vsl, SLT_Link, "req %u restart", wid); + + +server s1 { + rxreq + txresp +} -start + +varnish v1 -cliok "param.set debug +syncvsl" +# vxid wrap at 1<<30 +varnish v1 -cliok "debug.xid 1073741823" + +logexpect l1 -v v1 -g request { + expect 0 1 Begin "req 0" + expect * = ReqStart + expect 0 = ReqMethod GET + expect 0 = ReqURL / + expect 0 = ReqProtocol HTTP/1.1 + expect * = ReqHeader "Foo: bar" + expect * = Link "bereq 2 fetch" + expect * = Link "req 3 restart" + expect * = End + + expect 0 2 Begin "bereq 1" + expect * = End + + expect 0 3 Begin "req 1 restart" + expect * = End +} -start + +client c1 { + txreq -url "/restart" -hdr "Foo: bar" + rxresp + expect resp.status == 200 +} -run + +logexpect l1 -wait From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 082f259 Attempt to quell strange coverity report Message-ID: commit 082f2596000a18f66fa2c3286c311fbc9135d049 Author: Martin Blix Grydeland Date: Thu Jul 16 13:45:28 2015 +0200 Attempt to quell strange coverity report Add extra variables of the right enum types in an attempt to quell a coverity report about enum type missmatch when reusing the same integer counter. diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index bc108f4..3245e48 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -681,7 +681,9 @@ vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, { char type[16], reason[16]; unsigned vxid; - int i, j; + int i; + enum VSL_transaction_e et; + enum VSL_reason_e er; AN(str); AN(ptype); @@ -691,26 +693,30 @@ vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, i = sscanf(str, "%15s %u %15s", type, &vxid, reason); if (i < 1) return (0); - for (j = 0; j < VSL_t__MAX; j++) - if (!strcmp(type, vsl_t_names[j])) + + /* transaction type */ + for (et = 0; et < VSL_t__MAX; et++) + if (!strcmp(type, vsl_t_names[et])) break; - if (j < VSL_t__MAX) - *ptype = j; - else - *ptype = VSL_t_unknown; + if (et >= VSL_t__MAX) + et = VSL_t_unknown; + *ptype = et; if (i == 1) return (1); + + /* vxid */ assert((vxid & ~VSL_IDENTMASK) == 0); *pvxid = vxid; if (i == 2) return (2); - for (j = 0; j < VSL_r__MAX; j++) - if (!strcmp(reason, vsl_r_names[j])) + + /* transaction reason */ + for (er = 0; er < VSL_r__MAX; er++) + if (!strcmp(reason, vsl_r_names[er])) break; - if (j < VSL_r__MAX) - *preason = j; - else - *preason = VSL_r_unknown; + if (er >= VSL_r__MAX) + er = VSL_r_unknown; + *preason = er; return (3); } From fgsch at lodoss.net Fri Sep 4 13:54:51 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 0bdcee4 Spelling and minor fixes Message-ID: commit 0bdcee4f4a7c38f0e718d53b246b76c952966fc4 Author: Federico G. Schwindt Date: Tue Jul 21 00:50:02 2015 +0100 Spelling and minor fixes diff --git a/doc/sphinx/installation/help.rst b/doc/sphinx/installation/help.rst index 14746e7..22cd106 100644 --- a/doc/sphinx/installation/help.rst +++ b/doc/sphinx/installation/help.rst @@ -65,7 +65,7 @@ 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. -We also maintain a community wiki_ for Varnish, there you will find information on planned events, meetings, current backlog, troube tickets , and links to resources and documentation. +We also maintain a community wiki_ for Varnish, there you will find information on planned events, meetings, current backlog, trouble tickets , and links to resources and documentation. .. XXX: we should introduce the wiki (if we care about it) before .. we start referring to it (below). Make a wiki chapter? diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst index ec73438..8eb11ed 100644 --- a/doc/sphinx/reference/index.rst +++ b/doc/sphinx/reference/index.rst @@ -32,9 +32,9 @@ The Varnish Reference Manual . - counters explained . common filtering options for shmlog tools . varnishlog .. - . varnsihtop .. - . varnsihncsa .. - . varnsihhist .. + . varnishtop .. + . varnishncsa .. + . varnishhist .. The CLI: . connections: -T -S -M . varnishadm diff --git a/doc/sphinx/reference/varnishadm.rst b/doc/sphinx/reference/varnishadm.rst index 76f5d3f..f671d8f 100644 --- a/doc/sphinx/reference/varnishadm.rst +++ b/doc/sphinx/reference/varnishadm.rst @@ -50,7 +50,7 @@ OPTIONS The syntax and operation of the actual CLI interface is described in -the :ref:`varnish-cli(7)` manual page. Parameteres are described in +the :ref:`varnish-cli(7)` manual page. Parameters are described in :ref:`varnishd(1)` manual page. Additionally, a summary of commands can be obtained by issuing the diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index e2c1fc8..e833706 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -58,7 +58,7 @@ The following options are available: any seconds. If zero the connection is attempted only once and will fail immediately if unsuccessful. If set to "off", the connection will not fail, allowing the utility to start and - wait indefinetely for the Varnish instance to appear. + wait indefinitely for the Varnish instance to appear. Defaults to 5 seconds. -V diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 2246dd6..b6d7702 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -306,15 +306,14 @@ To match an IP address against an ACL, simply use the match operator:: VCL objects ----------- -A VCL object can be made with the *new* keyword. - -Example:: +A VCL object can be instantiated with the *new* keyword:: sub vcl_init { new b = directors.round_robin() b.add_backend(node1); } +This is only available in vcl_init. Subroutines ----------- @@ -379,9 +378,6 @@ hash_data(input) Adds an input to the hash input. In the built-in VCL hash_data() is called on the host and URL of the *request*. Available in vcl_hash. -new() - Instanciate a new VCL object. Available in vcl_init. - rollback() Restore *req* HTTP headers to their original state. This function is deprecated. Use std.rollback() instead. diff --git a/doc/sphinx/reference/vsm.rst b/doc/sphinx/reference/vsm.rst index cdae8e7..13afbdd 100644 --- a/doc/sphinx/reference/vsm.rst +++ b/doc/sphinx/reference/vsm.rst @@ -34,7 +34,7 @@ tricky in ways a regular logfile is not. When you open a file in "append" mode, the operating system guarantees that whatever you write will not overwrite existing data in the file. -The neat result of this is that multiple procesess or threads writing +The neat result of this is that multiple processes or threads writing to the same file does not even need to know about each other, it all works just as you would expect. From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 1ff5897 Make -a argument checking a two step process: Message-ID: commit 1ff5897b6d18954fc209b68270c637a510f30e79 Author: Poul-Henning Kamp Date: Sun Jul 26 09:39:13 2015 +0000 Make -a argument checking a two step process: We always do the DNS resolution when we hit -a arguments, but the test that we can bind to the address is postponed until after the -C argument processing. Fixes: #1767 diff --git a/bin/varnishd/common/heritage.h b/bin/varnishd/common/heritage.h index 05f340a..27c3a33 100644 --- a/bin/varnishd/common/heritage.h +++ b/bin/varnishd/common/heritage.h @@ -37,8 +37,8 @@ struct listen_sock { #define LISTEN_SOCK_MAGIC 0x999e4b57 VTAILQ_ENTRY(listen_sock) list; int sock; - const char *name; - const struct suckaddr *addr; + char *name; + struct suckaddr *addr; enum sess_step first_step; const char *proto_name; }; diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h index 2b680c6..18356dc 100644 --- a/bin/varnishd/mgt/mgt.h +++ b/bin/varnishd/mgt/mgt.h @@ -42,6 +42,7 @@ extern int exit_status; /* mgt_acceptor.c */ void MAC_Arg(const char *); +void MAC_Validate(void); void MAC_reopen_sockets(struct cli *); int MAC_sockets_ready(struct cli *); diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index b85c391..a956b27 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -112,9 +112,8 @@ MAC_sockets_ready(struct cli *cli) struct mac_help { unsigned magic; #define MAC_HELP_MAGIC 0x1e00a9d9 - const char *name; int good; - const char **err; + const char *name; const char *proto_name; enum sess_step first_step; }; @@ -124,47 +123,55 @@ mac_callback(void *priv, const struct suckaddr *sa) { struct mac_help *mh; struct listen_sock *ls; - int fail; - char abuf[VTCP_ADDRBUFSIZE], pbuf[VTCP_PORTBUFSIZE]; - char nbuf[VTCP_ADDRBUFSIZE+VTCP_PORTBUFSIZE+2]; CAST_OBJ_NOTNULL(mh, priv, MAC_HELP_MAGIC); ALLOC_OBJ(ls, LISTEN_SOCK_MAGIC); AN(ls); ls->sock = -1; - ls->addr = sa; - ls->proto_name = mh->proto_name; - ls->first_step = mh->first_step; - VJ_master(JAIL_MASTER_PRIVPORT); - fail = mac_opensocket(ls, NULL); - VJ_master(JAIL_MASTER_LOW); - if (ls->sock < 0) { - *(mh->err) = strerror(fail); - FREE_OBJ(ls); - return (0); - } - if (VSA_Port(sa) == 0) { - /* - * If the port number is zero, we adopt whatever port number - * this VTCP_bind() found us, as if specified by argument. - */ - ls->addr = VTCP_my_suckaddr(ls->sock); - VTCP_myname(ls->sock, abuf, sizeof abuf, pbuf, sizeof pbuf); - bprintf(nbuf, "%s:%s", abuf, pbuf); - ls->name = strdup(nbuf); - } else { - ls->addr = VSA_Clone(sa); - ls->name = strdup(mh->name); - } + ls->addr = VSA_Clone(sa); AN(ls->addr); + ls->name = strdup(mh->name); AN(ls->name); + ls->proto_name = mh->proto_name; + ls->first_step = mh->first_step; VTAILQ_INSERT_TAIL(&heritage.socks, ls, list); mh->good++; return (0); } void +MAC_Validate(void) +{ + struct listen_sock *ls; + int fail; + char abuf[VTCP_ADDRBUFSIZE], pbuf[VTCP_PORTBUFSIZE]; + char nbuf[VTCP_ADDRBUFSIZE+VTCP_PORTBUFSIZE+2]; + + VTAILQ_FOREACH(ls, &heritage.socks, list) { + VJ_master(JAIL_MASTER_PRIVPORT); + fail = mac_opensocket(ls, NULL); + VJ_master(JAIL_MASTER_LOW); + if (ls->sock < 0) + ARGV_ERR("Cannot open socket: %s: %s\n", + ls->name, strerror(fail)); + if (VSA_Port(ls->addr) == 0) { + /* + * If the port number is zero, we adopt whatever + * port number this VTCP_bind() found us, as if + * specified by argument. + */ + free(ls->addr); + ls->addr = VTCP_my_suckaddr(ls->sock); + VTCP_myname(ls->sock, abuf, sizeof abuf, + pbuf, sizeof pbuf); + bprintf(nbuf, "%s:%s", abuf, pbuf); + REPLACE(ls->name, nbuf); + } + } +} + +void MAC_Arg(const char *arg) { char **av; @@ -192,11 +199,9 @@ MAC_Arg(const char *arg) ARGV_ERR("Unknown protocol '%s'\n", av[2]); } - mh->err = &err; error = VSS_resolver(av[1], "80", mac_callback, mh, &err); - if (mh->good == 0 || err != NULL) - ARGV_ERR("Could not bind to address %s: %s\n", av[1], err); + if (mh->good == 0 || error) + ARGV_ERR("socket %s didn't resolve \n", av[1]); VAV_Free(av); - AZ(error); FREE_OBJ(mh); } diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index 56c51b7..0ae5338 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -497,7 +497,7 @@ main(int argc, char * const *argv) /* Create a cli for convenience in otherwise CLI functions */ INIT_OBJ(cli, CLI_MAGIC); cli[0].sb = VSB_new_auto(); - XXXAN(cli[0].sb); + AN(cli[0].sb); cli[0].result = CLIS_OK; clilim = 32768; cli[0].limit = &clilim; @@ -510,11 +510,6 @@ main(int argc, char * const *argv) init_params(cli); cli_check(cli); - if (argc == 1) { - jailed++; - VJ_Init(NULL); - } - while ((o = getopt(argc, argv, "a:b:Cdf:Fh:i:j:l:M:n:P:p:r:S:s:T:t:VW:x:")) != -1) { /* @@ -632,6 +627,9 @@ main(int argc, char * const *argv) } } + if (!jailed) + VJ_Init(NULL); + argc -= optind; argv += optind; if (argc != 0) @@ -705,7 +703,9 @@ main(int argc, char * const *argv) ARGV_ERR("-C only good with -b or -f\n"); if (VTAILQ_EMPTY(&heritage.socks)) - MAC_Arg("*:80"); + MAC_Arg(":80"); + + MAC_Validate(); assert(! VTAILQ_EMPTY(&heritage.socks)); diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc index 2acb66b..f2efcce 100644 --- a/bin/varnishtest/tests/c00003.vtc +++ b/bin/varnishtest/tests/c00003.vtc @@ -4,7 +4,11 @@ varnishtest "Check that we fail to start if any listen address does not work" # and are on Linux, ensure /proc/net/ipv4/ip_nonlocal_bind is set to 0. # All bad listen addresses -err_shell "Could not bind to address 192.0.2.255:0" {${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 } +err_shell "could not be resolved to an IP address" { + ${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 +} # old style address list -err_shell "Unknown protocol" {${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 } +err_shell "Unknown protocol" { + ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 +} From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 4df51cf Try to sort out the delivery of resp.body for special resp.status cases. Message-ID: commit 4df51cf26691e875682a39b279cd03f7e202fae8 Author: Poul-Henning Kamp Date: Sun Jul 26 14:40:22 2015 +0000 Try to sort out the delivery of resp.body for special resp.status cases. Treat C-L or A-E in 204 backend responses as fetch_error. This hopefully fixes #1761 diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 2df4481..6719345 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -655,7 +655,7 @@ struct sess { * or may not, be talking a "real" HTTP protocol itself. */ -typedef void vtr_deliver_f (struct req *, struct busyobj *); +typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); struct transport { unsigned magic; diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 9aeba38..aa011b6 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -703,7 +703,7 @@ ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv, /*--------------------------------------------------------------------*/ static void __match_proto__(vtr_deliver_f) -VED_Deliver(struct req *req, struct busyobj *bo) +VED_Deliver(struct req *req, struct busyobj *bo, int wantbody) { int i; struct ecx *ecx; @@ -714,6 +714,9 @@ VED_Deliver(struct req *req, struct busyobj *bo) CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC); + if (wantbody == 0) + return; + req->res_mode |= RES_ESI_CHILD; i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED); if (ecx->isgzip && i && !(req->res_mode & RES_ESI)) { diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 12703bd..aa1f4cf 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -345,7 +345,11 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) * [RFC2616 10.2.5 p60] */ wrk->stats->fetch_204++; - bo->htc->body_status = BS_NONE; + if (http_GetHdr(bo->beresp, H_Content_Length, NULL) || + http_GetHdr(bo->beresp, H_Transfer_Encoding, NULL)) + bo->htc->body_status = BS_ERROR; + else + bo->htc->body_status = BS_NONE; } else if (http_IsStatus(bo->beresp, 304)) { /* * 304 is "Not Modified" it has no body. diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 23c9925..6122984 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -191,7 +191,10 @@ VRG_dorange(struct req *req, const char *r) "Content-Range: bytes */%jd", (intmax_t)req->resp_len); http_PutResponse(req->resp, "HTTP/1.1", 416, NULL); - req->resp_len = -1; - req->wantbody = 0; + /* + * XXX: We ought to produce a body explaining things. + * XXX: That really calls for us to hit vcl_synth{} + */ + req->resp_len = 0; } } diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index b0fe1e7..46f777e 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -51,9 +51,23 @@ static void cnt_vdp(struct req *req, struct busyobj *bo) { const char *r; + uint16_t status; + int wantbody; + CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); req->res_mode = 0; - if (bo != NULL) + wantbody = 1; + status = http_GetStatus(req->resp); + if (!strcmp(req->http0->hd[HTTP_HDR_METHOD].b, "HEAD")) { + wantbody = 0; + } else if (status < 200 || status == 204) { + req->resp_len = 0; + http_Unset(req->resp, H_Content_Length); + wantbody = 0; + } else if (status == 304) { + http_Unset(req->resp, H_Content_Length); + wantbody = 0; + } else if (bo != NULL) req->resp_len = http_GetContentLength(req->resp); else req->resp_len = ObjGetLen(req->wrk, req->objcore); @@ -62,7 +76,7 @@ cnt_vdp(struct req *req, struct busyobj *bo) * Determine ESI status first. Not dependent on wantbody, because * we want ESI to supress C-L in HEAD too. */ - if (!req->disable_esi && + if (!req->disable_esi && req->resp_len != 0 && wantbody && ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) { req->res_mode |= RES_ESI; RFC2616_Weaken_Etag(req->resp); @@ -70,7 +84,6 @@ cnt_vdp(struct req *req, struct busyobj *bo) VDP_push(req, VDP_ESI, NULL, 0); } - if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && !RFC2616_Req_Gzip(req->http)) { @@ -80,18 +93,15 @@ cnt_vdp(struct req *req, struct busyobj *bo) /* * Range comes after the others and pushes on bottom because - * it can generate a correct C-L header. + * it can (maybe) generate a correct C-L header. */ - if (cache_param->http_range_support && - http_IsStatus(req->resp, 200)) { + if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { http_SetHeader(req->resp, "Accept-Ranges: bytes"); - if (req->wantbody && - http_GetHdr(req->http, H_Range, &r)) + if (wantbody && http_GetHdr(req->http, H_Range, &r)) VRG_dorange(req, r); } - CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); - req->transport->deliver(req, bo); + req->transport->deliver(req, bo, wantbody); } /*-------------------------------------------------------------------- @@ -174,13 +184,8 @@ cnt_deliver(struct worker *wrk, struct req *req) if (!(req->objcore->flags & OC_F_PASS) && req->esi_level == 0 && http_IsStatus(req->resp, 200) - && req->http->conds && RFC2616_Do_Cond(req)) { + && req->http->conds && RFC2616_Do_Cond(req)) http_PutResponse(req->resp, "HTTP/1.1", 304, NULL); - req->wantbody = 0; - } - - if (http_IsStatus(req->resp, 304)) - req->wantbody = 0; /* Grab a ref to the bo if there is one, and hand it down */ bo = HSH_RefBusy(req->objcore); @@ -690,11 +695,6 @@ cnt_recv(struct worker *wrk, struct req *req) assert(wrk->handling == VCL_RET_LOOKUP); SHA256_Final(req->digest, &sha256ctx); - if (!strcmp(req->http->hd[HTTP_HDR_METHOD].b, "HEAD")) - req->wantbody = 0; - else - req->wantbody = 1; - switch(recv_handling) { case VCL_RET_PURGE: req->req_step = R_STP_PURGE; diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index f0762df..324947b 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -62,7 +62,7 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, */ void __match_proto__(vtr_deliver_f) -V1D_Deliver(struct req *req, struct busyobj *bo) +V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) { enum objiter_status ois; @@ -70,20 +70,18 @@ V1D_Deliver(struct req *req, struct busyobj *bo) CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); - if ((req->objcore->flags & OC_F_PRIVATE) && - !strcasecmp(http_GetMethod(req->http0), "HEAD")) { - /* HEAD+pass is allowed to send the C-L through unmolested. */ - } else { + if (wantbody) { http_Unset(req->resp, H_Content_Length); - if (req->resp_len >= 0 && !http_IsStatus(req->resp, 304)) + if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Length: %jd", req->resp_len); } - if (http_GetHdr(req->resp, H_Content_Length, NULL)) + if (req->resp_len == 0) + wantbody = 0; + else if (http_GetHdr(req->resp, H_Content_Length, NULL)) req->res_mode |= RES_LEN; - - else if (req->wantbody) { + else if (wantbody) { if (req->http->protover == 11) { req->res_mode |= RES_CHUNKED; http_SetHeader(req->resp, "Transfer-Encoding: chunked"); @@ -112,7 +110,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo) (void)V1L_Flush(req->wrk); ois = OIS_DONE; - if (req->wantbody) { + if (wantbody) { if (req->res_mode & RES_CHUNKED) V1L_Chunked(req->wrk); ois = VDP_DeliverObj(req); diff --git a/bin/varnishtest/tests/c00034.vtc b/bin/varnishtest/tests/c00034.vtc index 0170b22..b1698cd 100644 --- a/bin/varnishtest/tests/c00034.vtc +++ b/bin/varnishtest/tests/c00034.vtc @@ -31,6 +31,8 @@ client c1 { rxresp expect resp.status == 416 expect resp.bodylen == 0 + expect resp.http.content-length == "0" + expect resp.http.transfer-encoding == "" expect resp.http.content-range == "bytes */100" txreq -hdr "Range: bytes=0- 9" diff --git a/bin/varnishtest/tests/g00001.vtc b/bin/varnishtest/tests/g00001.vtc index ccdc39e..a1343fe 100644 --- a/bin/varnishtest/tests/g00001.vtc +++ b/bin/varnishtest/tests/g00001.vtc @@ -22,6 +22,8 @@ client c1 { expect resp.bodylen == "3" } -run +delay .1 + client c1 { txreq -proto HTTP/1.0 rxresp @@ -29,6 +31,8 @@ client c1 { expect resp.http.content-encoding == } -run +delay .1 + client c1 { txreq -req HEAD rxresp -no_obj diff --git a/bin/varnishtest/tests/r01746.vtc b/bin/varnishtest/tests/r01746.vtc index 30c6137..46793f8 100644 --- a/bin/varnishtest/tests/r01746.vtc +++ b/bin/varnishtest/tests/r01746.vtc @@ -6,8 +6,7 @@ server s1 { rxreq expect req.url == /b txresp -status 204 -nolen \ - -hdr "Content-encoding: gzip" \ - -hdr "content-length: 10" + -hdr "Content-encoding: gzip" } -start varnish v1 -vcl+backend { diff --git a/include/tbl/req_flags.h b/include/tbl/req_flags.h index 389cc51..55bdc74 100644 --- a/include/tbl/req_flags.h +++ b/include/tbl/req_flags.h @@ -34,5 +34,4 @@ REQ_FLAG(disable_esi, 0, 0, "") REQ_FLAG(hash_ignore_busy, 1, 1, "") REQ_FLAG(hash_always_miss, 1, 1, "") REQ_FLAG(is_hit, 0, 0, "") -REQ_FLAG(wantbody, 0, 0, "") /*lint -restore */ From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 82a09dc minor polish Message-ID: commit 82a09dcd12269368517aa40acdf3f24cdf30f52f Author: Poul-Henning Kamp Date: Mon Jul 27 07:20:07 2015 +0000 minor polish diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index aa1f4cf..539fee1 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -883,7 +883,7 @@ static enum fetch_step vbf_stp_done(void) { WRONG("Just plain wrong"); - return (F_STP_DONE); + NEEDLESS_RETURN(F_STP_DONE); } static void __match_proto__(task_func_t) diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c index 89e63b0..b78d2f4 100644 --- a/lib/libvcc/vcc_storage.c +++ b/lib/libvcc/vcc_storage.c @@ -76,11 +76,10 @@ vcc_Stv_mkvar(struct vcc *tl, const struct token *t, enum var_type fmt) AN(v); v->name = TlDupTok(tl, t); - v->r_methods = 0 -#define VCL_MET_MAC(l,u,b) | VCL_MET_##u + v->r_methods = 0; +#define VCL_MET_MAC(l,u,b) v->r_methods |= VCL_MET_##u; #include "tbl/vcl_returns.h" #undef VCL_MET_MAC - ; v->fmt = fmt; return (v); From fgsch at lodoss.net Fri Sep 4 13:54:51 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 9c63dbb Correct parameter name Message-ID: commit 9c63dbba81423ba581597163915a2392e562fc36 Author: Federico G. Schwindt Date: Tue Jul 28 22:59:37 2015 +0100 Correct parameter name This does say something about how much is used though. diff --git a/doc/sphinx/phk/persistent.rst b/doc/sphinx/phk/persistent.rst index 6c1d29c..536e406 100644 --- a/doc/sphinx/phk/persistent.rst +++ b/doc/sphinx/phk/persistent.rst @@ -16,7 +16,7 @@ it, and we don't presently have the development resources to fix that. If you think you have these circumstances, you need to specify - -sdeprecated_persistence + -sdeprecated_persistent in order to use it. From fgsch at lodoss.net Fri Sep 4 13:54:51 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] bdf1235 Parameters cleanup Message-ID: commit bdf1235857c9734d6ec21db10c119dcdc4b48442 Author: Federico G. Schwindt Date: Tue Jul 28 23:30:38 2015 +0100 Parameters cleanup Add missing ones, make the order consistent and remove deprecated options. More to come. diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index 0ae5338..37b1985 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -141,15 +141,15 @@ usage(void) #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishd [options]\n"); - fprintf(stderr, FMT, "-a address:port", "HTTP listen address and port" - " (default: *:80)"); + fprintf(stderr, FMT, "-a address:port,proto", + "HTTP listen address and port (default: *:80)"); fprintf(stderr, FMT, "-b address:port", "backend address and port"); fprintf(stderr, FMT, "", " -b "); fprintf(stderr, FMT, "", " -b ':'"); fprintf(stderr, FMT, "-C", "print VCL code compiled to C language"); fprintf(stderr, FMT, "-d", "debug"); - fprintf(stderr, FMT, "-f file", "VCL script"); fprintf(stderr, FMT, "-F", "Run in foreground"); + fprintf(stderr, FMT, "-f file", "VCL script"); fprintf(stderr, FMT, "-h kind[,hashoptions]", "Hash specification"); fprintf(stderr, FMT, "", " -h critbit [default]"); fprintf(stderr, FMT, "", " -h simple_list"); @@ -162,15 +162,17 @@ usage(void) #endif fprintf(stderr, FMT, "", " -j unix[,user=][,ccgroup=]"); fprintf(stderr, FMT, "", " -j none"); - fprintf(stderr, FMT, "-l shl,free,fill", "Size of shared memory file"); + fprintf(stderr, FMT, "-l shl,free", "Size of shared memory file"); fprintf(stderr, FMT, "", " shl: space for SHL records [80m]"); fprintf(stderr, FMT, "", " free: space for other allocations [1m]"); - fprintf(stderr, FMT, "", " fill: prefill new file [+]"); - fprintf(stderr, FMT, "-M address:port", "Reverse CLI destination."); + fprintf(stderr, FMT, "-M address:port", "Reverse CLI destination"); fprintf(stderr, FMT, "-n dir", "varnishd working directory"); fprintf(stderr, FMT, "-P file", "PID file"); fprintf(stderr, FMT, "-p param=value", "set parameter"); - fprintf(stderr, FMT, "-r param[,param...]", "make parameter read-only"); + fprintf(stderr, FMT, + "-r param[,param...]", "make parameter read-only"); + fprintf(stderr, FMT, "-S secret-file", + "Secret file for CLI authentication"); fprintf(stderr, FMT, "-s [name=]kind[,options]", "Backend storage specification"); fprintf(stderr, FMT, "", " -s malloc[,]"); @@ -181,12 +183,10 @@ usage(void) fprintf(stderr, FMT, "", " -s file,,"); fprintf(stderr, FMT, "", " -s file,,,"); - fprintf(stderr, FMT, "", " -s persist{experimental}"); - fprintf(stderr, FMT, "-S secret-file", - "Secret file for CLI authentication"); + fprintf(stderr, FMT, "", " -s persistent (experimental)"); fprintf(stderr, FMT, "-T address:port", "Telnet listen address and port"); - fprintf(stderr, FMT, "-t", "Default TTL"); + fprintf(stderr, FMT, "-t TTL", "Default TTL"); fprintf(stderr, FMT, "-V", "version"); fprintf(stderr, FMT, "-W waiter", "Waiter implementation"); #if defined(HAVE_KQUEUE) @@ -541,12 +541,12 @@ main(int argc, char * const *argv) case 'd': d_flag++; break; - case 'f': - f_arg = optarg; - break; case 'F': F_flag = 1 - F_flag; break; + case 'f': + f_arg = optarg; + break; case 'h': h_arg = optarg; break; @@ -591,19 +591,19 @@ main(int argc, char * const *argv) MCF_ParamProtect(cli, optarg); cli_check(cli); break; + case 'S': + S_arg = optarg; + break; case 's': s_arg_given = 1; STV_Config(optarg); break; - case 't': - MCF_ParamSet(cli, "default_ttl", optarg); - break; - case 'S': - S_arg = optarg; - break; case 'T': T_arg = optarg; break; + case 't': + MCF_ParamSet(cli, "default_ttl", optarg); + break; case 'V': /* XXX: we should print the ident here */ VCS_Message("varnishd"); diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 05b04da..33d60f6 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -15,7 +15,7 @@ HTTP accelerator daemon SYNOPSIS ======== -varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-f config] [-F] [-g group] [-h type[,options]] [-i identity] [-l shl[,free[,fill]]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...] [-s [name=]kind[,options]] [-S secret-file] [-T address[:port]] [-t TTL] [-u user] [-V] +varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l shl[,free]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter] DESCRIPTION =========== @@ -58,6 +58,10 @@ OPTIONS started explicitly with a CLI command. Terminating the parent process will also terminate the child. +-F + + Do not fork, run in the foreground. + -f config Use the specified VCL configuration file instead of the builtin @@ -66,16 +70,6 @@ OPTIONS When neither a -f nor a -b argument are given, `varnishd` will not start the worker process but process cli commands. --F - - Do not fork, run in the foreground. - --g group - - Specifies the name of an unprivileged group to which the child - process should switch before it starts accepting connections. This - is a shortcut for specifying the group run-time parameter. - -h Specifies the hash algorithm. See `Hash Algorithm Options`_ for a @@ -90,12 +84,12 @@ OPTIONS Specify the jailing technology to use. --l +-l Specifies size of shmlog file. shl is the store for the shared - memory log records [80M], free is the store for other allocations - [1M] and fill determines how the log is [+]. Scaling suffixes like - 'k', 'M' can be used up to (E)xabytes. Default is 80 Megabytes. + memory log records [80M] and free is the store for other allocations + [1M]. Scaling suffixes like 'k', 'M' can be used up to (E)xabytes. + Default is 81 Megabytes. -M @@ -129,6 +123,12 @@ OPTIONS *vcc_allow_inline_c* read only as these can potentially be used to escalate privileges from the CLI. +-S file + + Path to a file containing a secret used for authorizing access to + the management port. If not provided a new secret will be drawn + from the system PRNG. + -s <[name=]type[,options]> Use the specified storage backend, see `Storage Backend Options`_. @@ -136,12 +136,6 @@ OPTIONS This option can be used multiple times to specify multiple storage files. Names are referenced in logs, VCL, statistics, etc. --S file - - Path to a file containing a secret used for authorizing access to - the management port. If not provided a new secret will be drawn - from the system PRNG. - -T Offer a management interface on the specified address and port. See @@ -152,19 +146,14 @@ OPTIONS Specifies the default time to live (TTL) for cached objects. This is a shortcut for specifying the *default_ttl* run-time parameter. --u user - - Specifies the name of an unprivileged user to which the child - process should switch before it starts accepting connections. This - is a shortcut for specifying the user runtime parameter. - - If specifying both a user and a group, the user should be specified - first. - -V Display the version number and exit. +-W + + Specifies the waiter type to use. + .. _opt_h: Hash Algorithm Options From fgsch at lodoss.net Fri Sep 4 13:54:51 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] ed88811 Forgotten parameter in previous commit Message-ID: commit ed888115b2182d422c1d7240f4f2d82a7eb4dd2c Author: Federico G. Schwindt Date: Tue Jul 28 23:56:58 2015 +0100 Forgotten parameter in previous commit diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 33d60f6..378daff 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -150,7 +150,7 @@ OPTIONS Display the version number and exit. --W +-W waiter Specifies the waiter type to use. From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 8af37f4 Install the vtim.h header for use with external vmods Message-ID: commit 8af37f4cec29a963f29484c787dc3ae5086bc46c Author: Martin Blix Grydeland Date: Tue Jul 28 11:52:50 2015 +0200 Install the vtim.h header for use with external vmods diff --git a/include/Makefile.am b/include/Makefile.am index 2d4593e..8d21912 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -57,7 +57,8 @@ nobase_pkginclude_HEADERS += \ vrt_obj.h \ vsa.h \ vsb.h \ - vsha256.h + vsha256.h \ + vtim.h # Private headers nobase_noinst_HEADERS = \ @@ -86,7 +87,6 @@ nobase_noinst_HEADERS = \ vsub.h \ vss.h \ vtcp.h \ - vtim.h \ vtree.h \ vut.h \ vut_options.h From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 3ba970e Teach vmodtool.py's tokenizer quotes Message-ID: commit 3ba970ecf269fc10dd1e210db27870284147dcad Author: Martin Blix Grydeland Date: Wed Jul 29 14:38:50 2015 +0200 Teach vmodtool.py's tokenizer quotes diff --git a/bin/varnishtest/tests/m00019.vtc b/bin/varnishtest/tests/m00019.vtc index f7b2386..89ad9b0 100644 --- a/bin/varnishtest/tests/m00019.vtc +++ b/bin/varnishtest/tests/m00019.vtc @@ -22,12 +22,12 @@ client c1 { txreq rxresp expect resp.bodylen == "6" - expect resp.http.foo1 == "1 2 3" - expect resp.http.foo2 == "1 2 3" - expect resp.http.foo3 == "1 2 3" - expect resp.http.foo4 == "1 2 3" - expect resp.http.foo5 == "1 2 3" - expect resp.http.foo6 == "1 2 3" + expect resp.http.foo1 == "1 2 3 ," + expect resp.http.foo2 == "1 2 3 ," + expect resp.http.foo3 == "1 2 3 ," + expect resp.http.foo4 == "1 2 3 ," + expect resp.http.foo5 == "1 2 3 ," + expect resp.http.foo6 == "1 2 3 ," } -run delay .1 diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index ce27df2..4db94a3 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -739,6 +739,22 @@ class FileSection(object): return l = re.sub("[ \t]*#.*$", "", l) l = re.sub("[ \t]*\n", "", l) + + if re.match("['\"]", l): + m = re.match("(['\"]).*?(\\1)", l) + if not m: + raise FormatError("Unbalanced quote", + "Unbalanced quote on line %d" % ln) + self.tl.append(Token(ln, 0, l[:m.end()])) + self.l.insert(0, (ln, l[m.end():])) + return + + m = re.search("['\"]", l) + if m: + rest = l[m.start():] + self.l.insert(0, (ln, rest)) + l = l[:m.start()] + l = re.sub("([(){},=])", r' \1 ', l) if l == "": return diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 3a60814..8b32e92 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -94,7 +94,8 @@ $Function VOID rot52(HTTP hdr) Encrypt the HTTP header with quad-ROT13 encryption, (this is approx 33% better than triple-DES). -$Function STRING argtest(STRING one, REAL two=2, STRING three="3") +$Function STRING argtest(STRING one, REAL two=2, STRING three="3", + STRING comma=",") $Function INT vre_limit() diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index ce2e22b..4d86baa 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -177,11 +177,12 @@ vmod_rot52(VRT_CTX, VCL_HTTP hp) } VCL_STRING -vmod_argtest(VRT_CTX, VCL_STRING one, VCL_REAL two, VCL_STRING three) +vmod_argtest(VRT_CTX, VCL_STRING one, VCL_REAL two, VCL_STRING three, + VCL_STRING comma) { char buf[100]; - bprintf(buf, "%s %g %s", one, two, three); + bprintf(buf, "%s %g %s %s", one, two, three, comma); return WS_Copy(ctx->ws, buf, -1); } From lkarsten at varnish-software.com Fri Sep 4 13:54:51 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] f398f62 Lint. Message-ID: commit f398f62aaf0ad303660b4c403ffa388895d77405 Author: Lasse Karstensen Date: Thu Jul 30 12:41:11 2015 +0200 Lint. diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index a353c81..e41654d 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -179,7 +179,7 @@ VRB_Free(struct req *req) CHECK_OBJ_NOTNULL(req, REQ_MAGIC); if (req->body_oc != NULL) { - ObjFreeObj(req->wrk,req->body_oc); + ObjFreeObj(req->wrk, req->body_oc); FREE_OBJ(req->body_oc); req->body_oc = NULL; } diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index f3ab04a..07123fb 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -530,7 +530,7 @@ ses_close_acct(enum sess_close reason) } /*-------------------------------------------------------------------- - * Close a sessions connection. + * Close a session's connection. * XXX: Technically speaking we should catch a t_end timestamp here * XXX: for SES_Delete() to use. */ From lkarsten at varnish-software.com Fri Sep 4 13:54:51 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 559390d Correct wrong offset. Message-ID: commit 559390d049bdbb1fddb1a177589eda10a1118f41 Author: Lasse Karstensen Date: Thu Jul 30 18:03:04 2015 +0200 Correct wrong offset. "2eq" instead of "Req" didn't look right. diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c index 0b2d1b9..60fdd44 100644 --- a/bin/varnishd/cache/cache_ws.c +++ b/bin/varnishd/cache/cache_ws.c @@ -78,7 +78,7 @@ WS_Init(struct ws *ws, const char *id, void *space, unsigned len) ws->e = ws->s + len; *ws->e = 0x15; ws->f = ws->s; - assert(id[0] & 0x40); + assert(id[0] & 0x20); assert(strlen(id) < sizeof ws->id); strcpy(ws->id, id); WS_Assert(ws); @@ -90,7 +90,7 @@ WS_MarkOverflow(struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); - ws->id[0] &= ~0x40; // cheesy toupper() + ws->id[0] &= ~0x20; // cheesy toupper() } static void @@ -98,7 +98,7 @@ ws_ClearOverflow(struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); - ws->id[0] |= 0x40; // cheesy tolower() + ws->id[0] |= 0x20; // cheesy tolower() } /* @@ -255,7 +255,7 @@ WS_Overflowed(const struct ws *ws) { CHECK_OBJ_NOTNULL(ws, WS_MAGIC); - if (ws->id[0] & 0x40) + if (ws->id[0] & 0x20) return (0); return (1); } From lkarsten at varnish-software.com Fri Sep 4 13:54:51 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] a27ca77 Prepare 4.1.0-tp1. Message-ID: commit a27ca778baf16bb91cb763cb6d0d7c810434cd2b Author: Lasse Karstensen Date: Wed Jul 8 12:22:28 2015 +0200 Prepare 4.1.0-tp1. diff --git a/configure.ac b/configure.ac index 6c4d5f2..9675173 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2014 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.1.0-tp1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/redhat/varnish.spec b/redhat/varnish.spec index 9bce64d..c22bf26 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -4,7 +4,7 @@ %define __find_provides %{_builddir}/varnish-%{version}%{?v_rc:-%{?v_rc}}/redhat/find-provides Summary: High-performance HTTP accelerator Name: varnish -Version: 4.0.1 +Version: 4.1.0 #Release: 0.20140328%{?v_rc}%{?dist} Release: 1%{?v_rc}%{?dist} License: BSD From lkarsten at varnish-software.com Fri Sep 4 13:54:51 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] edf4762 Merge branch '4.1' of git.varnish-cache.org:varnish-cache into 4.1 Message-ID: commit edf476252764dea30a096782ce4988fda1265bd4 Merge: a27ca77 0e4e1bc Author: Lasse Karstensen Date: Fri Jul 31 11:17:15 2015 +0200 Merge branch '4.1' of git.varnish-cache.org:varnish-cache into 4.1 From lkarsten at varnish-software.com Fri Sep 4 13:54:51 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 1479325 Add req_top to the list of changes. Message-ID: commit 14793254fb0281e86f1f17da9b30b6946ee1d872 Author: Lasse Karstensen Date: Fri Jul 31 11:35:53 2015 +0200 Add req_top to the list of changes. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 2dd4a16..b7fd4da 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -102,6 +102,16 @@ Surrogate keys Not yet documented. +Passing data between ESI requests +================================= + +A new `req_top` identifier is available in VCL, which is a reference +to `req` in the top-level ESI request. + +This is useful to pass data back and forth between the main ESI request +and any ESI subrequests it lead to. + + Other noteworthy small changes ============================== From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 21ed397 Lock backend counter. Message-ID: commit 21ed397dd1cba4988e43879fd5b54fea02fd4475 Author: Poul-Henning Kamp Date: Mon Jul 27 07:29:35 2015 +0000 Lock backend counter. Submitted by: fgs diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 0591ec7..75adf78 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -105,6 +105,7 @@ vbe_dir_getfd(struct worker *wrk, struct backend *bp, struct busyobj *bo) Lck_Lock(&bp->mtx); bp->n_conn++; bp->vsc->conn++; + bp->vsc->req++; Lck_Unlock(&bp->mtx); VTCP_myname(vc->fd, abuf1, sizeof abuf1, pbuf1, sizeof pbuf1); @@ -112,7 +113,6 @@ vbe_dir_getfd(struct worker *wrk, struct backend *bp, struct busyobj *bo) VSLb(bo->vsl, SLT_BackendOpen, "%d %s %s %s %s %s", vc->fd, bp->display_name, abuf2, pbuf2, abuf1, pbuf1); - bp->vsc->req++; INIT_OBJ(bo->htc, HTTP_CONN_MAGIC); bo->htc->priv = vc; bo->htc->fd = vc->fd; From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] ccf1c0d Add an auto-indent facility to vsb's. Message-ID: commit ccf1c0d78154cd57f684003218849c457ff21c24 Author: Poul-Henning Kamp Date: Fri Jul 31 08:07:45 2015 +0000 Add an auto-indent facility to vsb's. diff --git a/include/vsb.h b/include/vsb.h index 72a2a99..eefaa12 100644 --- a/include/vsb.h +++ b/include/vsb.h @@ -48,6 +48,7 @@ struct vsb { #define VSB_FINISHED 0x00020000 /* set by VSB_finish() */ #define VSB_DYNSTRUCT 0x00080000 /* vsb must be freed */ int s_flags; /* flags */ + int s_indent; /* Ident level */ }; #ifdef __cplusplus @@ -75,6 +76,7 @@ char *VSB_data(const struct vsb *); ssize_t VSB_len(const struct vsb *); void VSB_delete(struct vsb *); void VSB_quote(struct vsb *s, const char *p, int len, int how); +void VSB_indent(struct vsb *, int); #ifdef __cplusplus }; #endif From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] fb06777 Implementation of VSB auto-indent facility Message-ID: commit fb06777292fe29f5571a2a406dc374ee450355c2 Author: Poul-Henning Kamp Date: Fri Jul 31 08:08:27 2015 +0000 Implementation of VSB auto-indent facility diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c index 1332844..be147c2 100644 --- a/lib/libvarnish/vsb.c +++ b/lib/libvarnish/vsb.c @@ -114,7 +114,6 @@ CTASSERT(powerof2(VSB_MAXEXTENDSIZE)); CTASSERT(powerof2(VSB_MAXEXTENDINCR)); #endif - static int VSB_extendsize(int size) { @@ -156,6 +155,21 @@ VSB_extend(struct vsb *s, int addlen) return (0); } +static void +_vsb_indent(struct vsb *s) +{ + if (s->s_indent == 0 || s->s_error != 0 || + s->s_buf[s->s_len - 1] != '\n') + return; + if (VSB_FREESPACE(s) <= s->s_indent && + VSB_extend(s, s->s_indent) < 0) { + s->s_error = ENOMEM; + return; + } + memset(s->s_buf + s->s_len, ' ', s->s_indent); + s->s_len += s->s_indent; +} + /* * Initialize the internals of an vsb. * If buf is non-NULL, it points to a static or already-allocated string @@ -231,6 +245,7 @@ VSB_clear(struct vsb *s) VSB_CLEARFLAG(s, VSB_FINISHED); s->s_error = 0; s->s_len = 0; + s->s_indent = 0; } /* @@ -247,6 +262,7 @@ VSB_put_byte(struct vsb *s, int c) if (s->s_error != 0) return; + _vsb_indent(s); if (VSB_FREESPACE(s) <= 0) { if (VSB_extend(s, 1) < 0) s->s_error = ENOMEM; @@ -270,6 +286,7 @@ VSB_bcat(struct vsb *s, const void *buf, size_t len) if (s->s_error != 0) return (-1); + _vsb_indent(s); for (; str < end; str++) { VSB_put_byte(s, *str); if (s->s_error != 0) @@ -316,6 +333,7 @@ VSB_vprintf(struct vsb *s, const char *fmt, va_list ap) if (s->s_error != 0) return (-1); + _vsb_indent(s); /* * For the moment, there is no way to get vsnprintf(3) to hand @@ -515,3 +533,18 @@ VSB_quote(struct vsb *s, const char *p, int len, int how) } (void)VSB_putc(s, '"'); } + +/* + * Indentation + */ + +void +VSB_indent(struct vsb * s, int i) +{ + + assert_VSB_integrity(s); + if (s->s_indent + i < 0) + s->s_error = EINVAL; + else + s->s_indent += i; +} From phk at FreeBSD.org Fri Sep 4 13:54:51 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 55e253f Roto-till the panic/backtrace output to use the VSB auto-indent. Message-ID: commit 55e253fd0405a96dcd77f31fbda416506515fb7d Author: Poul-Henning Kamp Date: Fri Jul 31 08:08:43 2015 +0000 Roto-till the panic/backtrace output to use the VSB auto-indent. Based largely on patch from: Martin I wonder if we should make the panic output (readable) JSON format ? diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 75adf78..092abb3 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -319,17 +319,17 @@ vbe_panic(const struct director *d, struct vsb *vsb) CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); - VSB_printf(vsb, " display_name = %s\n", bp->display_name); + VSB_printf(vsb, "display_name = %s\n", bp->display_name); if (bp->ipv4_addr != NULL) - VSB_printf(vsb, " ipv4 = %s\n", bp->ipv4_addr); + VSB_printf(vsb, "ipv4 = %s\n", bp->ipv4_addr); if (bp->ipv6_addr != NULL) - VSB_printf(vsb, " ipv6 = %s\n", bp->ipv6_addr); - VSB_printf(vsb, " port = %s\n", bp->port); - VSB_printf(vsb, " hosthdr = %s\n", bp->hosthdr); - VSB_printf(vsb, " health=%s, admin_health=%s", + VSB_printf(vsb, "ipv6 = %s\n", bp->ipv6_addr); + VSB_printf(vsb, "port = %s\n", bp->port); + VSB_printf(vsb, "hosthdr = %s\n", bp->hosthdr); + VSB_printf(vsb, "health=%s, admin_health=%s", bp->healthy ? "healthy" : "sick", bp->admin_health); VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed); - VSB_printf(vsb, " n_conn = %u\n", bp->n_conn); + VSB_printf(vsb, "n_conn = %u\n", bp->n_conn); } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c index f7e0479..b6d0944 100644 --- a/bin/varnishd/cache/cache_director.c +++ b/bin/varnishd/cache/cache_director.c @@ -187,10 +187,15 @@ VDI_Panic(const struct director *d, struct vsb *vsb, const char *nm) { if (d == NULL) return; - VSB_printf(vsb, " %s = %p {\n", nm, d); - VSB_printf(vsb, " vcl_name = %s\n", d->vcl_name); - VSB_printf(vsb, " name = %s\n", d->name); + VSB_printf(vsb, "%s = %p {\n", nm, d); + VSB_indent(vsb, 2); + VSB_printf(vsb, "vcl_name = %s\n", d->vcl_name); + VSB_printf(vsb, "type = %s {\n", d->name); + VSB_indent(vsb, 2); if (d->panic != NULL) d->panic(d, vsb); - VSB_printf(vsb, " }\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "}\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "}\n"); } diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index bfe3e70..873c5e0 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -58,10 +58,10 @@ * (gdb) printf "%s", panicstr */ -static struct vsb pan_vsp_storage, *pan_vsp; +static struct vsb pan_vsb_storage, *pan_vsb; static pthread_mutex_t panicstr_mtx = PTHREAD_MUTEX_INITIALIZER; -static void pan_sess(const struct sess *sp); +static void pan_sess(struct vsb *, const struct sess *); /*--------------------------------------------------------------------*/ @@ -110,252 +110,206 @@ sess_close_2str(enum sess_close sc, int want_desc) /*--------------------------------------------------------------------*/ static void -pan_ws(const struct ws *ws, int indent) +pan_ws(struct vsb *vsb, const struct ws *ws) { - VSB_printf(pan_vsp, "%*sws = %p {", indent, "", ws); - if (!VALID_OBJ(ws, WS_MAGIC)) { - if (ws != NULL) - VSB_printf(pan_vsp, " BAD_MAGIC(0x%08x) ", ws->magic); - } else { - if (WS_Overflowed(ws)) - VSB_printf(pan_vsp, " OVERFLOW"); - VSB_printf(pan_vsp, - "\n%*sid = \"%s\",\n", indent + 2, "", ws->id); - VSB_printf(pan_vsp, - "%*s{s,f,r,e} = {%p", indent + 2, "", ws->s); - if (ws->f > ws->s) - VSB_printf(pan_vsp, ",+%ld", (long) (ws->f - ws->s)); - else - VSB_printf(pan_vsp, ",%p", ws->f); - if (ws->r > ws->s) - VSB_printf(pan_vsp, ",+%ld", (long) (ws->r - ws->s)); - else - VSB_printf(pan_vsp, ",%p", ws->r); - if (ws->e > ws->s) - VSB_printf(pan_vsp, ",+%ld", (long) (ws->e - ws->s)); - else - VSB_printf(pan_vsp, ",%p", ws->e); - } - VSB_printf(pan_vsp, "},\n"); - VSB_printf(pan_vsp, "%*s},\n", indent, "" ); + VSB_printf(vsb, "ws = %p {\n", ws); + VSB_indent(vsb, 2); + if (WS_Overflowed(ws)) + VSB_printf(vsb, " OVERFLOW"); + VSB_printf(vsb, "id = \"%s\",\n", ws->id); + VSB_printf(vsb, "{s,f,r,e} = {%p", ws->s); + if (ws->f > ws->s) + VSB_printf(vsb, ",+%ld", (long) (ws->f - ws->s)); + else + VSB_printf(vsb, ",%p", ws->f); + if (ws->r > ws->s) + VSB_printf(vsb, ",+%ld", (long) (ws->r - ws->s)); + else + VSB_printf(vsb, ",%p", ws->r); + if (ws->e > ws->s) + VSB_printf(vsb, ",+%ld", (long) (ws->e - ws->s)); + else + VSB_printf(vsb, ",%p", ws->e); + VSB_printf(vsb, "},\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void -pan_htc(const struct http_conn *htc) +pan_htc(struct vsb *vsb, const struct http_conn *htc) { - VSB_printf(pan_vsp, " http_conn = %p {\n", htc); - VSB_printf(pan_vsp, " fd = %d,\n", htc->fd); - VSB_printf(pan_vsp, " },\n"); + VSB_printf(vsb, "http_conn = %p {\n", htc); + VSB_indent(vsb, 2); + VSB_printf(vsb, "fd = %d,\n", htc->fd); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ -#if 0 static void -pan_storage(const struct storage *st) -{ - int i, j; - -#define MAX_BYTES (4*16) -#define show(ch) (((ch) > 31 && (ch) < 127) ? (ch) : '.') - - VSB_printf(pan_vsp, " %u {\n", st->len); - for (i = 0; i < MAX_BYTES && i < st->len; i += 16) { - VSB_printf(pan_vsp, " "); - for (j = 0; j < 16; ++j) { - if (i + j < st->len) - VSB_printf(pan_vsp, "%02x ", st->ptr[i + j]); - else - VSB_printf(pan_vsp, " "); - } - VSB_printf(pan_vsp, "|"); - for (j = 0; j < 16; ++j) - if (i + j < st->len) - VSB_printf(pan_vsp, - "%c", show(st->ptr[i + j])); - VSB_printf(pan_vsp, "|\n"); - } - if (st->len > MAX_BYTES) - VSB_printf(pan_vsp, - " [%u more]\n", st->len - MAX_BYTES); - VSB_printf(pan_vsp, " },\n"); - -#undef show -#undef MAX_BYTES -} -#endif - -/*--------------------------------------------------------------------*/ - -static void -pan_http(const char *id, const struct http *h, int indent) +pan_http(struct vsb *vsb, const char *id, const struct http *h) { int i; - VSB_printf(pan_vsp, "%*shttp[%s] = {\n", indent, "", id); - VSB_printf(pan_vsp, "%*sws = %p[%s]\n", indent + 2, "", - h->ws, h->ws ? h->ws->id : ""); + VSB_printf(vsb, "http[%s] = %p {\n", id, h); + VSB_indent(vsb, 2); + VSB_printf(vsb, "ws[%s] = %p\n", h->ws ? h->ws->id : "", h->ws); + VSB_printf(vsb, "hdrs {\n"); + VSB_indent(vsb, 2); for (i = 0; i < h->nhd; ++i) { if (h->hd[i].b == NULL && h->hd[i].e == NULL) continue; - VSB_printf(pan_vsp, "%*s\"%.*s\",\n", indent + 4, "", - (int)(h->hd[i].e - h->hd[i].b), - h->hd[i].b); + VSB_printf(vsb, "\"%.*s\",\n", + (int)(h->hd[i].e - h->hd[i].b), h->hd[i].b); } - VSB_printf(pan_vsp, "%*s},\n", indent, ""); -} - - -/*--------------------------------------------------------------------*/ - -#if 0 -static void -pan_object(const char *typ, const struct object *o) -{ - const struct storage *st; - - VSB_printf(pan_vsp, " obj (%s) = %p {\n", typ, o); - VSB_printf(pan_vsp, " vxid = %u,\n", VXID(vbe32dec(o->oa_vxid))); - pan_http("obj", o->http, 4); - VSB_printf(pan_vsp, " len = %jd,\n", (intmax_t)o->body->len); - VSB_printf(pan_vsp, " store = {\n"); - VTAILQ_FOREACH(st, &o->body->list, list) - pan_storage(st); - VSB_printf(pan_vsp, " },\n"); - VSB_printf(pan_vsp, " },\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } -#endif /*--------------------------------------------------------------------*/ static void -pan_objcore(const char *typ, const struct objcore *oc) +pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) { - VSB_printf(pan_vsp, " objcore (%s) = %p {\n", typ, oc); - VSB_printf(pan_vsp, " refcnt = %d\n", oc->refcnt); - VSB_printf(pan_vsp, " flags = 0x%x\n", oc->flags); - VSB_printf(pan_vsp, " objhead = %p\n", oc->objhead); - VSB_printf(pan_vsp, " stevedore = %p", oc->stobj->stevedore); + VSB_printf(vsb, "objcore[%s] = %p {\n", typ, oc); + VSB_indent(vsb, 2); + VSB_printf(vsb, "refcnt = %d\n", oc->refcnt); + VSB_printf(vsb, "flags = 0x%x\n", oc->flags); + VSB_printf(vsb, "objhead = %p\n", oc->objhead); + VSB_printf(vsb, "stevedore = %p", oc->stobj->stevedore); if (oc->stobj->stevedore != NULL) { - VSB_printf(pan_vsp, " (%s", oc->stobj->stevedore->name); + VSB_printf(vsb, " (%s", oc->stobj->stevedore->name); if (strlen(oc->stobj->stevedore->ident)) - VSB_printf(pan_vsp, " %s", oc->stobj->stevedore->ident); - VSB_printf(pan_vsp, ")"); + VSB_printf(vsb, " %s", oc->stobj->stevedore->ident); + VSB_printf(vsb, ")"); } - VSB_printf(pan_vsp, "\n"); - VSB_printf(pan_vsp, " }\n"); + VSB_printf(vsb, "\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "}\n"); } /*--------------------------------------------------------------------*/ static void -pan_wrk(const struct worker *wrk) +pan_wrk(struct vsb *vsb, const struct worker *wrk) { const char *hand; unsigned m, u; const char *p; - VSB_printf(pan_vsp, " worker = %p {\n", wrk); - VSB_printf(pan_vsp, " stack = {0x%jx -> 0x%jx}\n", + VSB_printf(vsb, "worker = %p {\n", wrk); + VSB_indent(vsb, 2); + VSB_printf(vsb, "stack = {0x%jx -> 0x%jx}\n", (uintmax_t)wrk->stack_start, (uintmax_t)wrk->stack_end); - pan_ws(wrk->aws, 4); + pan_ws(vsb, wrk->aws); m = wrk->cur_method; - VSB_printf(pan_vsp, " VCL::method = "); + VSB_printf(vsb, "VCL::method = "); if (m == 0) { - VSB_printf(pan_vsp, "none,\n"); + VSB_printf(vsb, "none,\n"); return; } if (!(m & 1)) - VSB_printf(pan_vsp, "*"); + VSB_printf(vsb, "inside "); m &= ~1; hand = VCL_Method_Name(m); if (hand != NULL) - VSB_printf(pan_vsp, "%s,\n", hand); + VSB_printf(vsb, "%s,\n", hand); else - VSB_printf(pan_vsp, "0x%x,\n", m); + VSB_printf(vsb, "0x%x,\n", m); + hand = VCL_Return_Name(wrk->handling); if (hand != NULL) - VSB_printf(pan_vsp, " VCL::return = %s,\n", hand); + VSB_printf(vsb, "VCL::return = %s,\n", hand); else - VSB_printf(pan_vsp, " VCL::return = 0x%x,\n", wrk->handling); - VSB_printf(pan_vsp, " VCL::methods = {"); + VSB_printf(vsb, "VCL::return = 0x%x,\n", wrk->handling); + VSB_printf(vsb, "VCL::methods = {"); m = wrk->seen_methods; p = ""; for (u = 1; m ; u <<= 1) { if (m & u) { - VSB_printf(pan_vsp, "%s%s", p, VCL_Method_Name(u)); + VSB_printf(vsb, "%s%s", p, VCL_Method_Name(u)); m &= ~u; p = ", "; } } - VSB_printf(pan_vsp, "},\n },\n"); + VSB_printf(vsb, "},\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } static void -pan_busyobj(const struct busyobj *bo) +pan_busyobj(struct vsb *vsb, const struct busyobj *bo) { struct vfp_entry *vfe; + const char *p; - VSB_printf(pan_vsp, " busyobj = %p {\n", bo); - pan_ws(bo->ws, 4); - VSB_printf(pan_vsp, " refcnt = %u\n", bo->refcount); - VSB_printf(pan_vsp, " retries = %d\n", bo->retries); - VSB_printf(pan_vsp, " failed = %d\n", bo->vfc->failed); - VSB_printf(pan_vsp, " state = %d\n", (int)bo->state); - VSB_printf(pan_vsp, " flags = {\n"); -#define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, " " #l "\n"); + VSB_printf(vsb, "busyobj = %p {\n", bo); + VSB_indent(vsb, 2); + pan_ws(vsb, bo->ws); + VSB_printf(vsb, "refcnt = %u\n", bo->refcount); + VSB_printf(vsb, "retries = %d, ", bo->retries); + VSB_printf(vsb, "failed = %d, ", bo->vfc->failed); + VSB_printf(vsb, "state = %d\n", (int)bo->state); + VSB_printf(vsb, "flags = {"); + p = ""; +#define BO_FLAG(l, r, w, d) \ + if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; } #include "tbl/bo_flags.h" #undef BO_FLAG - VSB_printf(pan_vsp, " }\n"); + VSB_printf(vsb, "}\n"); if (bo->htc != NULL) { - VSB_printf(pan_vsp, " bodystatus = %d (%s),\n", + VSB_printf(vsb, "bodystatus = %d (%s),\n", bo->htc->body_status, body_status_2str(bo->htc->body_status)); } if (!VTAILQ_EMPTY(&bo->vfc->vfp)) { - VSB_printf(pan_vsp, " filters ="); + VSB_printf(vsb, "filters ="); VTAILQ_FOREACH(vfe, &bo->vfc->vfp, list) - VSB_printf(pan_vsp, " %s=%d", + VSB_printf(vsb, " %s=%d", vfe->vfp->name, (int)vfe->closed); - VSB_printf(pan_vsp, "\n"); + VSB_printf(vsb, "\n"); } if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) - pan_htc(bo->htc); - VDI_Panic(bo->director_req, pan_vsp, "director_req"); + pan_htc(vsb, bo->htc); + VDI_Panic(bo->director_req, vsb, "director_req"); if (bo->director_resp == bo->director_req) - VSB_printf(pan_vsp, " director_resp = director_req\n"); + VSB_printf(vsb, "director_resp = director_req\n"); else - VDI_Panic(bo->director_resp, pan_vsp, "director_resp"); + VDI_Panic(bo->director_resp, vsb, "director_resp"); if (bo->bereq != NULL && bo->bereq->ws != NULL) - pan_http("bereq", bo->bereq, 4); + pan_http(vsb, "bereq", bo->bereq); if (bo->beresp != NULL && bo->beresp->ws != NULL) - pan_http("beresp", bo->beresp, 4); + pan_http(vsb, "beresp", bo->beresp); if (bo->fetch_objcore) - pan_objcore("FETCH", bo->fetch_objcore); + pan_objcore(vsb, "fetch", bo->fetch_objcore); if (bo->stale_oc) - pan_objcore("IMS", bo->stale_oc); - VSB_printf(pan_vsp, " }\n"); + pan_objcore(vsb, "ims", bo->stale_oc); + VSB_indent(vsb, -2); + VSB_printf(vsb, "}\n"); } /*--------------------------------------------------------------------*/ static void -pan_req(const struct req *req) +pan_req(struct vsb *vsb, const struct req *req) { const char *stp; - VSB_printf(pan_vsp, "req = %p {\n", req); + VSB_printf(vsb, "req = %p {\n", req); + VSB_indent(vsb, 2); - VSB_printf(pan_vsp, " sp = %p, vxid = %u,", - req->sp, VXID(req->vsl->wid)); + VSB_printf(vsb, "vxid = %u, ", VXID(req->vsl->wid)); switch (req->req_step) { #define REQ_STEP(l, u, arg) case R_STP_##u: stp = "R_STP_" #u; break; @@ -364,64 +318,65 @@ pan_req(const struct req *req) default: stp = NULL; } if (stp != NULL) - VSB_printf(pan_vsp, " step = %s,\n", stp); + VSB_printf(vsb, "step = %s,\n", stp); else - VSB_printf(pan_vsp, " step = 0x%x,\n", req->req_step); + VSB_printf(vsb, "step = 0x%x,\n", req->req_step); - VSB_printf(pan_vsp, " req_body = %s,\n", + VSB_printf(vsb, "req_body = %s,\n", reqbody_status_2str(req->req_body_status)); if (req->err_code) - VSB_printf(pan_vsp, + VSB_printf(vsb, " err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); - VSB_printf(pan_vsp, " restarts = %d, esi_level = %d,\n", + VSB_printf(vsb, "restarts = %d, esi_level = %d,\n", req->restarts, req->esi_level); if (req->sp != NULL) - pan_sess(req->sp); + pan_sess(vsb, req->sp); if (req->wrk != NULL) - pan_wrk(req->wrk); + pan_wrk(vsb, req->wrk); - pan_ws(req->ws, 2); - pan_http("req", req->http, 2); + pan_ws(vsb, req->ws); + pan_http(vsb, "req", req->http); if (req->resp->ws != NULL) - pan_http("resp", req->resp, 2); + pan_http(vsb, "resp", req->resp); - VCL_Panic(pan_vsp, req->vcl); + VCL_Panic(vsb, req->vcl); if (req->objcore != NULL) { - pan_objcore("REQ", req->objcore); + pan_objcore(vsb, "REQ", req->objcore); if (req->objcore->busyobj != NULL) - pan_busyobj(req->objcore->busyobj); + pan_busyobj(vsb, req->objcore->busyobj); } - VSB_printf(pan_vsp, " flags = {\n"); -#define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(pan_vsp, " " #l ",\n"); + VSB_printf(vsb, "flags = {\n"); +#define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, " " #l ",\n"); #include "tbl/req_flags.h" #undef REQ_FLAG - VSB_printf(pan_vsp, " }\n"); + VSB_printf(vsb, "}\n"); - VSB_printf(pan_vsp, "},\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void -pan_sess(const struct sess *sp) +pan_sess(struct vsb *vsb, const struct sess *sp) { const char *stp; char *ci; char *cp; - VSB_printf(pan_vsp, " sp = %p {\n", sp); - VSB_printf(pan_vsp, " fd = %d, vxid = %u,\n", - sp->fd, VXID(sp->vxid)); + VSB_printf(vsb, "sp = %p {\n", sp); + VSB_indent(vsb, 2); + VSB_printf(vsb, "fd = %d, vxid = %u,\n", sp->fd, VXID(sp->vxid)); AZ(SES_Get_client_ip(sp, &ci)); AZ(SES_Get_client_port(sp, &cp)); - VSB_printf(pan_vsp, " client = %s %s,\n", ci, cp); + VSB_printf(vsb, "client = %s %s,\n", ci, cp); switch (sp->sess_step) { #define SESS_STEP(l, u) case S_STP_##u: stp = "S_STP_" #u; break; #include "tbl/steps.h" @@ -429,17 +384,18 @@ pan_sess(const struct sess *sp) default: stp = NULL; } if (stp != NULL) - VSB_printf(pan_vsp, " step = %s,\n", stp); + VSB_printf(vsb, "step = %s,\n", stp); else - VSB_printf(pan_vsp, " step = 0x%x,\n", sp->sess_step); + VSB_printf(vsb, "step = 0x%x,\n", sp->sess_step); - VSB_printf(pan_vsp, " },\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ static void -pan_backtrace(void) +pan_backtrace(struct vsb *vsb) { void *array[10]; size_t size; @@ -450,24 +406,25 @@ pan_backtrace(void) size = backtrace (array, 10); if (size == 0) return; - VSB_printf(pan_vsp, "Backtrace:\n"); + VSB_printf(vsb, "Backtrace:\n"); + VSB_indent(vsb, 2); for (i = 0; i < size; i++) { - VSB_printf (pan_vsp, " "); - if (Symbol_Lookup(pan_vsp, array[i]) < 0) { + if (Symbol_Lookup(vsb, array[i]) < 0) { strings = backtrace_symbols(&array[i], 1); if (strings == NULL || strings[0] == NULL) { - VSB_printf(pan_vsp, "%p: (?)", array[i]); + VSB_printf(vsb, "%p: (?)", array[i]); } else { p = strrchr(strings[0], '/'); if (p == NULL) p = strings[0]; else p++; - VSB_printf(pan_vsp, "%p: %s", array[i], p); + VSB_printf(vsb, "%p: %s", array[i], p); } } - VSB_printf (pan_vsp, "\n"); + VSB_printf (vsb, "\n"); } + VSB_indent(vsb, -2); } /*--------------------------------------------------------------------*/ @@ -497,59 +454,59 @@ pan_ic(const char *func, const char *file, int line, const char *cond, switch(kind) { case VAS_WRONG: - VSB_printf(pan_vsp, + VSB_printf(pan_vsb, "Wrong turn at %s:%d:\n%s\n", file, line, cond); break; case VAS_VCL: - VSB_printf(pan_vsp, + VSB_printf(pan_vsb, "Panic from VCL:\n %s\n", cond); break; case VAS_MISSING: - VSB_printf(pan_vsp, + VSB_printf(pan_vsb, "Missing errorhandling code in %s(), %s line %d:\n" " Condition(%s) not true.", func, file, line, cond); break; case VAS_INCOMPLETE: - VSB_printf(pan_vsp, + VSB_printf(pan_vsb, "Incomplete code in %s(), %s line %d:\n", func, file, line); break; default: case VAS_ASSERT: - VSB_printf(pan_vsp, + VSB_printf(pan_vsb, "Assert error in %s(), %s line %d:\n" " Condition(%s) not true.\n", func, file, line, cond); break; } if (err) - VSB_printf(pan_vsp, "errno = %d (%s)\n", err, strerror(err)); + VSB_printf(pan_vsb, "errno = %d (%s)\n", err, strerror(err)); q = THR_GetName(); if (q != NULL) - VSB_printf(pan_vsp, "thread = (%s)\n", q); + VSB_printf(pan_vsb, "thread = (%s)\n", q); - VSB_printf(pan_vsp, "version = %s\n", VCS_version); - VSB_printf(pan_vsp, "ident = %s,%s\n", + VSB_printf(pan_vsb, "version = %s\n", VCS_version); + VSB_printf(pan_vsb, "ident = %s,%s\n", VSB_data(vident) + 1, Waiter_GetName()); - pan_backtrace(); + pan_backtrace(pan_vsb); if (!FEATURE(FEATURE_SHORT_PANIC)) { req = THR_GetRequest(); if (req != NULL) { - pan_req(req); + pan_req(pan_vsb, req); VSL_Flush(req->vsl, 0); } bo = THR_GetBusyobj(); if (bo != NULL) { - pan_busyobj(bo); + pan_busyobj(pan_vsb, bo); VSL_Flush(bo->vsl, 0); } } - VSB_printf(pan_vsp, "\n"); - VSB_bcat(pan_vsp, "", 1); /* NUL termination */ + VSB_printf(pan_vsb, "\n"); + VSB_bcat(pan_vsb, "", 1); /* NUL termination */ if (FEATURE(FEATURE_NO_COREDUMP)) exit(4); @@ -585,10 +542,10 @@ PAN_Init(void) { VAS_Fail = pan_ic; - pan_vsp = &pan_vsp_storage; + pan_vsb = &pan_vsb_storage; AN(heritage.panic_str); AN(heritage.panic_str_len); - AN(VSB_new(pan_vsp, heritage.panic_str, heritage.panic_str_len, + AN(VSB_new(pan_vsb, heritage.panic_str, heritage.panic_str_len, VSB_FIXEDLEN)); CLI_AddFuncs(debug_cmds); } diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index c10d949..dd49cda 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -86,12 +86,16 @@ VCL_Panic(struct vsb *vsb, const struct vcl *vcl) AN(vsb); if (vcl == NULL) return; - VSB_printf(vsb, " vcl = {\n"); - VSB_printf(vsb, " srcname = {\n"); + VSB_printf(vsb, "vcl = {\n"); + VSB_indent(vsb, 2); + VSB_printf(vsb, "srcname = {\n"); + VSB_indent(vsb, 2); for (i = 0; i < vcl->conf->nsrc; ++i) - VSB_printf(vsb, " \"%s\",\n", vcl->conf->srcname[i]); - VSB_printf(vsb, " },\n"); - VSB_printf(vsb, " },\n"); + VSB_printf(vsb, "\"%s\",\n", vcl->conf->srcname[i]); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 2223ff4 Fix prototype match Message-ID: commit 2223ff49c9be8110538839538592d88f709a49e0 Author: Martin Blix Grydeland Date: Thu Jul 30 15:31:10 2015 +0200 Fix prototype match diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 4d86baa..3dddbac 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -249,7 +249,7 @@ priv_vcl_free(void *priv) AZ(priv_vcl); } -int __match_proto__(vmod_init_f) +int __match_proto__(vmod_event_f) event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { struct priv_vcl *priv_vcl; From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 2b85c12 Fix buffer underflow in _vsb_indent Message-ID: commit 2b85c12f59265c51f1100e7ee0bed31d9ec0f8ab Author: Martin Blix Grydeland Date: Fri Jul 31 15:49:37 2015 +0200 Fix buffer underflow in _vsb_indent If s_indent > 0 and the buffer is empty, it would check s_buf[-1] for the '\n' character. Now it will indent either on previous character being a newline, or on empty buffer. This allows indenting also the very first line of a buffer. diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c index be147c2..eba639e 100644 --- a/lib/libvarnish/vsb.c +++ b/lib/libvarnish/vsb.c @@ -159,7 +159,7 @@ static void _vsb_indent(struct vsb *s) { if (s->s_indent == 0 || s->s_error != 0 || - s->s_buf[s->s_len - 1] != '\n') + (s->s_len > 0 && s->s_buf[s->s_len - 1] != '\n')) return; if (VSB_FREESPACE(s) <= s->s_indent && VSB_extend(s, s->s_indent) < 0) { From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] cc0a64f Call VCL_Panic also from pan_busyobj Message-ID: commit cc0a64fbb56a436c19088ae0fb33ea9c62b868e5 Author: Martin Blix Grydeland Date: Thu Jul 2 16:59:15 2015 +0200 Call VCL_Panic also from pan_busyobj diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 873c5e0..983bffa 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -295,6 +295,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) pan_objcore(vsb, "fetch", bo->fetch_objcore); if (bo->stale_oc) pan_objcore(vsb, "ims", bo->stale_oc); + VCL_Panic(vsb, bo->vcl); VSB_indent(vsb, -2); VSB_printf(vsb, "}\n"); } From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] f8d6400 Make pan_htc more useful Message-ID: commit f8d6400507805d84bd80dc2b59fedca9b8cde7d0 Author: Martin Blix Grydeland Date: Thu Jul 9 15:52:17 2015 +0200 Make pan_htc more useful diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 983bffa..7072209 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -145,6 +145,19 @@ pan_htc(struct vsb *vsb, const struct http_conn *htc) VSB_printf(vsb, "http_conn = %p {\n", htc); VSB_indent(vsb, 2); VSB_printf(vsb, "fd = %d,\n", htc->fd); + VSB_printf(vsb, "doclose = %s,\n", sess_close_2str(htc->doclose, 0)); + VSB_printf(vsb, "ws = %p,\n", htc->ws); + VSB_printf(vsb, "{rxbuf_b, rxbuf_e} = {%p, %p},\n", + htc->rxbuf_b, htc->rxbuf_e); + VSB_printf(vsb, "{pipeline_b, pipeline_e} = {%p, %p},\n", + htc->pipeline_b, htc->pipeline_e); + VSB_printf(vsb, "content_length = %jd,\n", htc->content_length); + VSB_printf(vsb, "body_status = %s,\n", + body_status_2str(htc->body_status)); + VSB_printf(vsb, "first_byte_timeout = %f,\n", + htc->first_byte_timeout); + VSB_printf(vsb, "between_bytes_timeout = %f,\n", + htc->between_bytes_timeout); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); } @@ -267,11 +280,9 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) #undef BO_FLAG VSB_printf(vsb, "}\n"); - if (bo->htc != NULL) { - VSB_printf(vsb, "bodystatus = %d (%s),\n", - bo->htc->body_status, - body_status_2str(bo->htc->body_status)); - } + if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) + pan_htc(vsb, bo->htc); + if (!VTAILQ_EMPTY(&bo->vfc->vfp)) { VSB_printf(vsb, "filters ="); VTAILQ_FOREACH(vfe, &bo->vfc->vfp, list) @@ -280,8 +291,6 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) VSB_printf(vsb, "\n"); } - if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) - pan_htc(vsb, bo->htc); VDI_Panic(bo->director_req, vsb, "director_req"); if (bo->director_resp == bo->director_req) VSB_printf(vsb, "director_resp = director_req\n"); From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] 06ebc9e Call pan_htc also from pan_req Message-ID: commit 06ebc9ede143ebcd407c11a7b775fcbde3f9e44b Author: Martin Blix Grydeland Date: Fri Jul 31 16:39:12 2015 +0200 Call pan_htc also from pan_req This dumps some useful bits about the state of the client connection. diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 7072209..c30c64d 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -350,6 +350,8 @@ pan_req(struct vsb *vsb, const struct req *req) pan_wrk(vsb, req->wrk); pan_ws(vsb, req->ws); + if (VALID_OBJ(req->htc, HTTP_CONN_MAGIC)) + pan_htc(vsb, req->htc); pan_http(vsb, "req", req->http); if (req->resp->ws != NULL) pan_http(vsb, "resp", req->resp); From martin at varnish-software.com Fri Sep 4 13:54:51 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:51 +0200 Subject: [4.1] a40f2fd Fix indentation Message-ID: commit a40f2fdb91d65e50e29bfcac9ea4f98c0b276710 Author: Martin Blix Grydeland Date: Fri Jul 31 16:41:21 2015 +0200 Fix indentation diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index c30c64d..e7250be 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -337,7 +337,7 @@ pan_req(struct vsb *vsb, const struct req *req) if (req->err_code) VSB_printf(vsb, - " err_code = %d, err_reason = %s,\n", req->err_code, + "err_code = %d, err_reason = %s,\n", req->err_code, req->err_reason ? req->err_reason : "(null)"); VSB_printf(vsb, "restarts = %d, esi_level = %d,\n", From martin at varnish-software.com Fri Sep 4 13:54:52 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 94468b4 Fix indentation Message-ID: commit 94468b4600c37e0eac8dc87e9d979a6b129f9f36 Author: Martin Blix Grydeland Date: Thu Jul 2 16:15:50 2015 +0200 Fix indentation diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index e7250be..c848d9b 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -116,7 +116,7 @@ pan_ws(struct vsb *vsb, const struct ws *ws) VSB_printf(vsb, "ws = %p {\n", ws); VSB_indent(vsb, 2); if (WS_Overflowed(ws)) - VSB_printf(vsb, " OVERFLOW"); + VSB_printf(vsb, "OVERFLOW "); VSB_printf(vsb, "id = \"%s\",\n", ws->id); VSB_printf(vsb, "{s,f,r,e} = {%p", ws->s); if (ws->f > ws->s) @@ -365,10 +365,12 @@ pan_req(struct vsb *vsb, const struct req *req) } VSB_printf(vsb, "flags = {\n"); -#define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, " " #l ",\n"); + VSB_indent(vsb, 2); +#define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(vsb, #l ",\n"); #include "tbl/req_flags.h" #undef REQ_FLAG - VSB_printf(vsb, "}\n"); + VSB_indent(vsb, -2); + VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); From martin at varnish-software.com Fri Sep 4 13:54:52 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 38f0cd8 O comma CD Message-ID: commit 38f0cd8251f540ac963f91c319519260b5efa473 Author: Martin Blix Grydeland Date: Thu Jul 2 16:21:59 2015 +0200 O comma CD Add commas to panic line endinges consistently diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 092abb3..0718757 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -319,17 +319,17 @@ vbe_panic(const struct director *d, struct vsb *vsb) CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); CAST_OBJ_NOTNULL(bp, d->priv, BACKEND_MAGIC); - VSB_printf(vsb, "display_name = %s\n", bp->display_name); + VSB_printf(vsb, "display_name = %s,\n", bp->display_name); if (bp->ipv4_addr != NULL) - VSB_printf(vsb, "ipv4 = %s\n", bp->ipv4_addr); + VSB_printf(vsb, "ipv4 = %s,\n", bp->ipv4_addr); if (bp->ipv6_addr != NULL) - VSB_printf(vsb, "ipv6 = %s\n", bp->ipv6_addr); - VSB_printf(vsb, "port = %s\n", bp->port); - VSB_printf(vsb, "hosthdr = %s\n", bp->hosthdr); + VSB_printf(vsb, "ipv6 = %s,\n", bp->ipv6_addr); + VSB_printf(vsb, "port = %s,\n", bp->port); + VSB_printf(vsb, "hosthdr = %s,\n", bp->hosthdr); VSB_printf(vsb, "health=%s, admin_health=%s", bp->healthy ? "healthy" : "sick", bp->admin_health); - VSB_printf(vsb, ", changed=%.1f\n", bp->health_changed); - VSB_printf(vsb, "n_conn = %u\n", bp->n_conn); + VSB_printf(vsb, ", changed=%.1f,\n", bp->health_changed); + VSB_printf(vsb, "n_conn = %u,\n", bp->n_conn); } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_director.c b/bin/varnishd/cache/cache_director.c index b6d0944..9dac151 100644 --- a/bin/varnishd/cache/cache_director.c +++ b/bin/varnishd/cache/cache_director.c @@ -189,13 +189,13 @@ VDI_Panic(const struct director *d, struct vsb *vsb, const char *nm) return; VSB_printf(vsb, "%s = %p {\n", nm, d); VSB_indent(vsb, 2); - VSB_printf(vsb, "vcl_name = %s\n", d->vcl_name); + VSB_printf(vsb, "vcl_name = %s,\n", d->vcl_name); VSB_printf(vsb, "type = %s {\n", d->name); VSB_indent(vsb, 2); if (d->panic != NULL) d->panic(d, vsb); VSB_indent(vsb, -2); - VSB_printf(vsb, "}\n"); + VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); - VSB_printf(vsb, "}\n"); + VSB_printf(vsb, "},\n"); } diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index c848d9b..5a8a59a 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -171,7 +171,7 @@ pan_http(struct vsb *vsb, const char *id, const struct http *h) VSB_printf(vsb, "http[%s] = %p {\n", id, h); VSB_indent(vsb, 2); - VSB_printf(vsb, "ws[%s] = %p\n", h->ws ? h->ws->id : "", h->ws); + VSB_printf(vsb, "ws[%s] = %p,\n", h->ws ? h->ws->id : "", h->ws); VSB_printf(vsb, "hdrs {\n"); VSB_indent(vsb, 2); for (i = 0; i < h->nhd; ++i) { @@ -194,9 +194,9 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) VSB_printf(vsb, "objcore[%s] = %p {\n", typ, oc); VSB_indent(vsb, 2); - VSB_printf(vsb, "refcnt = %d\n", oc->refcnt); - VSB_printf(vsb, "flags = 0x%x\n", oc->flags); - VSB_printf(vsb, "objhead = %p\n", oc->objhead); + VSB_printf(vsb, "refcnt = %d,\n", oc->refcnt); + VSB_printf(vsb, "flags = 0x%x,\n", oc->flags); + VSB_printf(vsb, "objhead = %p,\n", oc->objhead); VSB_printf(vsb, "stevedore = %p", oc->stobj->stevedore); if (oc->stobj->stevedore != NULL) { VSB_printf(vsb, " (%s", oc->stobj->stevedore->name); @@ -204,9 +204,9 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) VSB_printf(vsb, " %s", oc->stobj->stevedore->ident); VSB_printf(vsb, ")"); } - VSB_printf(vsb, "\n"); + VSB_printf(vsb, ",\n"); VSB_indent(vsb, -2); - VSB_printf(vsb, "}\n"); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ @@ -220,7 +220,7 @@ pan_wrk(struct vsb *vsb, const struct worker *wrk) VSB_printf(vsb, "worker = %p {\n", wrk); VSB_indent(vsb, 2); - VSB_printf(vsb, "stack = {0x%jx -> 0x%jx}\n", + VSB_printf(vsb, "stack = {0x%jx -> 0x%jx},\n", (uintmax_t)wrk->stack_start, (uintmax_t)wrk->stack_end); pan_ws(vsb, wrk->aws); @@ -268,17 +268,17 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) VSB_printf(vsb, "busyobj = %p {\n", bo); VSB_indent(vsb, 2); pan_ws(vsb, bo->ws); - VSB_printf(vsb, "refcnt = %u\n", bo->refcount); + VSB_printf(vsb, "refcnt = %u,\n", bo->refcount); VSB_printf(vsb, "retries = %d, ", bo->retries); VSB_printf(vsb, "failed = %d, ", bo->vfc->failed); - VSB_printf(vsb, "state = %d\n", (int)bo->state); + VSB_printf(vsb, "state = %d,\n", (int)bo->state); VSB_printf(vsb, "flags = {"); p = ""; #define BO_FLAG(l, r, w, d) \ if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; } #include "tbl/bo_flags.h" #undef BO_FLAG - VSB_printf(vsb, "}\n"); + VSB_printf(vsb, "},\n"); if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) pan_htc(vsb, bo->htc); @@ -293,7 +293,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) VDI_Panic(bo->director_req, vsb, "director_req"); if (bo->director_resp == bo->director_req) - VSB_printf(vsb, "director_resp = director_req\n"); + VSB_printf(vsb, "director_resp = director_req,\n"); else VDI_Panic(bo->director_resp, vsb, "director_resp"); if (bo->bereq != NULL && bo->bereq->ws != NULL) @@ -306,7 +306,7 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) pan_objcore(vsb, "ims", bo->stale_oc); VCL_Panic(vsb, bo->vcl); VSB_indent(vsb, -2); - VSB_printf(vsb, "}\n"); + VSB_printf(vsb, "},\n"); } /*--------------------------------------------------------------------*/ From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 09b9125 Install vtcp.h as well Message-ID: commit 09b9125567a24b1ac0b2648ffbb193473d24e769 Author: Federico G. Schwindt Date: Sat Aug 1 09:23:40 2015 +0100 Install vtcp.h as well Discussed with Martin. diff --git a/include/Makefile.am b/include/Makefile.am index 8d21912..7088579 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -58,6 +58,7 @@ nobase_pkginclude_HEADERS += \ vsa.h \ vsb.h \ vsha256.h \ + vtcp.h \ vtim.h # Private headers From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 2bb8dde Properly encode HTTP headers with weird characters to C identifiers. Message-ID: commit 2bb8ddef13e988216d58b2ed16f40e34db36a0cb Author: Poul-Henning Kamp Date: Mon Aug 3 06:59:20 2015 +0000 Properly encode HTTP headers with weird characters to C identifiers. Please note that using underscore in HTTP headers is considered a really bad idea because many application frameworks map minus to underscore in environment variables. Fixes: #1768 diff --git a/bin/varnishtest/tests/r01768.vtc b/bin/varnishtest/tests/r01768.vtc new file mode 100644 index 0000000..716701a --- /dev/null +++ b/bin/varnishtest/tests/r01768.vtc @@ -0,0 +1,19 @@ +varnishtest "http header collision -/_" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + if (req.http.foo_bar == req.http.foo-bar) { + set req.http.foo_bar = "xxx"; + } + } +} -start + +client c1 { + txreq + rxresp +} -run diff --git a/lib/libvcc/vcc_var.c b/lib/libvcc/vcc_var.c index 0fd45ec..a018f36 100644 --- a/lib/libvcc/vcc_var.c +++ b/lib/libvcc/vcc_var.c @@ -43,43 +43,43 @@ vcc_Var_Wildcard(struct vcc *tl, const struct token *t, const struct symbol *wc) struct symbol *sym; struct var *v; const struct var *vh; - int l, i; - char c; - char buf[258]; - char cnam[256]; + unsigned u; + const char *p, *leaf; + struct vsb *vsb; vh = wc->var; + assert(vh->fmt == HEADER); v = TlAlloc(tl, sizeof *v); AN(v); - - assert(vh->fmt == HEADER); v->name = TlDupTok(tl, t); v->r_methods = vh->r_methods; v->w_methods = vh->w_methods; v->fmt = vh->fmt; + leaf = v->name + vh->len; /* Create a C-name version of the header name */ - l = strlen(v->name + vh->len) + 1; - for (i = 0; i < l - 1; i++) { - c = *(v->name + vh->len + i); - if (vct_isalpha(c) || vct_isdigit(c)) - cnam[i] = c; + vsb = VSB_new_auto(); + AN(vsb); + VSB_printf(vsb, "&VGC_%s_", vh->rname); + for (p = leaf, u = 1; *p != '\0'; p++, u++) + if (vct_isalpha(*p) || vct_isdigit(*p)) + VSB_putc(vsb, *p); else - cnam[i] = '_'; - } - cnam[i] = '\0'; + VSB_printf(vsb, "_%02x_", *p); + AZ(VSB_finish(vsb)); /* Create the static identifier */ - Fh(tl, 0, "static const struct gethdr_s VGC_%s_%s =\n", - vh->rname, cnam); - Fh(tl, 0, " { %s, \"\\%03o%s:\"};\n", - vh->rname, (unsigned)l, v->name + vh->len); - - bprintf(buf, "&VGC_%s_%s", vh->rname, cnam); - v->rname = TlDup(tl, buf); - bprintf(buf, "VRT_SetHdr(ctx, %s,", v->rname); - v->lname = TlDup(tl, buf); + Fh(tl, 0, "static const struct gethdr_s %s =\n", VSB_data(vsb) + 1); + Fh(tl, 0, " { %s, \"\\%03o%s:\"};\n", vh->rname, u, leaf); + + /* Create the symbol r/l values */ + v->rname = TlDup(tl, VSB_data(vsb)); + VSB_clear(vsb); + VSB_printf(vsb, "VRT_SetHdr(ctx, %s,", v->rname); + AZ(VSB_finish(vsb)); + v->lname = TlDup(tl, VSB_data(vsb)); + VSB_delete(vsb); sym = VCC_AddSymbolTok(tl, t, SYM_VAR); AN(sym); From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] fc5b473 Nitpicking Message-ID: commit fc5b4732bf86d7cccb52c4f5269f2d89a0fd39ff Author: Poul-Henning Kamp Date: Mon Aug 3 07:06:17 2015 +0000 Nitpicking diff --git a/flint.lnt b/flint.lnt index 434c54a..c6b741e 100644 --- a/flint.lnt +++ b/flint.lnt @@ -51,6 +51,7 @@ -emacro(731, assert) // booelan arg to eq/non-eq -emacro(731, xxxassert) // arg to eq/non-eq -emacro(527, WRONG) // unreachable code +-emacro(774, VALID_OBJ) // boolean always true /////////////////////////////////////////////////////////////////////// // diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 4db94a3..01de3a7 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -743,8 +743,8 @@ class FileSection(object): if re.match("['\"]", l): m = re.match("(['\"]).*?(\\1)", l) if not m: - raise FormatError("Unbalanced quote", - "Unbalanced quote on line %d" % ln) + raise FormatError("Unbalanced quote", + "Unbalanced quote on line %d" % ln) self.tl.append(Token(ln, 0, l[:m.end()])) self.l.insert(0, (ln, l[m.end():])) return From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 73817d4 Add forgotten test-case Message-ID: commit 73817d4c288fdd9473bb80f0f358e1461062a47d Author: Poul-Henning Kamp Date: Mon Aug 3 07:09:09 2015 +0000 Add forgotten test-case diff --git a/bin/varnishtest/tests/r01761.vtc b/bin/varnishtest/tests/r01761.vtc new file mode 100644 index 0000000..a146d2b --- /dev/null +++ b/bin/varnishtest/tests/r01761.vtc @@ -0,0 +1,33 @@ +varnishtest "204 response with body" + +server s1 { + rxreq + txresp -status 204 -body "HiHo" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (beresp.http.foo == "bar") { + set beresp.status = 204; + } + } +} -start + +client c1 { + txreq + rxresp + expect resp.status == 503 +} -run + +server s1 { + rxreq + txresp -hdr "Foo: bar" -body "HiHo" +} -start + +client c1 { + txreq -url /2 + rxresp + expect resp.status == 204 + expect resp.http.content-length == "" + expect resp.http.transfer-encoding == "" +} -run From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:52 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] f685156 Typos Message-ID: commit f6851567f12cf366665b6bb668f26968e47186d6 Author: Dridi Boukelmoune Date: Mon Aug 3 09:48:30 2015 +0200 Typos diff --git a/flint.lnt b/flint.lnt index c6b741e..c6824f5 100644 --- a/flint.lnt +++ b/flint.lnt @@ -22,7 +22,7 @@ /////////////////////////////////////////////////////////////////////// // System/Posix/Iso-C library related --emacro(747, isnan) // significant coersion +-emacro(747, isnan) // significant coercion // ignore retval -esym(534, printf) @@ -47,8 +47,8 @@ -sem(VAS_Fail, r_no) // does not return -emacro(506, assert) // constant value boolean -emacro(827, assert) // loop not reachable --emacro(774, assert) // booelan always true --emacro(731, assert) // booelan arg to eq/non-eq +-emacro(774, assert) // boolean always true +-emacro(731, assert) // boolean arg to eq/non-eq -emacro(731, xxxassert) // arg to eq/non-eq -emacro(527, WRONG) // unreachable code -emacro(774, VALID_OBJ) // boolean always true @@ -57,7 +57,7 @@ // -esym(759, VSB_*) // header decl could be moved --esym(765, VSB_*) // exten could be made static +-esym(765, VSB_*) // extern could be made static -esym(714, VSB_*) // symb not ref -sem(VSB_new, @p == (1p ? 1p : malloc(1))) -sem(VSB_delete, custodial(1)) From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] ac13bad Correct prototypes Message-ID: commit ac13bad3970e0ec0a39ffe8ae14a481ee9e544f0 Author: Federico G. Schwindt Date: Mon Aug 3 09:53:35 2015 +0100 Correct prototypes diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index a956b27..f0e9a21 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -118,7 +118,7 @@ struct mac_help { enum sess_step first_step; }; -static int __match_proto__(vss_resolver_f) +static int __match_proto__(vss_resolved_f) mac_callback(void *priv, const struct suckaddr *sa) { struct mac_help *mh; diff --git a/bin/varnishd/mgt/mgt_cli.c b/bin/varnishd/mgt/mgt_cli.c index f618d5c..da3cf69 100644 --- a/bin/varnishd/mgt/mgt_cli.c +++ b/bin/varnishd/mgt/mgt_cli.c @@ -524,7 +524,7 @@ mgt_cli_secret(const char *S_arg) secret_file = S_arg; } -static int __match_proto__(vss_resolver_f) +static int __match_proto__(vss_resolved_f) mct_callback(void *priv, const struct suckaddr *sa) { int sock; From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 99b85e7 Better Message-ID: commit 99b85e7e4ee6139ddfc601246a57ac5f76c25462 Author: Federico G. Schwindt Date: Mon Aug 3 09:53:55 2015 +0100 Better diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 46f777e..2763f7b 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -137,13 +137,14 @@ cnt_deliver(struct worker *wrk, struct req *req) http_PrintfHeader(req->resp, "X-Varnish: %u", VXID(req->vsl->wid)); - /* We base Age calculation upon the last timestamp taken during - client request processing. This gives some inaccuracy, but - since Age is only full second resolution that shouldn't - matter. (Last request timestamp could be a Start timestamp - taken before the object entered into cache leading to negative - age. Truncate to zero in that case). - */ + /* + * We base Age calculation upon the last timestamp taken during + * client request processing. This gives some inaccuracy, but + * since Age is only full second resolution that shouldn't + * matter. (Last request timestamp could be a Start timestamp + * taken before the object entered into cache leading to negative + * age. Truncate to zero in that case). + */ http_PrintfHeader(req->resp, "Age: %.0f", fmax(0., req->t_prev - req->objcore->exp.t_origin)); From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 561b56c Remove -w option from varnishstat Message-ID: commit 561b56cececb80337df10b9d1ec2daebd7d28333 Author: Federico G. Schwindt Date: Mon Aug 3 10:04:58 2015 +0100 Remove -w option from varnishstat For continuous updates we can always use a shell loop. Fixes #1760. diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c index 871aca7..2eda2bb 100644 --- a/bin/varnishstat/varnishstat.c +++ b/bin/varnishstat/varnishstat.c @@ -252,8 +252,7 @@ usage(void) #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishstat " "[-1lV] [-f field] " - VSC_n_USAGE " " - "[-w delay]\n"); + VSC_n_USAGE "\n"); fprintf(stderr, FMT, "-1", "Print the statistics to stdout."); fprintf(stderr, FMT, "-f field", "Field inclusion glob"); fprintf(stderr, FMT, "", @@ -263,10 +262,6 @@ usage(void) fprintf(stderr, FMT, "-n varnish_name", "The varnishd instance to get logs from"); fprintf(stderr, FMT, "-V", "Display the version number and exit"); - fprintf(stderr, FMT, "-w delay", - "Wait delay seconds between updates." - " Default is 1 second." - " Can also be be used with -1, -x or -j for repeated output."); fprintf(stderr, FMT, "-x", "Print statistics to stdout as XML."); fprintf(stderr, FMT, "-j", @@ -280,14 +275,14 @@ main(int argc, char * const *argv) { int c; struct VSM_data *vd; - double delay = 1.0, t_arg = 5.0, t_start = NAN; - int once = 0, xml = 0, json = 0, do_repeat = 0, f_list = 0, curses = 0; + double t_arg = 5.0, t_start = NAN; + int once = 0, xml = 0, json = 0, f_list = 0, curses = 0; int i; vd = VSM_New(); AN(vd); - while ((c = getopt(argc, argv, VSC_ARGS "1f:lVw:xjt:")) != -1) { + while ((c = getopt(argc, argv, VSC_ARGS "1f:lVxjt:")) != -1) { switch (c) { case '1': once = 1; @@ -313,14 +308,6 @@ main(int argc, char * const *argv) case 'V': VCS_Message("varnishstat"); exit(0); - case 'w': - do_repeat = 1; - delay = VNUM(optarg); - if (isnan(delay)) { - fprintf(stderr, "-w: Syntax error"); - exit(1); - } - break; case 'x': xml = 1; break; @@ -360,7 +347,7 @@ main(int argc, char * const *argv) fprintf(stderr, "%s\n", VSM_Error(vd)); exit(1); } - do_curses(vd, delay); + do_curses(vd, 1.0); exit(0); } @@ -369,24 +356,19 @@ main(int argc, char * const *argv) exit(1); } - while (1) { - if (xml) - do_xml(vd); - else if (json) - do_json(vd); - else if (once) - do_once(vd, VSC_Main(vd, NULL)); - else if (f_list) - list_fields(vd); - else - assert(0); - if (!do_repeat) - break; + if (xml) + do_xml(vd); + else if (json) + do_json(vd); + else if (once) + do_once(vd, VSC_Main(vd, NULL)); + else if (f_list) + list_fields(vd); + else + assert(0); - /* end of output block marker. */ - printf("\n"); + /* end of output block marker. */ + printf("\n"); - (void)usleep(delay * 1e6); - } exit(0); } diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index e833706..afa4a0b 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -15,7 +15,7 @@ Varnish Cache statistics SYNOPSIS ======== -varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V] [-w delay] +varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V] .. TODO: autogenerate this synopsis like the others. @@ -64,10 +64,6 @@ The following options are available: -V Display the version number and exit. --w delay - Wait delay seconds between updates. The default is 1. Can - also be used with -1, -x or -j for repeated output. - -x Displays the result as XML. From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] c654ff9 Complain if there are sub-arguments to the -a protocol specs which don't understand them. Message-ID: commit c654ff91a1287d36ac5c61599cb4ae3d6be22236 Author: Poul-Henning Kamp Date: Mon Aug 3 10:28:48 2015 +0000 Complain if there are sub-arguments to the -a protocol specs which don't understand them. Fixes: #1770 diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index f0e9a21..0c28a13 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -192,9 +192,13 @@ MAC_Arg(const char *arg) if (av[2] == NULL || !strcmp(av[2], "HTTP/1")) { mh->first_step = S_STP_H1NEWSESS; mh->proto_name = "HTTP/1"; + if (av[2] != NULL && av[3] != NULL) + ARGV_ERR("Too many sub-arguments to -a(HTTP/1))\n"); } else if (!strcmp(av[2], "PROXY")) { mh->first_step = S_STP_PROXYNEWSESS; mh->proto_name = "PROXY"; + if (av[3] != NULL) + ARGV_ERR("Too many sub-arguments to -a(PROXY))\n"); } else { ARGV_ERR("Unknown protocol '%s'\n", av[2]); } diff --git a/bin/varnishtest/tests/r01770.vtc b/bin/varnishtest/tests/r01770.vtc new file mode 100644 index 0000000..774b050 --- /dev/null +++ b/bin/varnishtest/tests/r01770.vtc @@ -0,0 +1,5 @@ +varnishtest "bad protocol specs for -a" + +err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,PROXY,FOO -d 2>&1" +err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,HTTP/1,FOO -d 2>&1" +err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,HTTP/1 -d 2>&1" From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] b4628df remove debug test Message-ID: commit b4628dfd22d74375132802aeeedf54a736453138 Author: Poul-Henning Kamp Date: Mon Aug 3 10:35:17 2015 +0000 remove debug test diff --git a/bin/varnishtest/tests/r01770.vtc b/bin/varnishtest/tests/r01770.vtc index 774b050..838e44b 100644 --- a/bin/varnishtest/tests/r01770.vtc +++ b/bin/varnishtest/tests/r01770.vtc @@ -2,4 +2,3 @@ varnishtest "bad protocol specs for -a" err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,PROXY,FOO -d 2>&1" err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,HTTP/1,FOO -d 2>&1" -err_shell "Too many sub-arguments" "${varnishd} -a 127.0.0.1:80000,HTTP/1 -d 2>&1" From phk at FreeBSD.org Fri Sep 4 13:54:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] b26f9ff Don't insist headers have a space after the colon. Message-ID: commit b26f9fff4877fbe1001c7f995df98f9241914e12 Author: Poul-Henning Kamp Date: Mon Aug 3 12:55:44 2015 +0000 Don't insist headers have a space after the colon. Fixes #1765 diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 05edd1b..e832992 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -927,9 +927,8 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) while (*ptr != '\0') { if (!strncasecmp(ptr, hdr, l)) { ptr += l; - assert (vct_issp(*ptr)); - ptr++; - assert (!vct_issp(*ptr)); + while (vct_islws(*ptr)) + ptr++; return (ptr); } ptr = strchr(ptr, '\0') + 1; diff --git a/bin/varnishtest/tests/r01765.vtc b/bin/varnishtest/tests/r01765.vtc new file mode 100644 index 0000000..e3d8323 --- /dev/null +++ b/bin/varnishtest/tests/r01765.vtc @@ -0,0 +1,27 @@ +varnishtest "subset headers in packed format" + +server s1 { + rxreq + txresp -hdr "Foo:bar" + rxreq + txresp -hdr "Foo:bax" +} -start + +varnish v1 -vcl+backend { + sub vcl_hit { + if (obj.http.foo == "bar") { + return (pass); + } + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == bar + txreq + rxresp + expect resp.http.foo == bax +} -run + +delay 1 From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 28198ab Drop ExecStartPre Message-ID: commit 28198ab847c60382576c91a916ee4657484dd44f Author: Federico G. Schwindt Date: Mon Aug 3 13:58:54 2015 +0100 Drop ExecStartPre Fixes startup if vcl_dir was specified in DAEMON_OPTS. Reported by Gauthier Delacroix. Discussed with ssm on irc. diff --git a/redhat/varnish.service b/redhat/varnish.service index a4f3355..659dba2 100644 --- a/redhat/varnish.service +++ b/redhat/varnish.service @@ -27,7 +27,6 @@ EnvironmentFile=/etc/varnish/varnish.params Type=forking PIDFile=/var/run/varnish.pid PrivateTmp=true -ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF ExecStart=/usr/sbin/varnishd \ -P /var/run/varnish.pid \ -f $VARNISH_VCL_CONF \ From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] b8ff3f5 Source the default params only if needed Message-ID: commit b8ff3f5f2c8c7b00cbc172d623871dcef9e535a1 Author: Federico G. Schwindt Date: Mon Aug 3 14:05:32 2015 +0100 Source the default params only if needed Makes this work with multiple instances under systemd. Discussed with ingvar on irc. diff --git a/redhat/varnish_reload_vcl b/redhat/varnish_reload_vcl index be3c21a..2f47f3e 100755 --- a/redhat/varnish_reload_vcl +++ b/redhat/varnish_reload_vcl @@ -33,8 +33,10 @@ VARNISH_SECRET_FILE=\"$VARNISH_SECRET_FILE\" " } -# Read configuration -. /etc/sysconfig/varnish +# Fallback to the default configuration +if [ -z "$VARNISH_VCL_CONF" ]; then + . /etc/sysconfig/varnish +fi $debug && print_debug From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 20d0f0b Fix configtest when vcl_dir is specified Message-ID: commit 20d0f0bb357e88fb95066f15e50e86fa3ea27862 Author: Federico G. Schwindt Date: Mon Aug 3 14:07:33 2015 +0100 Fix configtest when vcl_dir is specified Reported and diff submitted by Gauthier Delacroix on varnish-dev. diff --git a/redhat/varnish.initrc b/redhat/varnish.initrc index 117e334..67b530a 100755 --- a/redhat/varnish.initrc +++ b/redhat/varnish.initrc @@ -126,7 +126,7 @@ rh_status_q() { configtest() { if [ -f "$VARNISH_VCL_CONF" ]; then - $exec -f "$VARNISH_VCL_CONF" -C -n /tmp > /dev/null && echo "Syntax ok" + $exec -f "$VARNISH_VCL_CONF" -C "$DAEMON_OPTS" -n /tmp > /dev/null && echo "Syntax ok" else echo "VARNISH_VCL_CONF is unset or does not point to a file" fi From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 3dde588 Better names and description Message-ID: commit 3dde58867c808d488ddf7b735562a107208443f6 Author: Federico G. Schwindt Date: Mon Aug 3 14:32:15 2015 +0100 Better names and description diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index 37b1985..eab4f90 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -162,9 +162,9 @@ usage(void) #endif fprintf(stderr, FMT, "", " -j unix[,user=][,ccgroup=]"); fprintf(stderr, FMT, "", " -j none"); - fprintf(stderr, FMT, "-l shl,free", "Size of shared memory file"); - fprintf(stderr, FMT, "", " shl: space for SHL records [80m]"); - fprintf(stderr, FMT, "", " free: space for other allocations [1m]"); + fprintf(stderr, FMT, "-l vsl,vsm", "Size of shared memory file"); + fprintf(stderr, FMT, "", " vsl: space for VSL records [80m]"); + fprintf(stderr, FMT, "", " vsm: space for stats counters [1m]"); fprintf(stderr, FMT, "-M address:port", "Reverse CLI destination"); fprintf(stderr, FMT, "-n dir", "varnishd working directory"); fprintf(stderr, FMT, "-P file", "PID file"); diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 378daff..9506915 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -84,11 +84,11 @@ OPTIONS Specify the jailing technology to use. --l +-l - Specifies size of shmlog file. shl is the store for the shared - memory log records [80M] and free is the store for other allocations - [1M]. Scaling suffixes like 'k', 'M' can be used up to (E)xabytes. + Specifies size of shmlog file. vsl is the space for the VSL records + [80M] and vsm is the space for stats counters [1M]. Scaling suffixes + like 'K' and 'M' can be used up to (G)igabytes. Default is 81 Megabytes. -M From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] cbf70b7 Update suggested read-only parameters Message-ID: commit cbf70b7beab81e0c4da8957f2cf778ad56d3e9a4 Author: Federico G. Schwindt Date: Mon Aug 3 17:40:51 2015 +0100 Update suggested read-only parameters diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 9506915..7292a12 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -119,9 +119,9 @@ OPTIONS Make the listed parameters read only. This gives the system administrator a way to limit what the Varnish CLI can do. Consider - making parameters such as *user*, *group*, *cc_command*, - *vcc_allow_inline_c* read only as these can potentially be used to - escalate privileges from the CLI. + making parameters such as *cc_command*, *vcc_allow_inline_c* and + *vmod_dir* read only as these can potentially be used to escalate + privileges from the CLI. -S file From fgsch at lodoss.net Fri Sep 4 13:54:52 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 1bc257d Switch to container-based infrastructure Message-ID: commit 1bc257dbc0592023be04cb4473d9af11f329d1b4 Author: Federico G. Schwindt Date: Mon Aug 3 17:53:25 2015 +0100 Switch to container-based infrastructure diff --git a/.travis.yml b/.travis.yml index 8caad42..164ba4b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,8 +3,12 @@ language: c compiler: - clang - gcc +addons: + apt: + packages: + - python-docutils before_install: - - sudo apt-get install python-docutils - ./autogen.sh - ./configure +sudo: false script: 'make -j3 check VERBOSE=1' From martin at varnish-software.com Fri Sep 4 13:54:52 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] e3e340d Trigger the panic dump handler also on sigabrt Message-ID: commit e3e340d58faaa8bfb2eeed02861cb4b8be328715 Author: Martin Blix Grydeland Date: Tue Aug 4 10:54:54 2015 +0200 Trigger the panic dump handler also on sigabrt This allows for a panic dump and backtrace to be produced on sigabrt. This is useful e.g. when using jemalloc's debug flags, which can through a special environment variable enable memory allocation consistency checks and trigger sigabrt on errors. diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 5a8a59a..e20f668 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -465,6 +465,9 @@ pan_ic(const char *func, const char *file, int line, const char *cond, memset(&sa, 0, sizeof sa); sa.sa_handler = SIG_DFL; (void)sigaction(SIGSEGV, &sa, NULL); + /* Set SIGABRT back to default so the final abort() has the + desired effect */ + (void)sigaction(SIGABRT, &sa, NULL); switch(kind) { case VAS_WRONG: diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 3a6890a..69c90d8 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -384,6 +384,7 @@ mgt_launch_child(struct cli *cli) sa.sa_flags = SA_SIGINFO; (void)sigaction(SIGSEGV, &sa, NULL); (void)sigaction(SIGBUS, &sa, NULL); + (void)sigaction(SIGABRT, &sa, NULL); } (void)signal(SIGINT, SIG_DFL); (void)signal(SIGTERM, SIG_DFL); From martin at varnish-software.com Fri Sep 4 13:54:52 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 5f7d81e Enable our sig{segv, bus, abrt} panic handlers by default. Message-ID: commit 5f7d81eac58ffb42a31788c5d9b39b28f2aea733 Author: Martin Blix Grydeland Date: Tue Aug 4 10:57:09 2015 +0200 Enable our sig{segv,bus,abrt} panic handlers by default. diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index 9c07c55..fa34aa1 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -419,7 +419,7 @@ struct parspec mgt_parspec[] = { "Install a signal handler which tries to dump debug " "information on segmentation and buserror faults.", MUST_RESTART, - "off", "bool" }, + "on", "bool" }, { "vcl_dir", tweak_string, &mgt_vcl_dir, NULL, NULL, "Directory from which relative VCL filenames (vcl.load and " diff --git a/bin/varnishtest/tests/c00057.vtc b/bin/varnishtest/tests/c00057.vtc index fe8e78e..df4767b 100644 --- a/bin/varnishtest/tests/c00057.vtc +++ b/bin/varnishtest/tests/c00057.vtc @@ -6,7 +6,6 @@ server s1 { } -start varnish v1 -cliok "param.set vcc_allow_inline_c true" -varnish v1 -cliok "param.set sigsegv_handler on" varnish v1 -vcl+backend { C{ #include From martin at varnish-software.com Fri Sep 4 13:54:52 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:52 +0200 Subject: [4.1] 7b573d5 Update parameter description to reflect that it also covers sigabrt Message-ID: commit 7b573d5d16f78ec1c71f3fce264406757aee0ec3 Author: Martin Blix Grydeland Date: Tue Aug 4 12:01:35 2015 +0200 Update parameter description to reflect that it also covers sigabrt We should perhaps rename this parameter away from sigsegv_handler? Maybe error_sighandler? Maybe move it into a feature bit for the disabling instead of a separate parameter too. diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index fa34aa1..fba9994 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -416,8 +416,9 @@ struct parspec mgt_parspec[] = { "180", "seconds" }, { "sigsegv_handler", tweak_bool, &mgt_param.sigsegv_handler, NULL, NULL, - "Install a signal handler which tries to dump debug " - "information on segmentation and buserror faults.", + "Install a signal handler which tries to dump debug" + " information on segmentation faults, bus errors and abort" + " signals.", MUST_RESTART, "on", "bool" }, { "vcl_dir", tweak_string, &mgt_vcl_dir, From martin at varnish-software.com Fri Sep 4 13:54:53 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 1955e46 Update params.h to reflect changes in mgt_param_tbl.c Message-ID: commit 1955e4601d9e53758884c598b70eeffca59de173 Author: Martin Blix Grydeland Date: Tue Aug 4 12:03:37 2015 +0200 Update params.h to reflect changes in mgt_param_tbl.c diff --git a/include/tbl/params.h b/include/tbl/params.h index 22addb0..71e9da4 100644 --- a/include/tbl/params.h +++ b/include/tbl/params.h @@ -962,12 +962,12 @@ PARAM( /* var */ sigsegv_handler, /* min */ none, /* max */ none, - /* default */ off, + /* default */ on, /* units */ bool, /* flags */ 0| MUST_RESTART, /* s-text */ "Install a signal handler which tries to dump debug information on " - "segmentation and buserror faults.\n", + "segmentation faults, bus errors and abort signals.\n", /* l-text */ "", /* func */ NULL ) From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 2bb6565 Parameters cleanup Message-ID: commit 2bb6565fe48725297a702b931ec709dae1d1c619 Author: Dridi Boukelmoune Date: Mon Aug 3 13:00:10 2015 +0200 Parameters cleanup Mark optional parts as such and briefly document components. Sync with the man page. The address part for options -a and -b is technically optional too. diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index eab4f90..899b9ba 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -141,11 +141,14 @@ usage(void) #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishd [options]\n"); - fprintf(stderr, FMT, "-a address:port,proto", + fprintf(stderr, FMT, "-a address[:port][,proto]", "HTTP listen address and port (default: *:80)"); - fprintf(stderr, FMT, "-b address:port", "backend address and port"); - fprintf(stderr, FMT, "", " -b "); - fprintf(stderr, FMT, "", " -b ':'"); + fprintf(stderr, FMT, "", " address: defaults to loopback"); + fprintf(stderr, FMT, "", " port: port or service (default: 80)"); + fprintf(stderr, FMT, "", " proto: HTTP/1 (default), PROXY"); + fprintf(stderr, FMT, "-b address[:port]", "backend address and port"); + fprintf(stderr, FMT, "", " address: hostname or IP"); + fprintf(stderr, FMT, "", " port: port or service (default: 80)"); fprintf(stderr, FMT, "-C", "print VCL code compiled to C language"); fprintf(stderr, FMT, "-d", "debug"); fprintf(stderr, FMT, "-F", "Run in foreground"); @@ -162,7 +165,7 @@ usage(void) #endif fprintf(stderr, FMT, "", " -j unix[,user=][,ccgroup=]"); fprintf(stderr, FMT, "", " -j none"); - fprintf(stderr, FMT, "-l vsl,vsm", "Size of shared memory file"); + fprintf(stderr, FMT, "-l vsl[,vsm]", "Size of shared memory file"); fprintf(stderr, FMT, "", " vsl: space for VSL records [80m]"); fprintf(stderr, FMT, "", " vsm: space for stats counters [1m]"); fprintf(stderr, FMT, "-M address:port", "Reverse CLI destination"); diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 7292a12..f76f031 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -15,7 +15,7 @@ HTTP accelerator daemon SYNOPSIS ======== -varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l shl[,free]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter] +varnishd [-a address[:port][,PROTO]] [-b host[:port]] [-C] [-d] [-F] [-f config] [-h type[,options]] [-i identity] [-j jail[,jailoptions]] [-l vsl[,vsm]] [-M address:port] [-n name] [-P file] [-p param=value] [-r param[,param...]] [-S secret-file] [-s [name=]kind[,options]] [-T address[:port]] [-t TTL] [-V] [-W waiter] DESCRIPTION =========== From fgsch at lodoss.net Fri Sep 4 13:54:53 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] fbd7295 Typo Message-ID: commit fbd729506628b62b7867353701325eb709f5ded0 Author: Federico G. Schwindt Date: Thu Aug 6 09:16:50 2015 +0100 Typo diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c index 9bb7d1e..07167d4 100644 --- a/bin/varnishd/cache/cache_shmlog.c +++ b/bin/varnishd/cache/cache_shmlog.c @@ -362,7 +362,7 @@ VSLb_ts(struct vsl_log *vsl, const char *event, double first, double *pprev, /* XXX: Make an option to turn off some unnecessary timestamp logging. This must be done carefully because some functions - (e.g. V1L_Reserve) takes the last timestamp as it's inital + (e.g. V1L_Reserve) takes the last timestamp as it's initial value for timeout calculation. */ vsl_sanity(vsl); assert(!isnan(now) && now != 0.); From fgsch at lodoss.net Fri Sep 4 13:54:53 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 093b112 Fix synth handling and update docs Message-ID: commit 093b11238e6f4e9624b8386893930eacf4060536 Author: Federico G. Schwindt Date: Thu Aug 6 09:17:01 2015 +0100 Fix synth handling and update docs error has been long retired. diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 257a39d..9283beb 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -879,12 +879,12 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], } else if (!strcasecmp(b, "pass")) { CTX.hitmiss = "miss"; CTX.handling = "pass"; - } else if (!strcasecmp(b, "error")) { - /* Arguably, error isn't a hit or + } else if (!strcasecmp(b, "synth")) { + /* Arguably, synth isn't a hit or a miss, but miss is less wrong */ CTX.hitmiss = "miss"; - CTX.handling = "error"; + CTX.handling = "synth"; } break; case SLT_VCL_return: diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index 3ab7759..d98f6e2 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -119,7 +119,7 @@ Supported formatters are: Varnish:handling How the request was handled, whether it was a cache hit, miss, - pass, pipe or error. + pass, pipe or synth. VCL_Log:key Output value set by std.log("key:value") in VCL. From fgsch at lodoss.net Fri Sep 4 13:54:53 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] fd97e54 Spelling and typos Message-ID: commit fd97e5437715be80534013f7d8e06e89a1731b0a Author: Federico G. Schwindt Date: Thu Aug 6 10:45:26 2015 +0100 Spelling and typos diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index fba9994..565328e 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -178,7 +178,7 @@ struct parspec mgt_parspec[] = { { "timeout_idle", tweak_timeout, &mgt_param.timeout_idle, "0", NULL, "Idle timeout for client connections.\n" - "A connection is considered idle, until we have" + "A connection is considered idle, until we have " "received the full request headers.", 0, "5", "seconds" }, diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index 42c1755..f3529a0 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -33,7 +33,7 @@ #define TOP_OPT_1 \ VOPT("1", "[-1]", "Run once", \ - "Instead of a continously updated display, print the" \ + "Instead of a continuously updated display, print the" \ " statistics once and exit. Implies ``-d``." \ ) diff --git a/doc/sphinx/reference/states.rst b/doc/sphinx/reference/states.rst index 098e5a2..2f80f29 100644 --- a/doc/sphinx/reference/states.rst +++ b/doc/sphinx/reference/states.rst @@ -21,7 +21,7 @@ into the respective VCL subroutine. These can then be modified from VCL where necessary. The following graphs attempt to provide an overview over the -processing states, their transisions and the most relevant functions +processing states, their transitions and the most relevant functions in core code. They represent a compromise between usefulness for core/VMOD developers and administrators and are intended to serve as the reference basis for deriavtive work, such as more VCL-centric diff --git a/include/tbl/params.h b/include/tbl/params.h index 71e9da4..36c1b0d 100644 --- a/include/tbl/params.h +++ b/include/tbl/params.h @@ -1232,7 +1232,7 @@ PARAM( /* flags */ 00, /* s-text */ "Idle timeout for client connections.\n" - "A connection is considered idle, until we havereceived the full " + "A connection is considered idle, until we have received the full " "request headers.\n", /* l-text */ "", /* func */ NULL From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 71a8353 Typo Message-ID: commit 71a83537340a6e881e483b5b0dd3206ffee9d177 Author: Dridi Boukelmoune Date: Thu Aug 6 14:47:56 2015 +0200 Typo diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c index 07167d4..ae49087 100644 --- a/bin/varnishd/cache/cache_shmlog.c +++ b/bin/varnishd/cache/cache_shmlog.c @@ -362,7 +362,7 @@ VSLb_ts(struct vsl_log *vsl, const char *event, double first, double *pprev, /* XXX: Make an option to turn off some unnecessary timestamp logging. This must be done carefully because some functions - (e.g. V1L_Reserve) takes the last timestamp as it's initial + (e.g. V1L_Reserve) takes the last timestamp as its initial value for timeout calculation. */ vsl_sanity(vsl); assert(!isnan(now) && now != 0.); From phk at FreeBSD.org Fri Sep 4 13:54:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 560de22 Be a bit more clear on this, hoping Coverity will catch the drift. Message-ID: commit 560de22727110d18fc8006f288fbde9223d5902b Author: Poul-Henning Kamp Date: Mon Aug 10 06:55:04 2015 +0000 Be a bit more clear on this, hoping Coverity will catch the drift. diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index 0c28a13..8c80f58 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -62,13 +62,15 @@ mac_opensocket(struct listen_sock *ls, struct cli *cli) } ls->sock = VTCP_bind(ls->addr, NULL); fail = errno; - if (ls->sock >= 0) - mgt_child_inherit(ls->sock, "sock"); - if (cli != NULL && ls->sock < 0) { - VCLI_Out(cli, "Could not get socket %s: %s\n", - ls->name, strerror(errno)); + if (ls->sock < 0) { + if (cli != NULL) + VCLI_Out(cli, "Could not get socket %s: %s\n", + ls->name, strerror(errno)); + AN(fail); + return (fail); } - return (fail); + mgt_child_inherit(ls->sock, "sock"); + return (0); } /*===================================================================== @@ -152,7 +154,7 @@ MAC_Validate(void) VJ_master(JAIL_MASTER_PRIVPORT); fail = mac_opensocket(ls, NULL); VJ_master(JAIL_MASTER_LOW); - if (ls->sock < 0) + if (fail) ARGV_ERR("Cannot open socket: %s: %s\n", ls->name, strerror(fail)); if (VSA_Port(ls->addr) == 0) { From phk at FreeBSD.org Fri Sep 4 13:54:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 6097d7b WS may give us more space than we ask for Message-ID: commit 6097d7baa5d88ed045df872ee4ba348580a88af3 Author: Poul-Henning Kamp Date: Mon Aug 10 07:52:41 2015 +0000 WS may give us more space than we ask for diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c index 90965c3..9736ca9 100644 --- a/bin/varnishd/cache/cache_acceptor.c +++ b/bin/varnishd/cache/cache_acceptor.c @@ -364,7 +364,7 @@ vca_make_session(struct worker *wrk, void *arg) vca_tcp_opt_set(sp->fd, 0); /* SES_Proto_Sess() must be sceduled with reserved WS */ - assert(8 == WS_Reserve(sp->ws, 8)); + assert(8 <= WS_Reserve(sp->ws, 8)); wrk->task.func = SES_Proto_Sess; wrk->task.priv = sp; } diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 07123fb..9b8d2a5 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -448,7 +448,7 @@ ses_handle(struct waited *wp, enum wait_event ev, double now) case WAITER_ACTION: pp = sp->pool; CHECK_OBJ_NOTNULL(pp, POOL_MAGIC); - assert(sizeof *tp == WS_Reserve(sp->ws, sizeof *tp)); + assert(sizeof *tp <= WS_Reserve(sp->ws, sizeof *tp)); tp = (void*)sp->ws->f; tp->func = SES_Proto_Sess; tp->priv = sp; From phk at FreeBSD.org Fri Sep 4 13:54:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] a40ceb0 Introduce VTCP_read() which is a timeout-read on tcp sockets. Message-ID: commit a40ceb077e58c1d35f5e27568e745959be8e5007 Author: Poul-Henning Kamp Date: Mon Aug 10 09:23:47 2015 +0000 Introduce VTCP_read() which is a timeout-read on tcp sockets. diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 9b8d2a5..56340e0 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -41,7 +41,6 @@ #include "config.h" #include -#include #include #include @@ -197,8 +196,7 @@ SES_RxReInit(struct http_conn *htc) enum htc_status_e SES_Rx(struct http_conn *htc, double tmo) { - int i, j; - struct pollfd pfd[1]; + int i; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); AN(htc->ws->r); @@ -207,18 +205,9 @@ SES_Rx(struct http_conn *htc, double tmo) i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ if (i <= 0) return (HTC_S_OVERFLOW); - if (tmo > 0.0) { - pfd[0].fd = htc->fd; - pfd[0].events = POLLIN; - pfd[0].revents = 0; - j = (int)floor(tmo * 1e3); - if (j == 0) - j++; - j = poll(pfd, 1, j); - if (j == 0) - return (HTC_S_TIMEOUT); - } - i = read(htc->fd, htc->rxbuf_e, i); + i = VTCP_read(htc->fd, htc->rxbuf_e, i, tmo); + if (i == -2) + return (HTC_S_TIMEOUT); if (i <= 0) return (HTC_S_EOF); htc->rxbuf_e += i; diff --git a/include/vtcp.h b/include/vtcp.h index f00b44a..a42e768 100644 --- a/include/vtcp.h +++ b/include/vtcp.h @@ -62,4 +62,5 @@ int VTCP_listen(const struct suckaddr *addr, int depth, const char **errp); int VTCP_listen_on(const char *addr, const char *def_port, int depth, const char **errp); void VTCP_set_read_timeout(int s, double seconds); +int VTCP_read(int fd, void *ptr, size_t len, double tmo); // #endif diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c index a168c5f..3992555 100644 --- a/lib/libvarnish/vtcp.c +++ b/lib/libvarnish/vtcp.c @@ -554,3 +554,28 @@ VTCP_Check(int a) #endif return (0); } + +/*-------------------------------------------------------------------- + * + */ + +int +VTCP_read(int fd, void *ptr, size_t len, double tmo) +{ + struct pollfd pfd[1]; + int i, j; + + if (tmo > 0.0) { + pfd[0].fd = fd; + pfd[0].events = POLLIN; + pfd[0].revents = 0; + j = (int)floor(tmo * 1e3); + if (j == 0) + j++; + j = poll(pfd, 1, j); + if (j == 0) + return (-2); + } + i = read(fd, ptr, len); + return (i < 0 ? -1 : i); +} From phk at FreeBSD.org Fri Sep 4 13:54:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 891889f Retool SES_RxReq() from a REQ specific thing to a general "receive som stuff on this TCP connection with timeouts" function. Message-ID: commit 891889f0d3613fb3e59167f87cc0752876f2bb1d Author: Poul-Henning Kamp Date: Mon Aug 10 09:55:58 2015 +0000 Retool SES_RxReq() from a REQ specific thing to a general "receive som stuff on this TCP connection with timeouts" function. Inpired by colliding patches from Martin & Lasse. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 6719345..4c57c4e 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -980,8 +980,8 @@ void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes, unsigned maxhdr); void SES_RxReInit(struct http_conn *htc); enum htc_status_e SES_Rx(struct http_conn *htc, double tmo); -enum htc_status_e SES_RxReq(const struct worker *, struct req *, - htc_complete_f *func); +enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double t0, + double *t1, double *t2, double ti, double tn); #define SESS_ATTR(UP, low, typ, len) \ int SES_Get_##low(const struct sess *sp, typ *dst); \ diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 56340e0..7476419 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -217,66 +217,73 @@ SES_Rx(struct http_conn *htc, double tmo) /*---------------------------------------------------------------------- * Receive a request/packet/whatever, with timeouts + * + * t0 is when we start + * *t1 becomes time of first non-idle rx + * *t2 becomes time of complete rx + * ti is when we return IDLE if nothing has arrived + * tn is when we timeout on non-complete */ enum htc_status_e -SES_RxReq(const struct worker *wrk, struct req *req, htc_complete_f *func) +SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, + double *t1, double *t2, double ti, double tn) { double tmo; - double now, when; - struct sess *sp; + double now; enum htc_status_e hs; - CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); - CHECK_OBJ_NOTNULL(req, REQ_MAGIC); - sp = req->sp; - CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); + CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); - AZ(isnan(sp->t_idle)); - assert(isnan(req->t_first)); + AZ(isnan(t0)); + AZ(isnan(tn)); + if (t1 != NULL) + assert(isnan(*t1)); - when = sp->t_idle + cache_param->timeout_idle; - tmo = cache_param->timeout_linger; + now = t0; while (1) { - hs = SES_Rx(req->htc, tmo); - now = VTIM_real(); + if (!isnan(ti)) + tmo = ti - t0; + else + tmo = tn - t0; + hs = SES_Rx(htc, tmo); if (hs == HTC_S_EOF) { - WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b); + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_CLOSE); } if (hs == HTC_S_OVERFLOW) { - WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b); + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_OVERFLOW); } - hs = func(req->htc); + now = VTIM_real(); + hs = func(htc); if (hs == HTC_S_OVERFLOW) { - WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b); + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_OVERFLOW); } if (hs == HTC_S_JUNK) { - WS_ReleaseP(req->htc->ws, req->htc->rxbuf_b); + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_JUNK); } if (hs == HTC_S_COMPLETE) { /* Got it, run with it */ - if (isnan(req->t_first)) - req->t_first = now; - req->t_req = now; + if (t1 != NULL && isnan(*t1)) + *t1 = now; + if (t2 != NULL) + *t2 = now; return (HTC_S_COMPLETE); } - if (when < now) + if (tn < now) return (HTC_S_TIMEOUT); if (hs == HTC_S_MORE) { /* Working on it */ - if (isnan(req->t_first)) - req->t_first = now; - tmo = when - now; + if (t1 != NULL && isnan(*t1)) + *t1 = now; + tmo = tn - now; continue; } assert(hs == HTC_S_EMPTY); - /* Nothing but whitespace */ - tmo = sp->t_idle + cache_param->timeout_linger - now; - if (tmo < 0) + if (ti < now) return (HTC_S_IDLE); } } diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index 103ba3b..e66fa96 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -199,7 +199,10 @@ HTTP1_Session(struct worker *wrk, struct req *req) AZ(req->vcl); AZ(req->esi_level); - hs = SES_RxReq(wrk, req, HTTP1_Complete); + hs = SES_RxStuff(req->htc, HTTP1_Complete, sp->t_idle, + &req->t_first, &req->t_req, + sp->t_idle + cache_param->timeout_linger, + sp->t_idle + cache_param->timeout_idle); if (hs < HTC_S_EMPTY) { req->acct.req_hdrbytes += req->htc->rxbuf_e - req->htc->rxbuf_b; diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index e359cb0..f3c9caa 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -351,7 +351,8 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) assert(sizeof vpx1_sig == 5); assert(sizeof vpx2_sig == 12); - hs = SES_RxReq(wrk, req, vpx_complete); + hs = SES_RxStuff(req->htc, vpx_complete, sp->t_idle, + NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle); if (hs != HTC_S_COMPLETE) { Req_Release(req); SES_Delete(sp, SC_RX_JUNK, NAN); @@ -377,8 +378,6 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) req->htc->pipeline_e = req->htc->rxbuf_e; WS_Release(req->htc->ws, 0); SES_RxReInit(req->htc); - req->t_req = NAN; - req->t_first = NAN; req->sp->sess_step = S_STP_H1NEWREQ; wrk->task.func = SES_Proto_Req; wrk->task.priv = req; From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 9e6f88d Add the name of the built-in directors during init Message-ID: commit 9e6f88dede2eec3d366f52ea36076557581b9854 Author: Dridi Boukelmoune Date: Tue Aug 11 09:46:41 2015 +0200 Add the name of the built-in directors during init diff --git a/lib/libvmod_directors/fall_back.c b/lib/libvmod_directors/fall_back.c index 77ec45c..e73b1cf 100644 --- a/lib/libvmod_directors/fall_back.c +++ b/lib/libvmod_directors/fall_back.c @@ -91,7 +91,7 @@ vmod_fallback__init(VRT_CTX, ALLOC_OBJ(rr, VMOD_DIRECTORS_FALLBACK_MAGIC); AN(rr); *rrp = rr; - vdir_new(&rr->vd, vcl_name, vmod_fallback_healthy, + vdir_new(&rr->vd, "fallback", vcl_name, vmod_fallback_healthy, vmod_fallback_resolve, rr); } diff --git a/lib/libvmod_directors/hash.c b/lib/libvmod_directors/hash.c index c3def17..3029c7b 100644 --- a/lib/libvmod_directors/hash.c +++ b/lib/libvmod_directors/hash.c @@ -64,7 +64,7 @@ vmod_hash__init(VRT_CTX, struct vmod_directors_hash **rrp, rr->vbm = vbit_init(8); AN(rr->vbm); *rrp = rr; - vdir_new(&rr->vd, vcl_name, NULL, NULL, rr); + vdir_new(&rr->vd, "hash", vcl_name, NULL, NULL, rr); } VCL_VOID __match_proto__() diff --git a/lib/libvmod_directors/random.c b/lib/libvmod_directors/random.c index a0612f3..2f29887 100644 --- a/lib/libvmod_directors/random.c +++ b/lib/libvmod_directors/random.c @@ -87,8 +87,8 @@ vmod_random__init(VRT_CTX, struct vmod_directors_random **rrp, ALLOC_OBJ(rr, VMOD_DIRECTORS_RANDOM_MAGIC); AN(rr); *rrp = rr; - vdir_new(&rr->vd, vcl_name, vmod_random_healthy, vmod_random_resolve, - rr); + vdir_new(&rr->vd, "random", vcl_name, vmod_random_healthy, + vmod_random_resolve, rr); } VCL_VOID __match_proto__() diff --git a/lib/libvmod_directors/round_robin.c b/lib/libvmod_directors/round_robin.c index be92545..b2acf49 100644 --- a/lib/libvmod_directors/round_robin.c +++ b/lib/libvmod_directors/round_robin.c @@ -94,7 +94,8 @@ vmod_round_robin__init(VRT_CTX, ALLOC_OBJ(rr, VMOD_DIRECTORS_ROUND_ROBIN_MAGIC); AN(rr); *rrp = rr; - vdir_new(&rr->vd, vcl_name, vmod_rr_healthy, vmod_rr_resolve, rr); + vdir_new(&rr->vd, "round-robin", vcl_name, vmod_rr_healthy, + vmod_rr_resolve, rr); } VCL_VOID __match_proto__() diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index 938d6de..411df34 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -51,11 +51,12 @@ vdir_expand(struct vdir *vd, unsigned n) } void -vdir_new(struct vdir **vdp, const char *vcl_name, vdi_healthy_f *healthy, - vdi_resolve_f *resolve, void *priv) +vdir_new(struct vdir **vdp, const char *name, const char *vcl_name, + vdi_healthy_f *healthy, vdi_resolve_f *resolve, void *priv) { struct vdir *vd; + AN(name); AN(vcl_name); AN(vdp); AZ(*vdp); @@ -66,6 +67,7 @@ vdir_new(struct vdir **vdp, const char *vcl_name, vdi_healthy_f *healthy, ALLOC_OBJ(vd->dir, DIRECTOR_MAGIC); AN(vd->dir); + vd->dir->name = name; REPLACE(vd->dir->vcl_name, vcl_name); vd->dir->priv = priv; vd->dir->healthy = healthy; diff --git a/lib/libvmod_directors/vdir.h b/lib/libvmod_directors/vdir.h index 9214911..2e1cfe1 100644 --- a/lib/libvmod_directors/vdir.h +++ b/lib/libvmod_directors/vdir.h @@ -41,8 +41,8 @@ struct vdir { struct vbitmap *vbm; }; -void vdir_new(struct vdir **vdp, const char *vcl_name, vdi_healthy_f *healthy, - vdi_resolve_f *resolve, void *priv); +void vdir_new(struct vdir **vdp, const char *name, const char *vcl_name, + vdi_healthy_f *healthy, vdi_resolve_f *resolve, void *priv); void vdir_delete(struct vdir **vdp); void vdir_lock(struct vdir *vd); void vdir_unlock(struct vdir *vd); From phk at FreeBSD.org Fri Sep 4 13:54:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 9cd4a90 The ESI_VDP would double-close sessions when a flush error happened before an ESI include at one level, and then again at a higher level. Message-ID: commit 9cd4a9004dbc150bce5b98e31339075e5ab79caf Author: Poul-Henning Kamp Date: Mon Aug 10 11:18:16 2015 +0000 The ESI_VDP would double-close sessions when a flush error happened before an ESI include at one level, and then again at a higher level. Fixed by not closing the session in this case, as that will be taken care of at the end of delivery anyways when V1L_FlushRelease is called. Fixes: #1737 Submitted by: Martin diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index aa011b6..72a7763 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -317,7 +317,6 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, r = (void*)strchr((const char*)q, '\0'); AN(r); if (VDP_bytes(req, VDP_FLUSH, NULL, 0)) { - SES_Close(req->sp, SC_REM_CLOSE); ecx->p = ecx->e; break; } diff --git a/bin/varnishtest/tests/r01737.vtc b/bin/varnishtest/tests/r01737.vtc new file mode 100644 index 0000000..66c5aee --- /dev/null +++ b/bin/varnishtest/tests/r01737.vtc @@ -0,0 +1,43 @@ +varnishtest "#1737 - ESI sublevel session close" + +# Build a esi request tree that fails on flush before include at two different +# levels. Synchronize a client close after the response headers have been +# received by the client. This produces write erros for the body parts in all +# fragments. +server s1 { + rxreq + txresp -body {} + sema r1 sync 2 + + rxreq + delay 1 + txresp -body {22} + + rxreq + txresp -body {1} + + rxreq + expect req.url == "/check" + rxresp +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.do_esi = true; + } +} -start + +# Send request, read response headers then close connection +client c1 { + txreq + rxresp -no_obj + sema r1 sync 2 +} -run + +delay 3 + +# Check that Varnish is alive +client c1 { + txreq + rxresp +} -run From fgsch at lodoss.net Fri Sep 4 13:54:53 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 44659cf GC removed functions Message-ID: commit 44659cf4bb33e77f5c650ddcaa536d04ecc4adb0 Author: Federico G. Schwindt Date: Tue Aug 11 11:28:49 2015 +0100 GC removed functions diff --git a/lib/libvarnish/vsb.3 b/lib/libvarnish/vsb.3 index e0968c7..0918289 100644 --- a/lib/libvarnish/vsb.3 +++ b/lib/libvarnish/vsb.3 @@ -34,20 +34,14 @@ .Sh NAME .Nm vsb_new , .Nm vsb_clear , -.Nm vsb_setpos , .Nm vsb_bcat , -.Nm vsb_bcpy , .Nm vsb_cat , -.Nm vsb_cpy , .Nm vsb_printf , .Nm vsb_vprintf , .Nm vsb_putc , -.Nm vsb_trim , -.Nm vsb_overflowed , .Nm vsb_finish , .Nm vsb_data , .Nm vsb_len , -.Nm vsb_done , .Nm vsb_delete .Nd safe string formatting .Sh LIBRARY @@ -59,33 +53,21 @@ .Ft void .Fn vsb_clear "struct vsb *s" .Ft int -.Fn vsb_setpos "struct vsb *s" "int pos" -.Ft int .Fn vsb_bcat "struct vsb *s" "const void *buf" "size_t len" .Ft int -.Fn vsb_bcpy "struct vsb *s" "const void *buf" "size_t len" -.Ft int .Fn vsb_cat "struct vsb *s" "const char *str" .Ft int -.Fn vsb_cpy "struct vsb *s" "const char *str" -.Ft int .Fn vsb_printf "struct vsb *s" "const char *fmt" "..." .Ft int .Fn vsb_vprintf "struct vsb *s" "const char *fmt" "va_list ap" .Ft int .Fn vsb_putc "struct vsb *s" "int c" -.Ft int -.Fn vsb_trim "struct vsb *s" -.Ft int -.Fn vsb_overflowed "struct vsb *s" .Ft void .Fn vsb_finish "struct vsb *s" .Ft char * .Fn vsb_data "struct vsb *s" .Ft int .Fn vsb_len "struct vsb *s" -.Ft int -.Fn vsb_done "struct vsb *s" .Ft void .Fn vsb_delete "struct vsb *s" .Sh DESCRIPTION @@ -162,16 +144,6 @@ function invalidates the contents of the and resets its position to zero. .Pp The -.Fn vsb_setpos -function sets the -.Fa vsb Ns 's -end position to -.Fa pos , -which is a value between zero and one less than the size of the -storage buffer. -This effectively truncates the vsb at the new position. -.Pp -The .Fn vsb_bcat function appends the first .Fa len @@ -181,15 +153,6 @@ to the .Fa vsb . .Pp The -.Fn vsb_bcpy -function replaces the contents of the -.Fa vsb -with the first -.Fa len -bytes from the buffer -.Fa buf . -.Pp -The .Fn vsb_cat function appends the NUL-terminated string .Fa str @@ -198,21 +161,6 @@ to the at the current position. .Pp The -.Fn vsb_cpy -function replaces the contents of the -.Fa vsb -with those of the NUL-terminated string -.Fa str . -This is equivalent to calling -.Fn vsb_cat -with a fresh -.Fa vsb -or one which position has been reset to zero with -.Fn vsb_clear -or -.Fn vsb_setpos . -.Pp -The .Fn vsb_printf function formats its arguments according to the format string pointed to by @@ -237,25 +185,12 @@ to the at the current position. .Pp The -.Fn vsb_trim -function removes trailing whitespace from the -.Fa vsb . -.Pp -The -.Fn vsb_overflowed -function returns a non-zero value if the -.Fa vsb -overflowed. -.Pp -The .Fn vsb_finish function null-terminates the .Fa vsb and marks it as finished, which means that it may no longer be modified using -.Fn vsb_setpos , .Fn vsb_cat , -.Fn vsb_cpy , .Fn vsb_printf or .Fn vsb_putc . @@ -268,8 +203,6 @@ functions return the actual string and its length, respectively; .Fn vsb_data only works on a finished .Fa vsb . -.Fn vsb_done -returns non-zero if the vsb is finished. .Sh NOTES If an operation caused an .Fa vsb @@ -278,12 +211,7 @@ to overflow, most subsequent operations on it will fail until the is finished using .Fn vsb_finish or reset using -.Fn vsb_clear , -or its position is reset to a value between 0 and one less than the -size of its storage buffer using -.Fn vsb_setpos , -or it is reinitialized to a sufficiently short string using -.Fn vsb_cpy . +.Fn vsb_clear . .Sh RETURN VALUES .Fn vsb_new returns @@ -292,22 +220,12 @@ if it failed to allocate a storage buffer, and a pointer to the new .Fa vsb otherwise. .Pp -.Fn vsb_setpos -returns \-1 if -.Fa pos -was invalid, and zero otherwise. -.Pp .Fn vsb_cat , -.Fn vsb_cpy , .Fn vsb_printf , -.Fn vsb_putc , and -.Fn vsb_trim +.Fn vsb_putc all return \-1 if the buffer overflowed, and zero otherwise. .Pp -.Fn vsb_overflowed -returns a non-zero value if the buffer overflowed, and zero otherwise. -.Pp .Fn vsb_data and .Fn vsb_len From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] c94a54b Consistent indentation Message-ID: commit c94a54b16cca4be4ffbd9cfc82ce1b9525595ade Author: Dridi Boukelmoune Date: Mon Aug 10 10:22:26 2015 +0200 Consistent indentation diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst index 8eb11ed..bb73dd0 100644 --- a/doc/sphinx/reference/index.rst +++ b/doc/sphinx/reference/index.rst @@ -26,35 +26,35 @@ The Varnish Reference Manual vsl-query.rst .. todo:: - The programs: - . varnishd manual page - . varnishstat - . - counters explained - . common filtering options for shmlog tools - . varnishlog .. - . varnishtop .. - . varnishncsa .. - . varnishhist .. - 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. + The programs: + . varnishd manual page + . varnishstat + . - counters explained + . common filtering options for shmlog tools + . varnishlog .. + . varnishtop .. + . varnishncsa .. + . varnishhist .. + 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. Shared Memory . internals . Log records From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] cff301d Make sure `man -k varnish` finds all manuals pages Message-ID: commit cff301d2284ce3129c8a0898852e8e58ad05c6cf Author: Dridi Boukelmoune Date: Mon Aug 10 11:00:29 2015 +0200 Make sure `man -k varnish` finds all manuals pages diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index afa4a0b..b85e8a8 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -6,9 +6,9 @@ varnishstat =========== ---------------------------- +------------------------ Varnish Cache statistics ---------------------------- +------------------------ :Manual section: 1 diff --git a/doc/sphinx/reference/vsl.rst b/doc/sphinx/reference/vsl.rst index f90571e..0e753b0 100644 --- a/doc/sphinx/reference/vsl.rst +++ b/doc/sphinx/reference/vsl.rst @@ -6,9 +6,9 @@ VSL === ---------------------- -Shared Memory Logging ---------------------- +----------------------------- +Varnish Shared Memory Logging +----------------------------- :Manual section: 7 From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] fc7b312 Introduce new documentation placeholders Message-ID: commit fc7b31289440d8bc70c5e523617d2d1edf0c396d Author: Dridi Boukelmoune Date: Tue Aug 11 17:48:19 2015 +0200 Introduce new documentation placeholders diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index c339f0e..57fea73 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -1,3 +1,5 @@ +.. _ref-vmod: + %%%%%%%%%%%%%%%%%%%%%% VMOD - Varnish Modules %%%%%%%%%%%%%%%%%%%%%% @@ -99,6 +101,9 @@ For the std VMOD, the compiled vcc_if.h file looks like this:: Those are your C prototypes. Notice the ``vmod_`` prefix on the function names and the C-types as arguments. + +.. _ref-vmod-vcl-c-types: + VCL and C data types ==================== @@ -335,6 +340,20 @@ in the C-code etc, it is the VMODs own responsibility to track how many VCLs have called init (& fini) and free this global state when the count reaches zero. +.. _ref-vmod-event-functions: + +Event functions +=============== + +TODO + +.. _ref-vmod-objects: + +VMOD Objects +============ + +TODO + When to lock, and when not to lock ================================== From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 7e88396 Make documentation reference more explicit Message-ID: commit 7e883962c0bf065d54ab22dbfa88d9da19546a37 Author: Dridi Boukelmoune Date: Tue Aug 11 17:49:53 2015 +0200 Make documentation reference more explicit diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 57fea73..387843a 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -193,16 +193,16 @@ STRING_LIST are big enough. PRIV_VCL - See below + See :ref:`ref-vmod-private-pointers` below PRIV_CALL - See below + See :ref:`ref-vmod-private-pointers` below PRIV_TASK - See below + See :ref:`ref-vmod-private-pointers` below PRIV_TOP - See below + See :ref:`ref-vmod-private-pointers` below VOID C-type: ``void`` @@ -240,6 +240,8 @@ BLOB functions. +.. _ref-vmod-private-pointers: + Private Pointers ================ From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] ef786af Make the logging of logexpect clearer Message-ID: commit ef786affbd76cb13930d2088230bedc8df400008 Author: Poul-Henning Kamp Date: Wed Aug 12 12:00:08 2015 +0000 Make the logging of logexpect clearer diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index bd567ee..b74c688 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -182,7 +182,7 @@ logexp_next(struct logexp *le) CHECK_OBJ_ORNULL(le->test, LOGEXP_TEST_MAGIC); if (le->test) - vtc_log(le->vl, 3, "tst| %s", VSB_data(le->test->str)); + vtc_log(le->vl, 3, "waitfor| %s", VSB_data(le->test->str)); } static int __match_proto__(VSLQ_dispatch_f) @@ -239,7 +239,7 @@ logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[], skip = 1; if (ok) - legend = "ok"; + legend = "match"; else if (skip) legend = NULL; else @@ -450,7 +450,6 @@ cmd_logexp_expect(CMD_ARGS) test->tag = tag; test->vre = vre; VTAILQ_INSERT_TAIL(&le->tests, test, list); - vtc_log(vl, 4, "%s", VSB_data(test->str)); } static const struct cmds logexp_cmds[] = { From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:53 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:53 +0200 Subject: [4.1] 00d5576 Start documenting how to write a director Message-ID: commit 00d5576f68383f900b772b1657d3d7010a2f9a44 Author: Dridi Boukelmoune Date: Tue Aug 11 17:50:43 2015 +0200 Start documenting how to write a director diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst new file mode 100644 index 0000000..3adc333 --- /dev/null +++ b/doc/sphinx/reference/directors.rst @@ -0,0 +1,136 @@ +.. _ref-writing-a-director: + +%%%%%%%%%%%%%%%%%% +Writing a Director +%%%%%%%%%%%%%%%%%% + +Varnish already provides a set of general-purpose directors, and since Varnish +4, it is bundled in the built-in :ref:`vmod_directors(3)`. Writing a director +boils down to writing a VMOD, using the proper data structures and APIs. Not +only can you write your own director if none of the built-ins fit your needs, +but since Varnish 4.1 you can even write your own backends. + +Backends can be categorized as such: + +- static: native backends declared in VCL +- dynamic: native backends created by VMODs +- custom: backends created and fully managed by VMODs + + +Backends vs Directors +===================== + +The intuitive classification for backend and director is an endpoint for the +former and a cluster for the latter, but the actual implementation is a bit +more subtle. VMODs can accept backend arguments return backends in VCL (see +:ref:`ref-vmod-vcl-c-types`), but he underlying C type is ``struct director``. +Under the hood director is a generic concept, and a backend is a kind of +director. + +The line between the two is somewhat blurry at this point, let's look at some +code instead:: + + struct director { + unsigned magic; + #define DIRECTOR_MAGIC 0x3336351d + const char *name; + char *vcl_name; + vdi_http1pipe_f *http1pipe; + vdi_healthy_f *healthy; + vdi_resolve_f *resolve; + vdi_gethdrs_f *gethdrs; + vdi_getbody_f *getbody; + vdi_getip_f *getip; + vdi_finish_f *finish; + vdi_panic_f *panic; + void *priv; + const void *priv2; + }; + +A director can be summed up as: + +- a name (used for panics) +- a VCL name +- a set of operations +- the associated state + +What's the difference between a *cluster* director and a *backend* director? +The functions they will implement. + + +Creating a Director +=================== + +Custom Backends +--------------- + +If you want to implement a custom backend, have a look at how Varnish +implements native backends. It is the canonical implementation, and though it +provides other services like connection pooling or statistics, it is +essentially a director which state is a ``struct backend``. Varnish native +backends currently speak HTTP/1 over TCP, and as such, you need to make your +own custom backend if you want Varnish to do otherwise such as connecting over +UDP or UNIX-domain sockets or speaking a different protocol. + +You may also consider making your custom backend compliant with regards to the +VCL state (see :ref:`ref-vmod-event-functions`). + +A "backend" director must not implement the ``resolve`` function. More on that +below (:ref:`ref-writing-a-director-cluster`). + + +Dynamic Backends +---------------- + +If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the +bill, you can instead reuse the whole backend facility. It allows you for +instance to add and remove backends on-demand without the need to reload your +VCL. You can then leverage your provisioning system. + +You don't really deal with ``struct backend``, all you need is available +through the runtime API. Consider the following snippet:: + + backend default { + .host = "localhost"; + } + +The VCL compiler will turn this declaration into a ``struct vrt_backend``. When +the VCL is loaded, Varnish will call ``VRT_new_backend`` in order to create the +director. Dynamic backends are built just like static backends, one *struct* at +a time. You can get rid of the ``struct vrt_backend`` as soon as you have the +``struct director``. + +Unlike a custom backend, a dynamic backend can't exceed its VCL's lifespan, +because native backends are *owned* by VCLs. Though a dynamic backend can't +outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The +VCL will delete the remaining backends once discarded, you don't need to take +care of it. + +Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic +backends. They are tied to the VCL life cycle and make a handy data structure +to keep track of backends. It is also true for *cluster* directors that may +reference native backends. + +Finally, Varnish will take care of event propagation for *all* native backends. + + +.. _ref-writing-a-director-cluster: + +Cluster Directors +----------------- + +As in :ref:`vmod_directors(3)`, you can write directors that will group +backends sharing the same role, and pick them according to a strategy. If you +need more than the built-in strategies (round-robin, hash, ...), even though +they can be stacked, it is always possible to write your own. + +In this case you simply need to implement the ``resolve`` function for the +director. Directors are walked until a leaf director is found. A leaf director +doesn't have a ``resolve`` function and is used to actually make the backend +request. + + +Health Probes +============= + +TODO diff --git a/doc/sphinx/reference/index.rst b/doc/sphinx/reference/index.rst index bb73dd0..e787b4e 100644 --- a/doc/sphinx/reference/index.rst +++ b/doc/sphinx/reference/index.rst @@ -22,6 +22,7 @@ The Varnish Reference Manual vmod.rst vmod_std.generated.rst vmod_directors.generated.rst + directors.rst vsl.rst vsl-query.rst diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 387843a..015e36c 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -239,6 +239,12 @@ BLOB An opaque type to pass random bits of memory between VMOD functions. +BACKEND + C-type: ``const struct director *`` + + A type for backend and director implementations. See + :ref:`ref-writing-a-director` + .. _ref-vmod-private-pointers: diff --git a/doc/sphinx/users-guide/vcl-backends.rst b/doc/sphinx/users-guide/vcl-backends.rst index 9ec1c82..b44ba9c 100644 --- a/doc/sphinx/users-guide/vcl-backends.rst +++ b/doc/sphinx/users-guide/vcl-backends.rst @@ -143,8 +143,9 @@ call certain actions in `vcl_init`.:: This director is a round-robin director. This means the director will distribute the incoming requests on a round-robin basis. There is -also a *random* director which distributes requests in a, you guessed -it, random fashion. +also a *random* director which distributes requests in a, you guessed it, +random fashion. If that is not enough, you can also write your own director +(see :ref:`ref-writing-a-director`). But what if one of your servers goes down? Can Varnish direct all the requests to the healthy server? Sure it can. This is where the Health From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 61efcba Inspired by Martin I have stared hard at http_conn for a few days. Message-ID: commit 61efcba8d11bfe6a9f105c98830dd771a968883d Author: Poul-Henning Kamp Date: Wed Aug 12 12:35:35 2015 +0000 Inspired by Martin I have stared hard at http_conn for a few days. This commit cleans up a number of weeds and loose ends: The complete_function should not muck about with the pipelining or WS reservation. Only when we have dissected the headers for good do we know how long the headers were. Make the HTTP1_Dissect* functions have consistent parameters. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 4c57c4e..d73001b 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -838,8 +838,8 @@ enum sess_close http_DoConnection(struct http *hp); /* cache_http1_proto.c */ htc_complete_f HTTP1_Complete; -uint16_t HTTP1_DissectRequest(struct http_conn *htc, struct http *hp); -uint16_t HTTP1_DissectResponse(struct http *sp, struct http_conn *htc); +uint16_t HTTP1_DissectRequest(struct http_conn *, struct http *); +uint16_t HTTP1_DissectResponse(struct http_conn *, struct http *); unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*); #define HTTPH(a, b, c) extern char b[]; diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 7476419..21f405f 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -219,7 +219,7 @@ SES_Rx(struct http_conn *htc, double tmo) * Receive a request/packet/whatever, with timeouts * * t0 is when we start - * *t1 becomes time of first non-idle rx + * *t1 becomes time of first non-idle rx * *t2 becomes time of complete rx * ti is when we return IDLE if nothing has arrived * tn is when we timeout on non-complete @@ -266,6 +266,7 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, return (HTC_S_JUNK); } if (hs == HTC_S_COMPLETE) { + WS_ReleaseP(htc->ws, htc->rxbuf_e); /* Got it, run with it */ if (t1 != NULL && isnan(*t1)) *t1 = now; diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c index 2a2099b..ca1df5a 100644 --- a/bin/varnishd/http1/cache_http1_fetch.c +++ b/bin/varnishd/http1/cache_http1_fetch.c @@ -138,7 +138,7 @@ V1F_FetchRespHdr(struct busyobj *bo) struct http *hp; enum htc_status_e hs; - int first; + int first, i; struct http_conn *htc; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); @@ -188,11 +188,13 @@ V1F_FetchRespHdr(struct busyobj *bo) htc->between_bytes_timeout); } } while (hs != HTC_S_COMPLETE); - bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; + WS_ReleaseP(htc->ws, htc->rxbuf_e); hp = bo->beresp; - if (HTTP1_DissectResponse(hp, htc)) { + i = HTTP1_DissectResponse(htc, hp); + bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; + if (i) { VSLb(bo->vsl, SLT_FetchError, "http format error"); htc->doclose = SC_RX_JUNK; return (-1); diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index e66fa96..6acf78c 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -159,6 +159,7 @@ HTTP1_Session(struct worker *wrk, struct req *req) { enum htc_status_e hs; struct sess *sp; + int i; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); @@ -234,9 +235,6 @@ HTTP1_Session(struct worker *wrk, struct req *req) if (hs != HTC_S_COMPLETE) WRONG("htc_status (nonbad)"); - req->acct.req_hdrbytes += - req->htc->rxbuf_e - req->htc->rxbuf_b; - sp->sess_step = S_STP_H1WORKING; break; case S_STP_H1BUSY: @@ -255,7 +253,10 @@ HTTP1_Session(struct worker *wrk, struct req *req) sp->sess_step = S_STP_H1PROC; break; case S_STP_H1WORKING: - if (http1_dissect(wrk, req)) { + i = http1_dissect(wrk, req); + req->acct.req_hdrbytes += + req->htc->rxbuf_e - req->htc->rxbuf_b; + if (i) { SES_Close(req->sp, req->doclose); sp->sess_step = S_STP_H1CLEANUP; break; @@ -277,16 +278,16 @@ HTTP1_Session(struct worker *wrk, struct req *req) return; SES_RxReInit(req->htc); if (HTTP1_Complete(req->htc) == HTC_S_COMPLETE) { + WS_ReleaseP(req->htc->ws, req->htc->rxbuf_e); AZ(req->vsl->wid); req->t_first = req->t_req = sp->t_idle; wrk->stats->sess_pipeline++; - req->acct.req_hdrbytes += - req->htc->rxbuf_e - req->htc->rxbuf_b; sp->sess_step = S_STP_H1WORKING; } else { if (req->htc->rxbuf_e != req->htc->rxbuf_b) wrk->stats->sess_readahead++; sp->sess_step = S_STP_H1NEWREQ; + } break; default: diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c index 933c232..77b8f5b 100644 --- a/bin/varnishd/http1/cache_http1_proto.c +++ b/bin/varnishd/http1/cache_http1_proto.c @@ -83,6 +83,10 @@ HTTP1_Complete(struct http_conn *htc) *htc->rxbuf_e = '\0'; return (HTC_S_EMPTY); } + /* + * Here we just look for NL[CR]NL to see that reception + * is completed. More stringent validation happens later. + */ while (1) { p = strchr(p, '\n'); if (p == NULL) @@ -93,13 +97,6 @@ HTTP1_Complete(struct http_conn *htc) if (*p == '\n') break; } - p++; - WS_ReleaseP(htc->ws, htc->rxbuf_e); - if (p < htc->rxbuf_e) { - htc->pipeline_b = p; - htc->pipeline_e = htc->rxbuf_e; - htc->rxbuf_e = p; - } return (HTC_S_COMPLETE); } @@ -109,7 +106,7 @@ HTTP1_Complete(struct http_conn *htc) */ static uint16_t -http1_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) +http1_dissect_hdrs(struct http *hp, char *p, struct http_conn *htc) { char *q, *r; @@ -122,6 +119,8 @@ http1_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) /* Find end of next header */ q = r = p; + if (vct_iscrlf(p)) + break; while (r < htc->rxbuf_e) { if (!vct_iscrlf(r)) { r++; @@ -132,6 +131,8 @@ http1_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) r += vct_skipcrlf(r); if (r >= htc->rxbuf_e) break; + if (vct_iscrlf(r)) + break; /* If line does not continue: got it. */ if (!vct_issp(*r)) break; @@ -184,6 +185,13 @@ http1_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) return (400); } } + if (p < htc->rxbuf_e) + p += vct_skipcrlf(p); + if (p < htc->rxbuf_e) { + htc->pipeline_b = p; + htc->pipeline_e = htc->rxbuf_e; + htc->rxbuf_e = p; + } return (0); } @@ -192,7 +200,7 @@ http1_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) */ static uint16_t -http1_splitline(struct http *hp, const struct http_conn *htc, const int *hf) +http1_splitline(struct http *hp, struct http_conn *htc, const int *hf) { char *p; int i; @@ -390,7 +398,7 @@ HTTP1_DissectRequest(struct http_conn *htc, struct http *hp) /*--------------------------------------------------------------------*/ uint16_t -HTTP1_DissectResponse(struct http *hp, struct http_conn *htc) +HTTP1_DissectResponse(struct http_conn *htc, struct http *hp) { uint16_t retval = 0; const char *p; diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index f3c9caa..113cea1 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -376,7 +376,6 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) req->htc->pipeline_b = NULL; else req->htc->pipeline_e = req->htc->rxbuf_e; - WS_Release(req->htc->ws, 0); SES_RxReInit(req->htc); req->sp->sess_step = S_STP_H1NEWREQ; wrk->task.func = SES_Proto_Req; From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 852fb46 fix printf format Message-ID: commit 852fb4624f28eccd8ff802dabc2fdcce7d2b5103 Author: Poul-Henning Kamp Date: Wed Aug 12 13:55:47 2015 +0000 fix printf format diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index e20f668..617b65d 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -151,7 +151,8 @@ pan_htc(struct vsb *vsb, const struct http_conn *htc) htc->rxbuf_b, htc->rxbuf_e); VSB_printf(vsb, "{pipeline_b, pipeline_e} = {%p, %p},\n", htc->pipeline_b, htc->pipeline_e); - VSB_printf(vsb, "content_length = %jd,\n", htc->content_length); + VSB_printf(vsb, "content_length = %jd,\n", + (intmax_t)htc->content_length); VSB_printf(vsb, "body_status = %s,\n", body_status_2str(htc->body_status)); VSB_printf(vsb, "first_byte_timeout = %f,\n", From fgsch at lodoss.net Fri Sep 4 13:54:54 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] f8a913d Grammar and minor corrections Message-ID: commit f8a913d576b86195be86ee2174f47d0537e7af25 Author: Federico G. Schwindt Date: Wed Aug 12 23:10:18 2015 +0100 Grammar and minor corrections diff --git a/doc/changes.rst b/doc/changes.rst index 3caf9f0..a2e4598 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -614,7 +614,7 @@ Other Changes from 3.0.2 to 3.0.3 (2012-08-20) ======================================== -Varnishd +varnishd -------- - Fix a race on the n_sess counter. This race made varnish do excessive @@ -731,7 +731,7 @@ Other Changes from 3.0.2 rc 1 to 3.0.2 (2011-10-26) ============================================= -Varnishd +varnishd -------- - Make the size of the synthetic object workspace equal to @@ -762,7 +762,7 @@ Other Changes from 3.0.1 to 3.0.2 rc 1 (2011-10-06) ============================================= -Varnishd +varnishd -------- - Only log the first 20 bytes of extra headers to prevent overflows. @@ -824,7 +824,7 @@ Other Changes from 3.0.1 rc 1 to 3.0.1 (2011-08-30) ============================================= -Varnishd +varnishd -------- - Fix crash in streaming code. @@ -856,7 +856,7 @@ Other Changes from 3.0.0 to 3.0.1 rc 1 (2011-08-24) ============================================= -Varnishd +varnishd -------- - Avoid sending an empty end-chunk when sending bodyless responsed. @@ -933,7 +933,7 @@ Other Changes from 3.0 beta 2 to 3.0.0 (2011-06-16) ============================================= -Varnishd +varnishd -------- - Avoid sending an empty end-chunk when sending bodyless responsed. @@ -961,7 +961,7 @@ varnishadm Changes from 3.0 beta 1 to 3.0 beta 2 ===================================== -Varnishd +varnishd -------- - thread_pool_min and thread_pool_max now each refer to the number of @@ -1023,7 +1023,7 @@ Upcoming changes to do ``ban("req.url == " + req.url)`` instead. This syntax already works and is recommended. -Varnishd +varnishd -------- - Add streaming on ``pass`` and ``miss``. This is controlled by the @@ -1296,7 +1296,7 @@ varnishd - Do not filter out Content-Range headers in pass. -- Require -d, -b, -f, -S or -T when starting Varnishd. In human terms, +- Require -d, -b, -f, -S or -T when starting varnishd. In human terms, this means that it is legal to start varnishd without a Vcl or backend, but only if you have a CLI channel of some kind. diff --git a/doc/sphinx/glossary/index.rst b/doc/sphinx/glossary/index.rst index 2f9250e..a3d9761 100644 --- a/doc/sphinx/glossary/index.rst +++ b/doc/sphinx/glossary/index.rst @@ -21,7 +21,7 @@ Varnish Glossary master (process) One of the two processes in the varnishd program. - The master proces is a manager/nanny process which handles + The master process is a manager/nanny process which handles configuration, parameters, compilation of :term:VCL etc. but it does never get near the actual HTTP traffic. @@ -55,7 +55,7 @@ Varnish Glossary Program which presents varnish transaction log in "NCSA" format. varnishhist - Eye-candy program showing responsetime histogram in 1980ies + Eye-candy program showing response time histogram in 1980s ASCII-art style. varnishtest @@ -86,8 +86,8 @@ Varnish Glossary to varnishd they are just bytes. object - The (possibly) cached version of a backend response. Varnishd - receives a reponse from the backend and creates an object, + The (possibly) cached version of a backend response. varnishd + receives a response from the backend and creates an object, from which it may deliver cached responses to clients. If the object is created as a result of a request which is passed, it will not be stored for caching. diff --git a/doc/sphinx/reference/vsm.rst b/doc/sphinx/reference/vsm.rst index 13afbdd..fbea284 100644 --- a/doc/sphinx/reference/vsm.rst +++ b/doc/sphinx/reference/vsm.rst @@ -67,7 +67,7 @@ off" period. The Varnish way: ---------------- -If Varnishd starts, and finds a locked shared memory file, it will +If varnishd starts, and finds a locked shared memory file, it will exit with a message about using different -n arguments if you want multiple instances of varnishd. diff --git a/doc/sphinx/users-guide/run_security.rst b/doc/sphinx/users-guide/run_security.rst index d83ea18..41c68a8 100644 --- a/doc/sphinx/users-guide/run_security.rst +++ b/doc/sphinx/users-guide/run_security.rst @@ -47,7 +47,7 @@ CLI interface access The command line interface can be accessed in three ways. -`Varnishd` can be told to listen and offer CLI connections +`varnishd` can be told to listen and offer CLI connections on a TCP socket. You can bind the socket to pretty much anything the kernel will accept:: diff --git a/include/vsm_priv.h b/include/vsm_priv.h index 0cc1a9f..e6893cc 100644 --- a/include/vsm_priv.h +++ b/include/vsm_priv.h @@ -56,7 +56,7 @@ * Subscribers will have to monitor three things to make sure they look at * the right thing: The alloc_seq field, the age counter and the dev+inode * of the path-name. The former check is by far the cheaper, the second - * can be used to check that Varnishd is still alive and the last check + * can be used to check that varnishd is still alive and the last check * should only be employed when lack of activity in the VSM segment raises * suspicion that something has happened. * From fgsch at lodoss.net Fri Sep 4 13:54:54 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 1daa0c2 Specify the full path of the logs Message-ID: commit 1daa0c20bac4cf2ca9d0de0ba39d6646b3e46e37 Author: Federico G. Schwindt Date: Fri Aug 7 16:53:56 2015 +0100 Specify the full path of the logs This makes it easier to run multiple instances, each one writing to different files. diff --git a/redhat/varnish.logrotate b/redhat/varnish.logrotate index 535614d..f214d1b 100644 --- a/redhat/varnish.logrotate +++ b/redhat/varnish.logrotate @@ -1,4 +1,4 @@ -/var/log/varnish/*.log { +/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log { missingok notifempty sharedscripts From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] b6645ff Call the "complete" function first, the read more in SES_RxStuff() Message-ID: commit b6645ff23f84633f4061aa6274318870239bc227 Author: Poul-Henning Kamp Date: Fri Aug 14 07:18:34 2015 +0000 Call the "complete" function first, the read more in SES_RxStuff() This saves an entire state in the H1 FSM. (At the cost of not differentiating between read-ahead and full pipelining in VSC.) Inspired by patches from?Lasse & Martin diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 21f405f..69bf46d 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -232,6 +232,7 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, double tmo; double now; enum htc_status_e hs; + int i; CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); @@ -240,30 +241,12 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, if (t1 != NULL) assert(isnan(*t1)); - now = t0; while (1) { - if (!isnan(ti)) - tmo = ti - t0; - else - tmo = tn - t0; - hs = SES_Rx(htc, tmo); - if (hs == HTC_S_EOF) { - WS_ReleaseP(htc->ws, htc->rxbuf_b); - return (HTC_S_CLOSE); - } - if (hs == HTC_S_OVERFLOW) { - WS_ReleaseP(htc->ws, htc->rxbuf_b); - return (HTC_S_OVERFLOW); - } now = VTIM_real(); hs = func(htc); - if (hs == HTC_S_OVERFLOW) { + if (hs == HTC_S_OVERFLOW || hs == HTC_S_JUNK) { WS_ReleaseP(htc->ws, htc->rxbuf_b); - return (HTC_S_OVERFLOW); - } - if (hs == HTC_S_JUNK) { - WS_ReleaseP(htc->ws, htc->rxbuf_b); - return (HTC_S_JUNK); + return (hs); } if (hs == HTC_S_COMPLETE) { WS_ReleaseP(htc->ws, htc->rxbuf_e); @@ -274,18 +257,37 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, *t2 = now; return (HTC_S_COMPLETE); } - if (tn < now) + if (tn < now) { + /* XXX: WS_ReleaseP(htc->ws, htc->rxbuf_b); ? */ return (HTC_S_TIMEOUT); + } if (hs == HTC_S_MORE) { /* Working on it */ if (t1 != NULL && isnan(*t1)) *t1 = now; tmo = tn - now; - continue; + } else if (hs != HTC_S_EMPTY) + WRONG("htc_status_e"); + + tmo = tn - t0; + if (!isnan(ti) && ti < tn) + tmo = ti - t0; + i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ + if (i <= 0) { + WS_ReleaseP(htc->ws, htc->rxbuf_b); + return (HTC_S_OVERFLOW); + } + i = VTCP_read(htc->fd, htc->rxbuf_e, i, tmo); + if (i == 0 || i == -1) { + WS_ReleaseP(htc->ws, htc->rxbuf_b); + return (HTC_S_EOF); + } else if (i > 0) { + htc->rxbuf_e += i; + *htc->rxbuf_e = '\0'; + } else if (i == -2) { + if (hs == HTC_S_EMPTY && ti < now) + return (HTC_S_IDLE); } - assert(hs == HTC_S_EMPTY); - if (ti < now) - return (HTC_S_IDLE); } } diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index 6acf78c..7d7eef3 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -235,7 +235,16 @@ HTTP1_Session(struct worker *wrk, struct req *req) if (hs != HTC_S_COMPLETE) WRONG("htc_status (nonbad)"); - sp->sess_step = S_STP_H1WORKING; + i = http1_dissect(wrk, req); + req->acct.req_hdrbytes += + req->htc->rxbuf_e - req->htc->rxbuf_b; + if (i) { + SES_Close(req->sp, req->doclose); + sp->sess_step = S_STP_H1CLEANUP; + break; + } + req->req_step = R_STP_RECV; + sp->sess_step = S_STP_H1PROC; break; case S_STP_H1BUSY: /* @@ -252,18 +261,6 @@ HTTP1_Session(struct worker *wrk, struct req *req) } sp->sess_step = S_STP_H1PROC; break; - case S_STP_H1WORKING: - i = http1_dissect(wrk, req); - req->acct.req_hdrbytes += - req->htc->rxbuf_e - req->htc->rxbuf_b; - if (i) { - SES_Close(req->sp, req->doclose); - sp->sess_step = S_STP_H1CLEANUP; - break; - } - req->req_step = R_STP_RECV; - sp->sess_step = S_STP_H1PROC; - break; case S_STP_H1PROC: req->transport = &http1_transport; if (CNT_Request(wrk, req) == REQ_FSM_DISEMBARK) { @@ -277,18 +274,9 @@ HTTP1_Session(struct worker *wrk, struct req *req) if (Req_Cleanup(sp, wrk, req)) return; SES_RxReInit(req->htc); - if (HTTP1_Complete(req->htc) == HTC_S_COMPLETE) { - WS_ReleaseP(req->htc->ws, req->htc->rxbuf_e); - AZ(req->vsl->wid); - req->t_first = req->t_req = sp->t_idle; - wrk->stats->sess_pipeline++; - sp->sess_step = S_STP_H1WORKING; - } else { - if (req->htc->rxbuf_e != req->htc->rxbuf_b) - wrk->stats->sess_readahead++; - sp->sess_step = S_STP_H1NEWREQ; - - } + if (req->htc->rxbuf_e != req->htc->rxbuf_b) + wrk->stats->sess_readahead++; + sp->sess_step = S_STP_H1NEWREQ; break; default: WRONG("Wrong H1 session state"); diff --git a/bin/varnishtest/tests/b00012.vtc b/bin/varnishtest/tests/b00012.vtc index 81113b5..224bd1a 100644 --- a/bin/varnishtest/tests/b00012.vtc +++ b/bin/varnishtest/tests/b00012.vtc @@ -27,4 +27,4 @@ client c1 { expect resp.http.x-varnish == "1005 1004" } -run -varnish v1 -expect sess_pipeline == 2 +varnish v1 -expect sess_readahead == 2 diff --git a/include/tbl/steps.h b/include/tbl/steps.h index a5e618a..2c805d4 100644 --- a/include/tbl/steps.h +++ b/include/tbl/steps.h @@ -36,7 +36,6 @@ SESS_STEP(h1newreq, H1NEWREQ) SESS_STEP(h1proc, H1PROC) SESS_STEP(h1busy, H1BUSY) SESS_STEP(h1cleanup, H1CLEANUP) -SESS_STEP(h1working, H1WORKING) SESS_STEP(h1_last, H1_LAST) SESS_STEP(proxynewsess, PROXYNEWSESS) diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h index 3c6c8d0..94341b5 100644 --- a/include/tbl/vsc_f_main.h +++ b/include/tbl/vsc_f_main.h @@ -384,10 +384,6 @@ VSC_F(sess_closed_err, uint64_t, 0, 'c', 'i', info, "Total number of sessions closed with errors." " See sc_* diag counters for detailed breakdown" ) -VSC_F(sess_pipeline, uint64_t, 1, 'c', 'i', info, - "Session Pipeline", - "" -) VSC_F(sess_readahead, uint64_t, 1, 'c', 'i', info, "Session Read Ahead", "" From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] c954e37 Eliminate the 'T0' argument from SES_RxStuff() it only saves a timestamp syscall in very rare circumstances. Message-ID: commit c954e37bf986e09313b0d7b6561a3e958f0e50ef Author: Poul-Henning Kamp Date: Fri Aug 14 08:03:20 2015 +0000 Eliminate the 'T0' argument from SES_RxStuff() it only saves a timestamp syscall in very rare circumstances. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index d73001b..6a2b047 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -980,7 +980,7 @@ void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes, unsigned maxhdr); void SES_RxReInit(struct http_conn *htc); enum htc_status_e SES_Rx(struct http_conn *htc, double tmo); -enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double t0, +enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double *t1, double *t2, double ti, double tn); #define SESS_ATTR(UP, low, typ, len) \ diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 69bf46d..92f279a 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -226,7 +226,7 @@ SES_Rx(struct http_conn *htc, double tmo) */ enum htc_status_e -SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, +SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double *t1, double *t2, double ti, double tn) { double tmo; @@ -236,7 +236,6 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); - AZ(isnan(t0)); AZ(isnan(tn)); if (t1 != NULL) assert(isnan(*t1)); @@ -258,7 +257,7 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, return (HTC_S_COMPLETE); } if (tn < now) { - /* XXX: WS_ReleaseP(htc->ws, htc->rxbuf_b); ? */ + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_TIMEOUT); } if (hs == HTC_S_MORE) { @@ -269,9 +268,9 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, double t0, } else if (hs != HTC_S_EMPTY) WRONG("htc_status_e"); - tmo = tn - t0; + tmo = tn - now; if (!isnan(ti) && ti < tn) - tmo = ti - t0; + tmo = ti - now; i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ if (i <= 0) { WS_ReleaseP(htc->ws, htc->rxbuf_b); diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index 7d7eef3..8e5762a 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -200,7 +200,7 @@ HTTP1_Session(struct worker *wrk, struct req *req) AZ(req->vcl); AZ(req->esi_level); - hs = SES_RxStuff(req->htc, HTTP1_Complete, sp->t_idle, + hs = SES_RxStuff(req->htc, HTTP1_Complete, &req->t_first, &req->t_req, sp->t_idle + cache_param->timeout_linger, sp->t_idle + cache_param->timeout_idle); diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index 113cea1..b817bc5 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -351,7 +351,7 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) assert(sizeof vpx1_sig == 5); assert(sizeof vpx2_sig == 12); - hs = SES_RxStuff(req->htc, vpx_complete, sp->t_idle, + hs = SES_RxStuff(req->htc, vpx_complete, NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle); if (hs != HTC_S_COMPLETE) { Req_Release(req); From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 4da5dff Always release the WS when SES_RxStuff() returns. Message-ID: commit 4da5dffafbe047015bcf03c1dd237c5b091c0fac Author: Poul-Henning Kamp Date: Fri Aug 14 10:39:12 2015 +0000 Always release the WS when SES_RxStuff() returns. diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 92f279a..8333123 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -284,8 +284,10 @@ SES_RxStuff(struct http_conn *htc, htc_complete_f *func, htc->rxbuf_e += i; *htc->rxbuf_e = '\0'; } else if (i == -2) { - if (hs == HTC_S_EMPTY && ti < now) + if (hs == HTC_S_EMPTY && ti < now) { + WS_ReleaseP(htc->ws, htc->rxbuf_b); return (HTC_S_IDLE); + } } } } diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c index 8e5762a..210be90 100644 --- a/bin/varnishd/http1/cache_http1_fsm.c +++ b/bin/varnishd/http1/cache_http1_fsm.c @@ -204,6 +204,7 @@ HTTP1_Session(struct worker *wrk, struct req *req) &req->t_first, &req->t_req, sp->t_idle + cache_param->timeout_linger, sp->t_idle + cache_param->timeout_idle); + XXXAZ(req->htc->ws->r); if (hs < HTC_S_EMPTY) { req->acct.req_hdrbytes += req->htc->rxbuf_e - req->htc->rxbuf_b; diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index b817bc5..d029861 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -353,6 +353,7 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) hs = SES_RxStuff(req->htc, vpx_complete, NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle); + XXXAZ(req->htc->ws->r); if (hs != HTC_S_COMPLETE) { Req_Release(req); SES_Delete(sp, SC_RX_JUNK, NAN); From fgsch at lodoss.net Fri Sep 4 13:54:54 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] b79da41 First stab at getting event documented Message-ID: commit b79da4195f0755d9323e52f06c7651441f9ba09f Author: Federico G. Schwindt Date: Fri Aug 14 13:22:54 2015 +0100 First stab at getting event documented diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 015e36c..6053685 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -51,17 +51,17 @@ data structures that does all the hard work. The std VMODs vmod.vcc file looks somewhat like this:: $Module std 3 - $Init init_function + $Event event_function $Function STRING toupper(STRING_LIST) $Function STRING tolower(STRING_LIST) $Function VOID set_ip_tos(INT) The first line gives the name of the module, nothing special there. -The second line specifies an optional "Init" function, which will -be called whenever a VCL program which imports this VMOD is loaded. -This gives a chance to initialize the module before any of the -functions it implements are called. More on this below. +The second line specifies an optional "Event" function, which will be +called whenever a VCL program which imports this VMOD is initially loaded +or transitions to any of the warm, active, cold and discarded states. +More on this below. The next three lines specify two functions in the VMOD, along with the types of the arguments, and that is probably where the hardest bit @@ -96,7 +96,7 @@ For the std VMOD, the compiled vcc_if.h file looks like this:: VCL_STRING vmod_tolower(VRT_CTX, const char *, ...); VCL_VOID vmod_set_ip_tos(VRT_CTX, VCL_INT); - int init_function(VRT_CTX, struct vmod_priv *); + vmod_event_f event_function; Those are your C prototypes. Notice the ``vmod_`` prefix on the function names and the C-types as arguments. @@ -242,8 +242,8 @@ BLOB BACKEND C-type: ``const struct director *`` - A type for backend and director implementations. See - :ref:`ref-writing-a-director` + A type for backend and director implementations. See + :ref:`ref-writing-a-director`. .. _ref-vmod-private-pointers: @@ -326,34 +326,30 @@ malloc would look like this:: The per-call vmod_privs are freed before the per-vcl vmod_priv. -Init functions -============== - -VMODs can have an "init" method which is called when a VCL -which imports the VMOD is loaded. - -The first argument to the init function is the vmod_priv specific -to this particular VCL, and if necessary, a VCL specific VMOD "fini" -function can be attached to its "free" hook. +.. _ref-vmod-event-functions: -The second argument is a pointer to the VCL's config structure, -which allows you to tell different VCLs which import this module -apart. +Event functions +=============== -Please notice that there is no "global" fini method. +VMODs can have an "event" function which is called when a VCL which +imports the VMOD is loaded, made active, or discarded. This corresponds +to the VCL_EVENT_LOAD, VCL_EVENT_USE, and VCL_EVENT_DISCARD events, +respectively. In addition, this function will be called when the VCL +state is changed to cold or warm, corresponding to the VCL_EVENT_COLD +and VCL_EVENT_WARM events. -If the VMOD has private global state, which includes any sockets -or files opened, any memory allocated to global or private variables -in the C-code etc, it is the VMODs own responsibility to track how -many VCLs have called init (& fini) and free this global state -when the count reaches zero. +The first argument to the event function is the VRT context. -.. _ref-vmod-event-functions: +The second argument is the vmod_priv specific to this particular VCL, +and if necessary, a VCL specific VMOD "fini" function can be attached +to its "free" hook. -Event functions -=============== +The third argument is the event. -TODO +If the VMOD has private global state, which includes any sockets or files +opened, any memory allocated to global or private variables in the C-code +etc, it is the VMODs own responsibility to track how many VCLs have called +init (& fini) and free this global state when the count reaches zero .. _ref-vmod-objects: @@ -368,7 +364,7 @@ When to lock, and when not to lock Varnish is heavily multithreaded, so by default VMODs must implement their own locking to protect shared resources. -When a VCL is loaded or unloaded, the init and priv->free are +When a VCL is loaded or unloaded, the event and priv->free are run sequentially all in a single thread, and there is guaranteed to be no other activity related to this particular VCL, nor are there init/fini activity in any other VCL or VMOD at this time. @@ -396,7 +392,7 @@ times it will give you the same single copy of the shared library file, without checking if it was updated in the meantime. This is obviously an oversight in the design of the dlopen(3) library -function, but back in the late 1980ies nobody could imagine why a +function, but back in the late 1980s nobody could imagine why a program would ever want to have multiple different versions of the same shared library mapped at the same time. From fgsch at lodoss.net Fri Sep 4 13:54:54 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 929be35 Rearrange and minor updates Message-ID: commit 929be359b4757ff2f11f6f28fd539338c917c4b7 Author: Federico G. Schwindt Date: Fri Aug 14 15:24:08 2015 +0100 Rearrange and minor updates diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 6053685..893a1c7 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -56,22 +56,23 @@ The std VMODs vmod.vcc file looks somewhat like this:: $Function STRING tolower(STRING_LIST) $Function VOID set_ip_tos(INT) -The first line gives the name of the module, nothing special there. +The first line gives the name of the module and the manual section where +the documentation will reside. The second line specifies an optional "Event" function, which will be -called whenever a VCL program which imports this VMOD is initially loaded -or transitions to any of the warm, active, cold and discarded states. +called whenever a VCL program which imports this VMOD is loaded or +transitions to any of the warm, active, cold or discarded states. More on this below. -The next three lines specify two functions in the VMOD, along with the -types of the arguments, and that is probably where the hardest bit -of writing a VMOD is to be found, so we will talk about that at length -in a moment. +The next three lines define three functions in the VMOD, along with the +types of the arguments, and that is probably where the hardest bit of +writing a VMOD is to be found, so we will talk about that at length in +a moment. Notice that the third function returns VOID, that makes it a "procedure" -in VCL lingo, meaning that it cannot be used in expressions, right -side of assignments and such places. Instead it can be used as a -primary action, something functions which return a value can not:: +in VCL lingo, meaning that it cannot be used in expressions, right side +of assignments and such. Instead it can be used as a primary action, +something functions which return a value can not:: sub vcl_recv { std.set_ip_tos(32); @@ -98,8 +99,8 @@ For the std VMOD, the compiled vcc_if.h file looks like this:: vmod_event_f event_function; -Those are your C prototypes. Notice the ``vmod_`` prefix on the function -names and the C-types as arguments. +Those are your C prototypes. Notice the ``vmod_`` prefix on the +function names. .. _ref-vmod-vcl-c-types: @@ -111,40 +112,91 @@ VCL data types are targeted at the job, so for instance, we have data types like "DURATION" and "HEADER", but they all have some kind of C language representation. Here is a description of them. -All but the STRING_LIST type have typedefs: VCL_INT, VCL_REAL etc. +All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL, +etc. -INT - C-type: ``long`` +BACKEND + C-type: ``const struct director *`` - An integer as we know and love them. + A type for backend and director implementations. See + :ref:`ref-writing-a-director`. -REAL +BLOB + C-type: ``const struct vmod_priv *`` + + An opaque type to pass random bits of memory between VMOD + functions. + +BOOL + C-type: ``unsigned`` + + Zero means false, anything else means true. + +BYTES C-type: ``double`` - A floating point value. + Unit: bytes. + + A storage space, as in 1024 bytes. DURATION C-type: ``double`` - Unit: seconds + Unit: seconds. A time interval, as in 25 seconds. +ENUM + C-type: ``const char *`` + + TODO + +HEADER + C-type: ``const struct gethdr_s *`` + + These are VCL compiler generated constants referencing a + particular header in a particular HTTP entity, for instance + ``req.http.cookie`` or ``beresp.http.last-modified``. By passing + a reference to the header, the VMOD code can both read and write + the header in question. + + If the header was passed as STRING, the VMOD code only sees + the value, but not where it came from. + +HTTP + C-type: ``struct http *`` + + TODO + +INT + C-type: ``long`` + + A (long) integer as we know and love them. + +IP + C-type: ``const struct suckaddr *`` + + This is an opaque type, see the ``include/vsa.h`` file for + which primitives we support on this type. + +REAL + C-type: ``double`` + + A floating point value. + TIME C-type: ``double`` - Unit: seconds since UNIX epoch + Unit: seconds since UNIX epoch. - An absolute time, as in 1284401161. When used in a string - context is formatted as "Mon, 13 Sep 2010 19:06:01 GMT". + An absolute time, as in 1284401161. STRING C-type: ``const char *`` A NUL-terminated text-string. - Can be NULL to indicate that the nonexistent string, for - instance:: + Can be NULL to indicate a nonexistent string, for instance in:: mymod.foo(req.http.foobar); @@ -192,58 +244,23 @@ STRING_LIST and make sure your workspace_client and workspace_backend params are big enough. -PRIV_VCL - See :ref:`ref-vmod-private-pointers` below - -PRIV_CALL - See :ref:`ref-vmod-private-pointers` below - -PRIV_TASK - See :ref:`ref-vmod-private-pointers` below - -PRIV_TOP - See :ref:`ref-vmod-private-pointers` below - VOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. -HEADER - C-type: ``const struct gethdr_s *`` - - These are VCL compiler generated constants referencing - a particular header in a particular HTTP entity, for instance - ``req.http.cookie`` or ``beresp.http.last-modified``. - By passing a reference to the header, the VMOD code can - both read and write the header in question. - - If the header was passed as STRING, the VMOD code only sees - the value, but not where it came from. - -IP - C-type: ``const struct suckaddr *`` - - This is an opaque type, see the ``include/vsa.h`` file for - which primitives we support on this type. - -BOOL - C-type: ``unsigned`` - - Zero means false, anything else means true. - -BLOB - C-type: ``const struct vmod_priv *`` +PRIV_VCL + See :ref:`ref-vmod-private-pointers` below. - An opaque type to pass random bits of memory between VMOD - functions. +PRIV_CALL + See :ref:`ref-vmod-private-pointers` below. -BACKEND - C-type: ``const struct director *`` +PRIV_TASK + See :ref:`ref-vmod-private-pointers` below. - A type for backend and director implementations. See - :ref:`ref-writing-a-director`. +PRIV_TOP + See :ref:`ref-vmod-private-pointers` below. .. _ref-vmod-private-pointers: From fgsch at lodoss.net Fri Sep 4 13:54:54 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 21d7396 To keep the OCD at bay sort this the right way Message-ID: commit 21d73961b69280895edb00dbd15116d0db7a1fe7 Author: Federico G. Schwindt Date: Sat Aug 15 00:12:38 2015 +0100 To keep the OCD at bay sort this the right way diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 893a1c7..f6516a1 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -179,17 +179,22 @@ IP This is an opaque type, see the ``include/vsa.h`` file for which primitives we support on this type. -REAL - C-type: ``double`` +PRIV_CALL + See :ref:`ref-vmod-private-pointers` below. - A floating point value. +PRIV_TASK + See :ref:`ref-vmod-private-pointers` below. -TIME - C-type: ``double`` +PRIV_TOP + See :ref:`ref-vmod-private-pointers` below. - Unit: seconds since UNIX epoch. +PRIV_VCL + See :ref:`ref-vmod-private-pointers` below. - An absolute time, as in 1284401161. +REAL + C-type: ``double`` + + A floating point value. STRING C-type: ``const char *`` @@ -244,24 +249,19 @@ STRING_LIST and make sure your workspace_client and workspace_backend params are big enough. +TIME + C-type: ``double`` + + Unit: seconds since UNIX epoch. + + An absolute time, as in 1284401161. + VOID C-type: ``void`` Can only be used for return-value, which makes the function a VCL procedure. -PRIV_VCL - See :ref:`ref-vmod-private-pointers` below. - -PRIV_CALL - See :ref:`ref-vmod-private-pointers` below. - -PRIV_TASK - See :ref:`ref-vmod-private-pointers` below. - -PRIV_TOP - See :ref:`ref-vmod-private-pointers` below. - .. _ref-vmod-private-pointers: @@ -279,11 +279,6 @@ The VCL compiler supports the following private pointers: compiled regular expression specific to a regsub() statement or a simply caching the last output of some expensive lookup. -* ``PRIV_VCL`` "per vcl" private pointers are useful for such global - state that applies to all calls in this VCL, for instance flags that - determine if regular expressions are case-sensitive in this vmod or - similar. - * ``PRIV_TASK`` "per task" private pointers are useful for state that applies to calls for either a specific request or a backend request. For instance this can be the result of a parsed cookie @@ -297,6 +292,11 @@ The VCL compiler supports the following private pointers: defined for the client side. When used from backend VCL subs, a NULL pointer will be passed. +* ``PRIV_VCL`` "per vcl" private pointers are useful for such global + state that applies to all calls in this VCL, for instance flags that + determine if regular expressions are case-sensitive in this vmod or + similar. + The way it works in the vmod code, is that a ``struct vmod_priv *`` is passed to the functions where one of the ``PRIV_*`` argument types is specified. From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] f4053ac Move first_byte_timeout param to new order Message-ID: commit f4053ac00a0fd0b50b8095e586c23ebfd53b016c Author: Poul-Henning Kamp Date: Mon Aug 17 05:34:09 2015 +0000 Move first_byte_timeout param to new order diff --git a/bin/varnishd/common/params.h b/bin/varnishd/common/params.h index c8cd3a6..3dbfe6a 100644 --- a/bin/varnishd/common/params.h +++ b/bin/varnishd/common/params.h @@ -163,9 +163,6 @@ struct params { /* Default connection_timeout */ double connect_timeout; - /* Read timeouts for backend */ - double first_byte_timeout; - /* CLI buffer size */ unsigned cli_buffer; diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index 565328e..e6318c1 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -308,17 +308,6 @@ struct parspec mgt_parspec[] = { "backend request.", 0, "3.5", "seconds" }, - { "first_byte_timeout", tweak_timeout, - &mgt_param.first_byte_timeout, - "0", NULL, - "Default timeout for receiving first byte from backend. " - "We only wait for this many seconds for the first " - "byte before giving up. A value of 0 means it will never time " - "out. " - "VCL can override this default value for each backend and " - "backend request. This parameter does not apply to pipe.", - 0, - "60", "seconds" }, { "clock_skew", tweak_uint, &mgt_param.clock_skew, "0", NULL, "How much clockskew we are willing to accept between the " diff --git a/include/tbl/params.h b/include/tbl/params.h index 36c1b0d..d3a2982 100644 --- a/include/tbl/params.h +++ b/include/tbl/params.h @@ -178,6 +178,24 @@ PARAM( ) PARAM( + /* name */ first_byte_timeout, + /* tweak */ timeout, + /* min */ "0", + /* max */ NULL, + /* default */ "60", + /* units */ "seconds", + /* flags */ 0, + /* s-text */ + "Default timeout for receiving first byte from backend. We only " + "wait for this many seconds for the first byte before giving up. A " + "value of 0 means it will never time out. VCL can override this " + "default value for each backend and backend request. This " + "parameter does not apply to pipe.", + /* l-text */ "", + /* func */ NULL +) + +PARAM( /* name */ between_bytes_timeout, /* tweak */ timeout, /* min */ "0", @@ -444,24 +462,6 @@ PARAM( /* func */ NULL ) PARAM( - /* name */ first_byte_timeout, - /* tweak */ tweak_timeout, - /* var */ first_byte_timeout, - /* min */ 0.000, - /* max */ none, - /* default */ 60.000, - /* units */ seconds, - /* flags */ 00, - /* s-text */ - "Default timeout for receiving first byte from backend. We only " - "wait for this many seconds for the first byte before giving up. A " - "value of 0 means it will never time out. VCL can override this " - "default value for each backend and backend request. This " - "parameter does not apply to pipe.\n", - /* l-text */ "", - /* func */ NULL -) -PARAM( /* name */ gzip_buffer, /* tweak */ tweak_bytes_u, /* var */ gzip_buffer, From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 8dc7483 Rewrite the H1 header fetch without SES_Rx(), this makes it simpler. Message-ID: commit 8dc74833d2bad4ce004f8dd7e78e9b8d6ddc5094 Author: Poul-Henning Kamp Date: Mon Aug 17 06:57:58 2015 +0000 Rewrite the H1 header fetch without SES_Rx(), this makes it simpler. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 6a2b047..648dad4 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -979,7 +979,6 @@ enum htc_status_e { void SES_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes, unsigned maxhdr); void SES_RxReInit(struct http_conn *htc); -enum htc_status_e SES_Rx(struct http_conn *htc, double tmo); enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *, double *t1, double *t2, double ti, double tn); diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 8333123..3d23c7c 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -189,32 +189,6 @@ SES_RxReInit(struct http_conn *htc) *htc->rxbuf_e = '\0'; } -/*-------------------------------------------------------------------- - * Receive more HTTP protocol bytes - */ - -enum htc_status_e -SES_Rx(struct http_conn *htc, double tmo) -{ - int i; - - CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); - AN(htc->ws->r); - AZ(htc->pipeline_b); - AZ(htc->pipeline_e); - i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ - if (i <= 0) - return (HTC_S_OVERFLOW); - i = VTCP_read(htc->fd, htc->rxbuf_e, i, tmo); - if (i == -2) - return (HTC_S_TIMEOUT); - if (i <= 0) - return (HTC_S_EOF); - htc->rxbuf_e += i; - *htc->rxbuf_e = '\0'; - return (HTC_S_MORE); -} - /*---------------------------------------------------------------------- * Receive a request/packet/whatever, with timeouts * diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c index ca1df5a..1b6ceb4 100644 --- a/bin/varnishd/http1/cache_http1_fetch.c +++ b/bin/varnishd/http1/cache_http1_fetch.c @@ -137,7 +137,6 @@ V1F_FetchRespHdr(struct busyobj *bo) { struct http *hp; - enum htc_status_e hs; int first, i; struct http_conn *htc; @@ -160,23 +159,22 @@ V1F_FetchRespHdr(struct busyobj *bo) first = 1; do { - hs = SES_Rx(htc, 0); - if (hs == HTC_S_MORE) - hs = HTTP1_Complete(htc); - if (hs == HTC_S_OVERFLOW) { - WS_ReleaseP(htc->ws, htc->rxbuf_b); + i = (htc->ws->r - htc->rxbuf_e) - 1; /* space for NUL */ + if (i <= 0) { bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; + WS_ReleaseP(htc->ws, htc->rxbuf_b); VSLb(bo->vsl, SLT_FetchError, "http %sread error: overflow", first ? "first " : ""); htc->doclose = SC_RX_OVERFLOW; return (-1); } - if (hs == HTC_S_EOF) { - WS_ReleaseP(htc->ws, htc->rxbuf_b); + i = read(htc->fd, htc->rxbuf_e, i); + if (i <= 0) { bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b; + WS_ReleaseP(htc->ws, htc->rxbuf_b); VSLb(bo->vsl, SLT_FetchError, "http %sread error: EOF", first ? "first " : ""); htc->doclose = SC_RX_TIMEOUT; @@ -187,7 +185,10 @@ V1F_FetchRespHdr(struct busyobj *bo) VTCP_set_read_timeout(htc->fd, htc->between_bytes_timeout); } - } while (hs != HTC_S_COMPLETE); + htc->rxbuf_e += i; + *htc->rxbuf_e = '\0'; + } while (HTTP1_Complete(htc) != HTC_S_COMPLETE); + WS_ReleaseP(htc->ws, htc->rxbuf_e); hp = bo->beresp; From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 1cd42e8 Cherry-pick some WS overflow improvements from Lasse's patches. Message-ID: commit 1cd42e831ad75a8e9a03299baac446d066a39258 Author: Poul-Henning Kamp Date: Mon Aug 17 08:35:43 2015 +0000 Cherry-pick some WS overflow improvements from Lasse's patches. diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index 4fd666b..c887868 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -74,7 +74,8 @@ VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom) VSB_delete(vsb); #endif vdp = WS_Alloc(req->ws, sizeof *vdp); - AN(vdp); + if (vdp == NULL) + return; INIT_OBJ(vdp, VDP_ENTRY_MAGIC); vdp->func = func; vdp->priv = priv; diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 6122984..1b4cbb0 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -159,15 +159,18 @@ vrg_dorange(struct req *req, const char *r) http_PrintfHeader(req->resp, "Content-Range: bytes %jd-%jd/*", (intmax_t)low, (intmax_t)high); req->resp_len = (intmax_t)(1 + high - low); - http_PutResponse(req->resp, "HTTP/1.1", 206, NULL); vrg_priv = WS_Alloc(req->ws, sizeof *vrg_priv); + if (vrg_priv == NULL) + return (-1); + XXXAN(vrg_priv); INIT_OBJ(vrg_priv, VRG_PRIV_MAGIC); vrg_priv->range_off = 0; vrg_priv->range_low = low; vrg_priv->range_high = high + 1; VDP_push(req, vrg_range_bytes, vrg_priv, 1); + http_PutResponse(req->resp, "HTTP/1.1", 206, NULL); return (0); } @@ -183,7 +186,7 @@ VRG_dorange(struct req *req, const char *r) /* We must snapshot the length if we're streaming from the backend */ i = vrg_dorange(req, r); - if (i) { + if (i > 0) { VSLb(req->vsl, SLT_Debug, "RANGE_FAIL line %d", i); http_Unset(req->resp, H_Content_Length); if (req->resp_len >= 0) diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c index d96c4f4..c1ea167 100644 --- a/bin/varnishd/cache/cache_vrt_re.c +++ b/bin/varnishd/cache/cache_vrt_re.c @@ -171,6 +171,7 @@ VRT_regsub(VRT_CTX, int all, const char *str, void *re, /* Copy suffix to match */ Tadd(&res_b, res_e, str + offset, 1 + len - offset); if (res_b >= res_e) { + WS_MarkOverflow(ctx->ws); WS_Release(ctx->ws, 0); return (str); } From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:54 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] d4c1acd Mention health probes for director writers Message-ID: commit d4c1acdf36f3563349cc81aec22aa4d2ad1403de Author: Dridi Boukelmoune Date: Mon Aug 17 09:39:47 2015 +0200 Mention health probes for director writers Add placeholders for pending patches that would need to be documented if merged. diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 3adc333..cbd8a42 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -82,6 +82,8 @@ below (:ref:`ref-writing-a-director-cluster`). Dynamic Backends ---------------- +.. TODO document the VRT_BACKEND_FIELDS dance + If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your @@ -108,8 +110,9 @@ care of it. Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure -to keep track of backends. It is also true for *cluster* directors that may -reference native backends. +to keep track of backends and objects have a VCL name you can reuse for the +director. It is also true for *cluster* directors that may reference native +backends. Finally, Varnish will take care of event propagation for *all* native backends. @@ -133,4 +136,18 @@ request. Health Probes ============= -TODO +It is possible in a VCL program to query the health of a director (see +:ref:`func_healthy`). A director can report its health if it implements the +``healthy`` function, it is otherwise always considered healthy. + +Unless you are making a dynamic backend, you need to take care of the health +probes yourselves. For *cluster* directors, being healthy typically means +having at least one healthy underlying backend or director. + +For dynamic backends, it is just a matter of assigning the ``probe`` field in +the ``struct vrt_backend``. Once the director is created, the probe definition +too is no longer needed. It is then Varnish that will take care of health +probing and disabling the feature on cold VCL (see +:ref:`ref-vmod-event-functions`). + +.. TODO document VCL_PROBE if patchwork #310 is merged diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index f6516a1..57db2a8 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -115,6 +115,8 @@ language representation. Here is a description of them. All but the PRIV and STRING_LIST types have typedefs: VCL_INT, VCL_REAL, etc. +.. TODO document ACL if patchwork #314 is merged + BACKEND C-type: ``const struct director *`` @@ -191,6 +193,8 @@ PRIV_TOP PRIV_VCL See :ref:`ref-vmod-private-pointers` below. +.. TODO document PROBE if patchwork #310 is merged + REAL C-type: ``double`` From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] bf3d3dc Dump the VCL temperature in panics Message-ID: commit bf3d3dc2c78f740f6ff5b7bfea11eee1c51787d8 Author: Poul-Henning Kamp Date: Mon Aug 17 09:14:28 2015 +0000 Dump the VCL temperature in panics diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index dd49cda..0d3ed42 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -88,6 +88,7 @@ VCL_Panic(struct vsb *vsb, const struct vcl *vcl) return; VSB_printf(vsb, "vcl = {\n"); VSB_indent(vsb, 2); + VSB_printf(vsb, "temp = %s\n", vcl->temp); VSB_printf(vsb, "srcname = {\n"); VSB_indent(vsb, 2); for (i = 0; i < vcl->conf->nsrc; ++i) From phk at FreeBSD.org Fri Sep 4 13:54:54 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:54 +0200 Subject: [4.1] 0a800c5 It is OK to VCL_Ref a cooling VCL. Message-ID: commit 0a800c5167b6e8ccd0df483bb69136c30199aac2 Author: Poul-Henning Kamp Date: Mon Aug 17 09:21:13 2015 +0000 It is OK to VCL_Ref a cooling VCL. Fixes: #1776 diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 0d3ed42..e11cf01 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -163,7 +163,7 @@ VCL_Ref(struct vcl *vcl) { CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); - assert(vcl->temp == vcl_temp_warm); + assert(vcl->temp == vcl_temp_warm || vcl->temp == vcl_temp_cooling); Lck_Lock(&vcl_mtx); assert(vcl->busy > 0); vcl->busy++; From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 0dffa87 Fix loading of cold VCLs Message-ID: commit 0dffa87db4bf9d449781d244a00745a23a02803d Author: Poul-Henning Kamp Date: Mon Aug 17 09:25:19 2015 +0000 Fix loading of cold VCLs Fixes: #1775 diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index e11cf01..9c7ee4a 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -398,6 +398,10 @@ vcl_set_state(struct vcl *vcl, const char *state) case '0': if (vcl->temp == vcl_temp_cold) break; + if (vcl->temp == vcl_temp_init) { + vcl->temp = vcl_temp_cold; + break; + } if (vcl->busy == 0) { vcl->temp = vcl_temp_cold; (void)vcl->conf->event_vcl(&ctx, VCL_EVENT_COLD); diff --git a/bin/varnishtest/tests/r01775.vtc b/bin/varnishtest/tests/r01775.vtc new file mode 100644 index 0000000..5241b78 --- /dev/null +++ b/bin/varnishtest/tests/r01775.vtc @@ -0,0 +1,12 @@ +varnishtest "Test loading a VCL in cold state" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + +} -start + +varnish v1 -cliok {vcl.inline vcl2 "vcl 4.0; backend b { .host = \":80\";}" cold} From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] b68360d Polish, remove a break Message-ID: commit b68360d4ff36a146e1a3103aa162509081f42d77 Author: Dridi Boukelmoune Date: Mon Aug 17 12:11:34 2015 +0200 Polish, remove a break diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 9c7ee4a..2b3c5d2 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -396,12 +396,10 @@ vcl_set_state(struct vcl *vcl, const char *state) switch(state[0]) { case '0': - if (vcl->temp == vcl_temp_cold) - break; - if (vcl->temp == vcl_temp_init) { + if (vcl->temp == vcl_temp_init) vcl->temp = vcl_temp_cold; + if (vcl->temp == vcl_temp_cold) break; - } if (vcl->busy == 0) { vcl->temp = vcl_temp_cold; (void)vcl->conf->event_vcl(&ctx, VCL_EVENT_COLD); From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] a2ed61d Enable probes for dynamic backends Message-ID: commit a2ed61d0be103d817abcc66b93e49a5720cfb3bd Author: Dridi Boukelmoune Date: Tue Aug 18 11:26:28 2015 +0200 Enable probes for dynamic backends Make sure probes can be managed outside of the cli thread, now that backends can be created any time. diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c index 8060bb7..e0590d8 100644 --- a/bin/varnishd/cache/cache_backend_probe.c +++ b/bin/varnishd/cache/cache_backend_probe.c @@ -514,7 +514,6 @@ VBP_Control(const struct backend *be, int enable) { struct vbp_target *vt; - ASSERT_CLI(); CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vt = be->probe; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); @@ -545,7 +544,6 @@ VBP_Insert(struct backend *b, const struct vrt_backend_probe *vp, { struct vbp_target *vt; - ASSERT_CLI(); CHECK_OBJ_NOTNULL(b, BACKEND_MAGIC); CHECK_OBJ_NOTNULL(vp, VRT_BACKEND_PROBE_MAGIC); @@ -570,7 +568,6 @@ VBP_Remove(struct backend *be) { struct vbp_target *vt; - ASSERT_CLI(); CHECK_OBJ_NOTNULL(be, BACKEND_MAGIC); vt = be->probe; CHECK_OBJ_NOTNULL(vt, VBP_TARGET_MAGIC); From daghf at varnish-software.com Fri Sep 4 13:54:55 2015 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] c9b0aa0 Make varnishtop's vtree bits static. Message-ID: commit c9b0aa06e2a7f4bffb5b71cc183ba6bd1bd3ac3c Author: Dag Haavi Finstad Date: Tue Aug 18 11:45:49 2015 +0200 Make varnishtop's vtree bits static. diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index f9aaf47..3c4c733 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -109,10 +109,10 @@ static int f_flag = 0; static unsigned maxfieldlen = 0; -VRB_PROTOTYPE(t_order, top, e_order, cmp_order); -VRB_GENERATE(t_order, top, e_order, cmp_order); -VRB_PROTOTYPE(t_key, top, e_key, cmp_key); -VRB_GENERATE(t_key, top, e_key, cmp_key); +VRB_PROTOTYPE_STATIC(t_order, top, e_order, cmp_order); +VRB_GENERATE_STATIC(t_order, top, e_order, cmp_order); +VRB_PROTOTYPE_STATIC(t_key, top, e_key, cmp_key); +VRB_GENERATE_STATIC(t_key, top, e_key, cmp_key); static int __match_proto__(VSLQ_dispatch_f) accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 6b4cbe2 Expose VCL probes to VMODs Message-ID: commit 6b4cbe2645331fb5466b6a5a8695a0913d2b1b1a Author: Dridi Boukelmoune Date: Tue Aug 18 11:40:08 2015 +0200 Expose VCL probes to VMODs diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index cbd8a42..8a16c87 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -150,4 +150,5 @@ too is no longer needed. It is then Varnish that will take care of health probing and disabling the feature on cold VCL (see :ref:`ref-vmod-event-functions`). -.. TODO document VCL_PROBE if patchwork #310 is merged +Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` +directly built from VCL (see :ref:`ref-vmod-vcl-c-types`). diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 57db2a8..0446e83 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -193,7 +193,10 @@ PRIV_TOP PRIV_VCL See :ref:`ref-vmod-private-pointers` below. -.. TODO document PROBE if patchwork #310 is merged +PROBE + C-type: ``const struct vrt_backend_probe *`` + + A named standalone backend probe definition. REAL C-type: ``double`` diff --git a/include/vrt.h b/include/vrt.h index 98168a3..4b429dd 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -67,20 +67,21 @@ struct ws; * (alphabetic order) */ -typedef const struct director * VCL_BACKEND; -typedef const struct vmod_priv * VCL_BLOB; -typedef unsigned VCL_BOOL; -typedef double VCL_BYTES; -typedef double VCL_DURATION; -typedef const char * VCL_ENUM; -typedef const struct gethdr_s * VCL_HEADER; -typedef struct http * VCL_HTTP; -typedef long VCL_INT; -typedef const struct suckaddr * VCL_IP; -typedef double VCL_REAL; -typedef const char * VCL_STRING; -typedef double VCL_TIME; -typedef void VCL_VOID; +typedef const struct director * VCL_BACKEND; +typedef const struct vmod_priv * VCL_BLOB; +typedef unsigned VCL_BOOL; +typedef double VCL_BYTES; +typedef double VCL_DURATION; +typedef const char * VCL_ENUM; +typedef const struct gethdr_s * VCL_HEADER; +typedef struct http * VCL_HTTP; +typedef long VCL_INT; +typedef const struct suckaddr * VCL_IP; +typedef const struct vrt_backend_probe * VCL_PROBE; +typedef double VCL_REAL; +typedef const char * VCL_STRING; +typedef double VCL_TIME; +typedef void VCL_VOID; /*********************************************************************** * This is the composite argument we pass to compiled VCL and VRT diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index c0501a3..14aedf3 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -249,7 +249,7 @@ void vcc_ParseProbe(struct vcc *tl) { struct token *t_probe; - int i; + struct symbol *sym; char *p; vcc_NextToken(tl); /* ID: probe */ @@ -258,11 +258,18 @@ vcc_ParseProbe(struct vcc *tl) ERRCHK(tl); t_probe = tl->t; vcc_NextToken(tl); - i = vcc_AddDef(tl, t_probe, SYM_PROBE); - if (i > 1) { + + sym = VCC_GetSymbolTok(tl, t_probe, SYM_PROBE); + AN(sym); + if (sym->ndef > 0) { VSB_printf(tl->sb, "Probe %.*s redefined\n", PF(t_probe)); vcc_ErrWhere(tl, t_probe); + return; } + sym->fmt = PROBE; + sym->eval = vcc_Eval_Probe; + sym->ndef++; + ERRCHK(tl); vcc_ParseProbeSpec(tl, t_probe, &p); if (vcc_IdIs(t_probe, "default")) { diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h index 86f731d..893369e 100644 --- a/lib/libvcc/vcc_compile.h +++ b/lib/libvcc/vcc_compile.h @@ -280,6 +280,7 @@ sym_expr_t vcc_Eval_SymFunc; void vcc_Eval_Func(struct vcc *tl, const char *cfunc, const char *extra, const char *name, const char *args); sym_expr_t vcc_Eval_Backend; +sym_expr_t vcc_Eval_Probe; /* vcc_obj.c */ extern const struct var vcc_vars[]; diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c index b9c6531..294d12a 100644 --- a/lib/libvcc/vcc_expr.c +++ b/lib/libvcc/vcc_expr.c @@ -516,6 +516,23 @@ vcc_Eval_Backend(struct vcc *tl, struct expr **e, const struct symbol *sym) /*-------------------------------------------------------------------- */ + +void +vcc_Eval_Probe(struct vcc *tl, struct expr **e, const struct symbol *sym) +{ + + assert(sym->kind == SYM_PROBE); + + vcc_ExpectCid(tl); + vcc_AddRef(tl, tl->t, SYM_PROBE); + *e = vcc_mk_expr(PROBE, "&vgc_probe_%.*s", PF(tl->t)); + (*e)->constant = EXPR_VAR; /* XXX ? */ + vcc_NextToken(tl); +} + +/*-------------------------------------------------------------------- + */ + void vcc_Eval_Var(struct vcc *tl, struct expr **e, const struct symbol *sym) { @@ -812,6 +829,8 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt) sym = NULL; if (fmt == BACKEND) sym = VCC_FindSymbol(tl, tl->t, SYM_BACKEND); + if (fmt == PROBE) + sym = VCC_FindSymbol(tl, tl->t, SYM_PROBE); if (sym == NULL) sym = VCC_FindSymbol(tl, tl->t, SYM_VAR); if (sym == NULL) @@ -831,6 +850,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt) case SYM_VAR: case SYM_FUNC: case SYM_BACKEND: + case SYM_PROBE: AN(sym->eval); AZ(*e); sym->eval(tl, e, sym); diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 01de3a7..5a6c0fc 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -60,6 +60,7 @@ ctypes = { 'PRIV_VCL': "struct vmod_priv *", 'PRIV_TASK': "struct vmod_priv *", 'PRIV_TOP': "struct vmod_priv *", + 'PROBE': "VCL_PROBE", 'REAL': "VCL_REAL", 'STRING': "VCL_STRING", 'STRING_LIST': "const char *, ...", From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 2c4cb15 More details on event considerations for directors Message-ID: commit 2c4cb155e59e398d989a38473b37d6f9b6c403f5 Author: Dridi Boukelmoune Date: Tue Aug 18 15:06:34 2015 +0200 More details on event considerations for directors diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 8a16c87..c4e6ecb 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -114,7 +114,11 @@ to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for *cluster* directors that may reference native backends. -Finally, Varnish will take care of event propagation for *all* native backends. +Finally, Varnish will take care of event propagation for *all* native backends, +but dynamic backends can only be created when the VCL is warm. If your backends +are created by an independant thread (basically outside of VCL scope) you must +subscribe to VCL events and watch for VCL state (see +:ref:`ref-vmod-event-functions`). .. _ref-writing-a-director-cluster: From nils.goroll at uplex.de Fri Sep 4 13:54:55 2015 From: nils.goroll at uplex.de (Nils Goroll) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 304342f vmodtool should actually raise an error for unknown keywords Message-ID: commit 304342fdb096d96c0d391f45e43ebca1314b339e Author: Nils Goroll Date: Tue Aug 18 17:58:29 2015 +0200 vmodtool should actually raise an error for unknown keywords ... like 'Unknown keyword: $Init' for 4.0 vcc files. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 5a6c0fc..85a9ac2 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -870,14 +870,6 @@ def runmain(inputvcc, outputname="vcc_if"): ####################################################################### # Break into sections - keywords = { - "$Module": True, - "$Function": True, - "$Object": True, - "$Method": True, - "$Event": True, - } - sl = [] sc = FileSection() sl.append(sc) @@ -885,7 +877,7 @@ def runmain(inputvcc, outputname="vcc_if"): ln += 1 l = lines.pop(0) j = l.split() - if len(j) > 0 and j[0] in keywords: + if len(j) > 0 and re.match("^\$", j[0]): sc = FileSection() sl.append(sc) sc.add_line(ln, l) From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] a2d7099 Always send the VCL when delivering a VCL event Message-ID: commit a2d7099ebc25709d8905e34e341bc3abb59eb1e2 Author: Dridi Boukelmoune Date: Fri Aug 21 13:42:15 2015 +0200 Always send the VCL when delivering a VCL event diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 2b3c5d2..b4fda32 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -393,6 +393,7 @@ vcl_set_state(struct vcl *vcl, const char *state) INIT_OBJ(&ctx, VRT_CTX_MAGIC); ctx.handling = &hand; + ctx.vcl = vcl; switch(state[0]) { case '0': From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 2998862 Always carry the VCL along with a VCL event Message-ID: commit 2998862d53516313ace942ed61edbb35f44f0d47 Author: Dridi Boukelmoune Date: Fri Aug 21 14:20:04 2015 +0200 Always carry the VCL along with a VCL event diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index b4fda32..7e6247b 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -625,6 +625,7 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv) vsb = VSB_new_auto(); AN(vsb); ctx.msg = vsb; + ctx.vcl = vcl; i = vcl->conf->event_vcl(&ctx, VCL_EVENT_USE); AZ(VSB_finish(vsb)); if (i) { From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] d3a0764 Remove the length limit for backends display name Message-ID: commit d3a0764a7f1cc951055b7908f06ae7b61d960161 Author: Dridi Boukelmoune Date: Fri Aug 21 17:22:36 2015 +0200 Remove the length limit for backends display name diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index 3db5dbd..0a58de1 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -65,7 +65,7 @@ struct director * VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) { struct backend *b; - char buf[128]; + struct vsb *vsb; struct vcl *vcl; struct tcp_pool *tp = NULL; const struct vrt_backend_probe *vbp; @@ -89,8 +89,14 @@ VRT_new_backend(VRT_CTX, const struct vrt_backend *vrt) #undef DA #undef DN - bprintf(buf, "%s.%s", VCL_Name(vcl), vrt->vcl_name); - REPLACE(b->display_name, buf); + vsb = VSB_new_auto(); + AN(vsb); + VSB_printf(vsb, "%s.%s", VCL_Name(vcl), vrt->vcl_name); + AZ(VSB_finish(vsb)); + + b->display_name = strdup(VSB_data(vsb)); + AN(b->display_name); + VSB_delete(vsb); b->vcl = vcl; From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 987ea3c Only the cli thread can send events to backends Message-ID: commit 987ea3c1040132d89da9ce2b7801679af061f537 Author: Dridi Boukelmoune Date: Sun Aug 23 12:25:27 2015 +0200 Only the cli thread can send events to backends diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 7e6247b..139e18b 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -229,6 +229,7 @@ vcl_BackendEvent(const struct vcl *vcl, enum vcl_event_e e) { struct backend *be; + ASSERT_CLI(); CHECK_OBJ_NOTNULL(vcl, VCL_MAGIC); AZ(vcl->busy); From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:55 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] d771942 Hide backends and directors implementation details Message-ID: commit d771942c0c6f151e267b63bbc548a4d4371b25be Author: Dridi Boukelmoune Date: Sun Aug 23 12:29:29 2015 +0200 Hide backends and directors implementation details Don't install cache_backend.h and cache_director.h, they expose more than what a VMOD needs to see. The VRT API jumps directly from struct vrt_backend to struct director, which makes struct backend more than simply opaque, it is completely invisible. However struct director needs to be visible and has been moved to cache.h along with its functions definitions. diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index dd2bae2..eb01348 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -99,6 +99,8 @@ varnishd_SOURCES = \ noinst_HEADERS = \ builtin_vcl.h \ + cache/cache_backend.h \ + cache/cache_director.h \ cache/cache_esi.h \ cache/cache_pool.h \ common/heritage.h \ @@ -116,8 +118,6 @@ noinst_HEADERS = \ nobase_pkginclude_HEADERS = \ cache/cache.h \ cache/cache_filter.h \ - cache/cache_backend.h \ - cache/cache_director.h \ common/common.h \ common/params.h \ waiter/waiter.h diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 648dad4..ed72296 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -190,6 +190,47 @@ struct http { }; /*-------------------------------------------------------------------- + * Director public APIs + */ + +typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *, + double *changed); + +typedef const struct director *vdi_resolve_f(const struct director *, + struct worker *, struct busyobj *); + +typedef int vdi_gethdrs_f(const struct director *, struct worker *, + struct busyobj *); +typedef int vdi_getbody_f(const struct director *, struct worker *, + struct busyobj *); +typedef const struct suckaddr *vdi_getip_f(const struct director *, + struct worker *, struct busyobj *); +typedef void vdi_finish_f(const struct director *, struct worker *, + struct busyobj *); + +typedef void vdi_http1pipe_f(const struct director *, struct req *, + struct busyobj *); + +typedef void vdi_panic_f(const struct director *, struct vsb *); + +struct director { + unsigned magic; +#define DIRECTOR_MAGIC 0x3336351d + const char *name; + char *vcl_name; + vdi_http1pipe_f *http1pipe; + vdi_healthy_f *healthy; + vdi_resolve_f *resolve; + vdi_gethdrs_f *gethdrs; + vdi_getbody_f *getbody; + vdi_getip_f *getip; + vdi_finish_f *finish; + vdi_panic_f *panic; + void *priv; + const void *priv2; +}; + +/*-------------------------------------------------------------------- * VFP filter state */ diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h index cf20dc1..3bccf80 100644 --- a/bin/varnishd/cache/cache_director.h +++ b/bin/varnishd/cache/cache_director.h @@ -37,49 +37,6 @@ * */ -/*-------------------------------------------------------------------- - * A director is a piece of code which selects one of possibly multiple - * backends to use. - */ - - -typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *, - double *changed); - -typedef const struct director *vdi_resolve_f(const struct director *, - struct worker *, struct busyobj *); - -typedef int vdi_gethdrs_f(const struct director *, struct worker *, - struct busyobj *); -typedef int vdi_getbody_f(const struct director *, struct worker *, - struct busyobj *); -typedef const struct suckaddr *vdi_getip_f(const struct director *, - struct worker *, struct busyobj *); -typedef void vdi_finish_f(const struct director *, struct worker *, - struct busyobj *); - -typedef void vdi_http1pipe_f(const struct director *, struct req *, - struct busyobj *); - -typedef void vdi_panic_f(const struct director *, struct vsb *); - -struct director { - unsigned magic; -#define DIRECTOR_MAGIC 0x3336351d - const char *name; - char *vcl_name; - vdi_http1pipe_f *http1pipe; - vdi_healthy_f *healthy; - vdi_resolve_f *resolve; - vdi_gethdrs_f *gethdrs; - vdi_getbody_f *getbody; - vdi_getip_f *getip; - vdi_finish_f *finish; - vdi_panic_f *panic; - void *priv; - const void *priv2; -}; - /* cache_director.c */ int VDI_GetHdr(struct worker *, struct busyobj *); diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index 411df34..1738bcf 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -31,7 +31,6 @@ #include #include "cache/cache.h" -#include "cache/cache_director.h" #include "vrt.h" #include "vbm.h" From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 8796fa6 Silence FlexeLint Message-ID: commit 8796fa66a10d790fec8b5a8e7ebdcc97d1c72712 Author: Poul-Henning Kamp Date: Tue Aug 25 09:12:14 2015 +0000 Silence FlexeLint diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 617b65d..614317a 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -275,10 +275,12 @@ pan_busyobj(struct vsb *vsb, const struct busyobj *bo) VSB_printf(vsb, "state = %d,\n", (int)bo->state); VSB_printf(vsb, "flags = {"); p = ""; + /*lint -save -esym(438,p) */ #define BO_FLAG(l, r, w, d) \ if(bo->l) { VSB_printf(vsb, "%s" #l, p); p = ", "; } #include "tbl/bo_flags.h" #undef BO_FLAG + /*lint -restore */ VSB_printf(vsb, "},\n"); if (VALID_OBJ(bo->htc, HTTP_CONN_MAGIC)) From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 5fa4368 Make range processing log real messages rather than line numbers Message-ID: commit 5fa4368e946a3ef469cddb2b879765b03791cf2c Author: Poul-Henning Kamp Date: Tue Aug 25 09:33:14 2015 +0000 Make range processing log real messages rather than line numbers diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 1b4cbb0..729533e 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -85,14 +85,14 @@ vrg_range_bytes(struct req *req, enum vdp_action act, void **priv, /*--------------------------------------------------------------------*/ -static int +static const char * vrg_dorange(struct req *req, const char *r) { ssize_t low, high, has_low, has_high, t; struct vrg_priv *vrg_priv; if (strncasecmp(r, "bytes=", 6)) - return (__LINE__); + return ("Not Bytes"); r += 6; /* The low end of range */ @@ -103,11 +103,11 @@ vrg_dorange(struct req *req, const char *r) low *= 10; low += *r++ - '0'; if (low < t) - return (__LINE__); + return ("Low number too big"); } if (*r++ != '-') - return (__LINE__); + return ("Missing hyphen"); /* The high end of range */ has_high = high = 0; @@ -117,20 +117,20 @@ vrg_dorange(struct req *req, const char *r) high *= 10; high += *r++ - '0'; if (high < t) - return (__LINE__); + return ("High number too big"); } if (*r != '\0') - return (__LINE__); + return ("Trailing stuff"); if (has_high + has_low == 0) - return (__LINE__); + return ("Neither high nor low"); if (!has_low) { if (req->resp_len < 0) - return (0); // Allow 200 response + return (NULL); // Allow 200 response if (high == 0) - return (__LINE__); + return ("No low, high is zero"); low = req->resp_len - high; if (low < 0) low = 0; @@ -138,7 +138,7 @@ vrg_dorange(struct req *req, const char *r) } else if (req->resp_len >= 0 && (high >= req->resp_len || !has_high)) high = req->resp_len - 1; else if (!has_high) - return (0); // Allow 200 response + return (NULL); // Allow 200 response /* * else (bo != NULL) { * We assume that the client knows what it's doing and trust @@ -147,10 +147,10 @@ vrg_dorange(struct req *req, const char *r) */ if (high < low) - return (__LINE__); + return ("high smaller than low"); if (req->resp_len >= 0 && low >= req->resp_len) - return (__LINE__); + return ("low range beyond object"); if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Range: bytes %jd-%jd/%jd", @@ -162,7 +162,7 @@ vrg_dorange(struct req *req, const char *r) vrg_priv = WS_Alloc(req->ws, sizeof *vrg_priv); if (vrg_priv == NULL) - return (-1); + return ("WS too small"); XXXAN(vrg_priv); INIT_OBJ(vrg_priv, VRG_PRIV_MAGIC); @@ -171,13 +171,13 @@ vrg_dorange(struct req *req, const char *r) vrg_priv->range_high = high + 1; VDP_push(req, vrg_range_bytes, vrg_priv, 1); http_PutResponse(req->resp, "HTTP/1.1", 206, NULL); - return (0); + return (NULL); } void VRG_dorange(struct req *req, const char *r) { - int i; + const char *err; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); @@ -185,9 +185,9 @@ VRG_dorange(struct req *req, const char *r) /* We must snapshot the length if we're streaming from the backend */ - i = vrg_dorange(req, r); - if (i > 0) { - VSLb(req->vsl, SLT_Debug, "RANGE_FAIL line %d", i); + err = vrg_dorange(req, r); + if (err != NULL) { + VSLb(req->vsl, SLT_Debug, "RANGE_FAIL %s", err); http_Unset(req->resp, H_Content_Length); if (req->resp_len >= 0) http_PrintfHeader(req->resp, From daghf at varnish-software.com Fri Sep 4 13:54:55 2015 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 69123e7 Minor language cleanup. Message-ID: commit 69123e7e17fba178af5ea8c1ae83cc4f6e7cc3a2 Author: Dag Haavi Finstad Date: Tue Aug 25 15:24:47 2015 +0200 Minor language cleanup. diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index c4e6ecb..de321b2 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -22,8 +22,8 @@ Backends vs Directors The intuitive classification for backend and director is an endpoint for the former and a cluster for the latter, but the actual implementation is a bit -more subtle. VMODs can accept backend arguments return backends in VCL (see -:ref:`ref-vmod-vcl-c-types`), but he underlying C type is ``struct director``. +more subtle. VMODs can accept backend arguments and return backends in VCL (see +:ref:`ref-vmod-vcl-c-types`), but the underlying C type is ``struct director``. Under the hood director is a generic concept, and a backend is a kind of director. @@ -69,8 +69,8 @@ implements native backends. It is the canonical implementation, and though it provides other services like connection pooling or statistics, it is essentially a director which state is a ``struct backend``. Varnish native backends currently speak HTTP/1 over TCP, and as such, you need to make your -own custom backend if you want Varnish to do otherwise such as connecting over -UDP or UNIX-domain sockets or speaking a different protocol. +own custom backend if you want Varnish to do otherwise such as connect over +UDP or UNIX-domain sockets or speak a different protocol. You may also consider making your custom backend compliant with regards to the VCL state (see :ref:`ref-vmod-event-functions`). @@ -150,8 +150,8 @@ having at least one healthy underlying backend or director. For dynamic backends, it is just a matter of assigning the ``probe`` field in the ``struct vrt_backend``. Once the director is created, the probe definition -too is no longer needed. It is then Varnish that will take care of health -probing and disabling the feature on cold VCL (see +too is no longer needed. It is then Varnish that will take care of the health +probe and disable the feature on a cold VCL (see :ref:`ref-vmod-event-functions`). Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 1215933 Disable speculative Range handling on streaming transactions where we don't yet know the length. Message-ID: commit 121593312daabbef4e290a590b364a099980a8b7 Author: Poul-Henning Kamp Date: Tue Aug 25 15:42:26 2015 +0000 Disable speculative Range handling on streaming transactions where we don't yet know the length. I attempted to add a way to determine if the object was big enough *yet* to satisfy the Range, but that was non-viable. Fixes: #1777 diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 729533e..9b2580e 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -137,7 +137,7 @@ vrg_dorange(struct req *req, const char *r) high = req->resp_len - 1; } else if (req->resp_len >= 0 && (high >= req->resp_len || !has_high)) high = req->resp_len - 1; - else if (!has_high) + else if (!has_high || req->resp_len < 0) return (NULL); // Allow 200 response /* * else (bo != NULL) { diff --git a/bin/varnishtest/tests.disabled/e00029.vtc b/bin/varnishtest/tests.disabled/e00029.vtc new file mode 100644 index 0000000..ea3dd70 --- /dev/null +++ b/bin/varnishtest/tests.disabled/e00029.vtc @@ -0,0 +1,42 @@ +varnishtest "fun esi includes and ranges" + +server s1 { + rxreq + expect req.url == "/1" + txresp -body {} + + rxreq + expect req.url == /bar + txresp -body {} + + rxreq + expect req.url == /foo + txresp -body "ABCD" + + rxreq + expect req.url == "/2" + txresp -gzipbody {} + +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + if (req.url == "/bar") { + set req.http.Range = "bytes=7-8"; + } + } + sub vcl_backend_response { + set beresp.do_esi = true; + } +} -start + +client c1 { + txreq -url /1 -hdr "Accept-encoding: gzip" + rxresp + expect resp.body == "BC" + delay .1 + txreq -url /2 -hdr "Accept-encoding: gzip" + rxresp + gunzip + expect resp.body == "BC" +} -run diff --git a/bin/varnishtest/tests.disabled/r01506.vtc b/bin/varnishtest/tests.disabled/r01506.vtc new file mode 100644 index 0000000..f2bb5b2 --- /dev/null +++ b/bin/varnishtest/tests.disabled/r01506.vtc @@ -0,0 +1,72 @@ +varnishtest "range requests on streamed response" + +server s1 -repeat 4 { + rxreq + txresp -nolen \ + -hdr "Transfer-Encoding: chunked" \ + -hdr "Connection: close" + send "11\r\n0_23456789abcdef\n" + send "11\r\n1_23456789abcdef\n" + send "11\r\n2_23456789abcdef\n" + send "11\r\n3_23456789abcdef\n" + sema r1 sync 2 + send "11\r\n4_23456789abcdef\n" + send "11\r\n5_23456789abcdef\n" + send "11\r\n6_23456789abcdef\n" + send "11\r\n7_23456789abcdef\n" + chunkedlen 0 + +} -start + +varnish v1 -vcl+backend {} -start + +varnish v1 -cliok "param.set debug +syncvsl" + +logexpect l1 -v v1 -g session { + expect 0 1000 Begin sess + expect * = SessClose RANGE_SHORT +} -start + +client c1 { + txreq -url /1 -hdr "Range: bytes=17-101" + rxresphdrs + expect resp.status == 206 + expect resp.http.content-length == 85 + sema r1 sync 2 + rxrespbody + expect resp.bodylen == 85 + delay .1 + + # We cannot do tail-ranges when streaming + txreq -url /2 -hdr "Range: bytes=-10" + rxresphdrs + expect resp.status == 200 + expect resp.http.Transfer-Encoding == chunked + sema r1 sync 2 + rxrespbody + expect resp.bodylen == 136 + delay .1 + + # We cannot do open-ranges when streaming + txreq -url /3 -hdr "Range: bytes=17-" + rxresphdrs + expect resp.status == 200 + expect resp.http.Transfer-Encoding == chunked + sema r1 sync 2 + rxrespbody + expect resp.bodylen == 136 + delay .1 + + # Invalid range + txreq -url /4 -hdr "Range: bytes=102-200" + rxresphdrs + expect resp.status == 206 + expect resp.http.content-length == 99 + sema r1 sync 2 + recv 34 + delay .3 + expect_close +} -run + +varnish v1 -expect sc_range_short == 1 +logexpect l1 -wait diff --git a/bin/varnishtest/tests.disabled/r01732.vtc b/bin/varnishtest/tests.disabled/r01732.vtc new file mode 100644 index 0000000..f738dec --- /dev/null +++ b/bin/varnishtest/tests.disabled/r01732.vtc @@ -0,0 +1,38 @@ +varnishtest "range related panic" + +server s1 { + rxreq + txresp -nolen -hdr "Transfer-Encoding: chunked" + chunkedlen 10 + chunkedlen 10 + sema r1 sync 2 + chunkedlen 10 + chunkedlen 10 + chunkedlen 10 + chunkedlen 0 + delay .1 + sema r2 sync 2 +} -start + +varnish v1 -vcl+backend { +} -start + +client c1 { + txreq -hdr "Range: bytes=0-100" + rxresphdrs + expect resp.status == 206 + expect resp.http.Content-Range == "bytes 0-100/*" +} -run + +delay .1 +sema r1 sync 2 +sema r2 sync 2 +delay .4 + +client c1 { + txreq -hdr "Range: bytes=0-100" + rxresp + expect resp.status == 206 + expect resp.http.Content-Range == "bytes 0-49/50" +} -run + diff --git a/bin/varnishtest/tests/c00034.vtc b/bin/varnishtest/tests/c00034.vtc index b1698cd..2b440c9 100644 --- a/bin/varnishtest/tests/c00034.vtc +++ b/bin/varnishtest/tests/c00034.vtc @@ -176,7 +176,7 @@ client c1 { -hdr "Range: bytes=2-5" \ -hdr "Accept-encoding: gzip" rxresp - expect resp.status == 206 - expect resp.http.Content-Range == "bytes 2-5/*" - expect resp.http.Content-Length == 4 + expect resp.status == 200 + gunzip + expect resp.bodylen == 100 } -run diff --git a/bin/varnishtest/tests/e00029.vtc b/bin/varnishtest/tests/e00029.vtc deleted file mode 100644 index ea3dd70..0000000 --- a/bin/varnishtest/tests/e00029.vtc +++ /dev/null @@ -1,42 +0,0 @@ -varnishtest "fun esi includes and ranges" - -server s1 { - rxreq - expect req.url == "/1" - txresp -body {} - - rxreq - expect req.url == /bar - txresp -body {} - - rxreq - expect req.url == /foo - txresp -body "ABCD" - - rxreq - expect req.url == "/2" - txresp -gzipbody {} - -} -start - -varnish v1 -vcl+backend { - sub vcl_recv { - if (req.url == "/bar") { - set req.http.Range = "bytes=7-8"; - } - } - sub vcl_backend_response { - set beresp.do_esi = true; - } -} -start - -client c1 { - txreq -url /1 -hdr "Accept-encoding: gzip" - rxresp - expect resp.body == "BC" - delay .1 - txreq -url /2 -hdr "Accept-encoding: gzip" - rxresp - gunzip - expect resp.body == "BC" -} -run diff --git a/bin/varnishtest/tests/r01506.vtc b/bin/varnishtest/tests/r01506.vtc deleted file mode 100644 index f2bb5b2..0000000 --- a/bin/varnishtest/tests/r01506.vtc +++ /dev/null @@ -1,72 +0,0 @@ -varnishtest "range requests on streamed response" - -server s1 -repeat 4 { - rxreq - txresp -nolen \ - -hdr "Transfer-Encoding: chunked" \ - -hdr "Connection: close" - send "11\r\n0_23456789abcdef\n" - send "11\r\n1_23456789abcdef\n" - send "11\r\n2_23456789abcdef\n" - send "11\r\n3_23456789abcdef\n" - sema r1 sync 2 - send "11\r\n4_23456789abcdef\n" - send "11\r\n5_23456789abcdef\n" - send "11\r\n6_23456789abcdef\n" - send "11\r\n7_23456789abcdef\n" - chunkedlen 0 - -} -start - -varnish v1 -vcl+backend {} -start - -varnish v1 -cliok "param.set debug +syncvsl" - -logexpect l1 -v v1 -g session { - expect 0 1000 Begin sess - expect * = SessClose RANGE_SHORT -} -start - -client c1 { - txreq -url /1 -hdr "Range: bytes=17-101" - rxresphdrs - expect resp.status == 206 - expect resp.http.content-length == 85 - sema r1 sync 2 - rxrespbody - expect resp.bodylen == 85 - delay .1 - - # We cannot do tail-ranges when streaming - txreq -url /2 -hdr "Range: bytes=-10" - rxresphdrs - expect resp.status == 200 - expect resp.http.Transfer-Encoding == chunked - sema r1 sync 2 - rxrespbody - expect resp.bodylen == 136 - delay .1 - - # We cannot do open-ranges when streaming - txreq -url /3 -hdr "Range: bytes=17-" - rxresphdrs - expect resp.status == 200 - expect resp.http.Transfer-Encoding == chunked - sema r1 sync 2 - rxrespbody - expect resp.bodylen == 136 - delay .1 - - # Invalid range - txreq -url /4 -hdr "Range: bytes=102-200" - rxresphdrs - expect resp.status == 206 - expect resp.http.content-length == 99 - sema r1 sync 2 - recv 34 - delay .3 - expect_close -} -run - -varnish v1 -expect sc_range_short == 1 -logexpect l1 -wait diff --git a/bin/varnishtest/tests/r01732.vtc b/bin/varnishtest/tests/r01732.vtc deleted file mode 100644 index f738dec..0000000 --- a/bin/varnishtest/tests/r01732.vtc +++ /dev/null @@ -1,38 +0,0 @@ -varnishtest "range related panic" - -server s1 { - rxreq - txresp -nolen -hdr "Transfer-Encoding: chunked" - chunkedlen 10 - chunkedlen 10 - sema r1 sync 2 - chunkedlen 10 - chunkedlen 10 - chunkedlen 10 - chunkedlen 0 - delay .1 - sema r2 sync 2 -} -start - -varnish v1 -vcl+backend { -} -start - -client c1 { - txreq -hdr "Range: bytes=0-100" - rxresphdrs - expect resp.status == 206 - expect resp.http.Content-Range == "bytes 0-100/*" -} -run - -delay .1 -sema r1 sync 2 -sema r2 sync 2 -delay .4 - -client c1 { - txreq -hdr "Range: bytes=0-100" - rxresp - expect resp.status == 206 - expect resp.http.Content-Range == "bytes 0-49/50" -} -run - diff --git a/bin/varnishtest/tests/r01777.vtc b/bin/varnishtest/tests/r01777.vtc new file mode 100644 index 0000000..6808023 --- /dev/null +++ b/bin/varnishtest/tests/r01777.vtc @@ -0,0 +1,18 @@ +varnishtest "range asked longer than object" + +server s1 { + rxreq + txresp -nolen -hdr "Transfer-Encoding: chunked" + delay .5 + chunkedlen 64 + chunkedlen 64 + chunkedlen 0 +} -start + +varnish v1 -vcl+backend { } -start + +client c1 { + txreq -hdr "Range: bytes=0-129" + rxresp + expect resp.status == 200 +} -run From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 78ab22c Add a feature check for not-totally-demented-DNS service Message-ID: commit 78ab22c13c06a98088600d526d5c26b3376b2b3b Author: Poul-Henning Kamp Date: Tue Aug 25 17:10:19 2015 +0000 Add a feature check for not-totally-demented-DNS service diff --git a/bin/varnishtest/tests/m00011.vtc b/bin/varnishtest/tests/m00011.vtc index bd17059..7540c9b 100644 --- a/bin/varnishtest/tests/m00011.vtc +++ b/bin/varnishtest/tests/m00011.vtc @@ -1,6 +1,5 @@ varnishtest "Test std.ip" - server s1 { rxreq txresp -body "1" diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c index 1309df0..f77f617 100644 --- a/bin/varnishtest/vtc.c +++ b/bin/varnishtest/vtc.c @@ -583,6 +583,9 @@ cmd_feature(CMD_ARGS) continue; #endif } + if (!strcmp(av[i], "dns") && feature_dns) + continue; + if (!strcmp(av[i], "topbuild") && iflg) continue; diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h index f2817d8..518494c 100644 --- a/bin/varnishtest/vtc.h +++ b/bin/varnishtest/vtc.h @@ -71,6 +71,7 @@ extern pthread_t vtc_thread; extern int iflg; extern unsigned vtc_maxdur; extern int vtc_witness; +extern int feature_dns; void init_sema(void); void init_server(void); diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index df8787c..e1f15d1 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -30,6 +30,7 @@ #include #include +#include #include #include @@ -47,6 +48,9 @@ #include "vfil.h" #include "vqueue.h" #include "vrnd.h" +#include "vsa.h" +#include "vss.h" +#include "vtcp.h" #include "vtim.h" #define MAX_FILESIZE (1024 * 1024) @@ -89,6 +93,7 @@ static char *tmppath; static char *cwd = NULL; int leave_temp; int vtc_witness = 0; +int feature_dns; /********************************************************************** * Parse a -D option argument into a name/val pair, and insert @@ -384,6 +389,41 @@ i_mode(void) } /********************************************************************** + * Most test-cases use only numeric IP#'s but a few requires non-demented + * DNS services. This is a basic sanity check for those. + */ + +static int __match_proto__(vss_resolved_f) +dns_cb(void *priv, const struct suckaddr *sa) +{ + char abuf[VTCP_ADDRBUFSIZE]; + char pbuf[VTCP_PORTBUFSIZE]; + int *ret = priv; + + VTCP_name(sa, abuf, sizeof abuf, pbuf, sizeof pbuf); + if (strcmp(abuf, "130.225.244.222")) { + fprintf(stderr, "DNS-test: Wrong response: %s\n", abuf); + *ret = -1; + } else if (*ret == 0) + *ret = 1; + return (0); +} + +static int +dns_works(void) +{ + int ret = 0, error; + const char *msg; + + error = VSS_resolver("phk.freebsd.dk", NULL, dns_cb, &ret, &msg); + if (error || msg != NULL || ret != 1) { + fprintf(stderr, "DNS-test fails\n"); + return (0); + } + return (1); +} + +/********************************************************************** * Main */ @@ -480,6 +520,8 @@ main(int argc, char * const *argv) VTAILQ_INSERT_TAIL(&tst_head, tp, list); } + feature_dns = dns_works(); + if (iflg) i_mode(); From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 1596823 polish Message-ID: commit 159682339108033f15ebf659cdaecc03971f66c7 Author: Poul-Henning Kamp Date: Tue Aug 25 17:18:25 2015 +0000 polish diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 72a7763..1c43fb3 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -207,7 +207,7 @@ ved_decode_len(uint8_t **pp) p += 9; break; default: - printf("Illegal Length %d %d\n", *p, (*p & 15)); + Debug("Illegal Length %d %d\n", *p, (*p & 15)); INCOMPL(); } *pp = p; @@ -327,7 +327,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->p = r + 1; break; default: - printf("XXXX 0x%02x [%s]\n", *ecx->p, ecx->p); + Debug("XXXX 0x%02x [%s]\n", *ecx->p, ecx->p); INCOMPL(); } break; From phk at FreeBSD.org Fri Sep 4 13:54:55 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:55 +0200 Subject: [4.1] 22ff964 Get better diagnostics on ESI-code string errors. Message-ID: commit 22ff96495f8dfd774198431a3189831b1594cac9 Author: Poul-Henning Kamp Date: Tue Aug 25 17:35:23 2015 +0000 Get better diagnostics on ESI-code string errors. Related to: #1773 diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 1c43fb3..ff30ae3 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -187,7 +187,7 @@ ved_include(struct req *preq, const char *src, const char *host, #define Debug(fmt, ...) /**/ static ssize_t -ved_decode_len(uint8_t **pp) +ved_decode_len(struct req *req, uint8_t **pp) { uint8_t *p; ssize_t l; @@ -207,8 +207,9 @@ ved_decode_len(uint8_t **pp) p += 9; break; default: - Debug("Illegal Length %d %d\n", *p, (*p & 15)); - INCOMPL(); + VSLb(req->vsl, SLT_Error, + "ESI-corruption: Illegal Length %d %d\n", *p, (*p & 15)); + WRONG("ESI-codes: illegal length"); } *pp = p; assert(l > 0); @@ -286,12 +287,16 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, case VEC_V1: case VEC_V2: case VEC_V8: - ecx->l = ved_decode_len(&ecx->p); + ecx->l = ved_decode_len(req, &ecx->p); + if (ecx->l < 0) + return (-1); if (ecx->isgzip) { assert(*ecx->p == VEC_C1 || *ecx->p == VEC_C2 || *ecx->p == VEC_C8); - l = ved_decode_len(&ecx->p); + l = ved_decode_len(req, &ecx->p); + if (l < 0) + return (-1); icrc = vbe32dec(ecx->p); ecx->p += 4; if (ecx->isgzip) { @@ -305,7 +310,9 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, case VEC_S1: case VEC_S2: case VEC_S8: - ecx->l = ved_decode_len(&ecx->p); + ecx->l = ved_decode_len(req, &ecx->p); + if (ecx->l < 0) + return (-1); Debug("SKIP1(%d)\n", (int)ecx->l); ecx->state = 4; break; @@ -327,8 +334,10 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->p = r + 1; break; default: - Debug("XXXX 0x%02x [%s]\n", *ecx->p, ecx->p); - INCOMPL(); + VSLb(req->vsl, SLT_Error, + "ESI corruption line %d 0x%02x [%s]\n", + __LINE__, *ecx->p, ecx->p); + WRONG("ESI-codes: Illegal code"); } break; case 2: From phk at FreeBSD.org Fri Sep 4 13:54:56 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] b31c8b5 Temporarily set this testcase to use poll-waiter, to tease out OSX/64 issue... Message-ID: commit b31c8b505b4b09a47217a1faf361419d32f5da3b Author: Poul-Henning Kamp Date: Tue Aug 25 17:53:33 2015 +0000 Temporarily set this testcase to use poll-waiter, to tease out OSX/64 issue... diff --git a/bin/varnishtest/tests/m00011.vtc b/bin/varnishtest/tests/m00011.vtc index 7540c9b..29c4261 100644 --- a/bin/varnishtest/tests/m00011.vtc +++ b/bin/varnishtest/tests/m00011.vtc @@ -8,7 +8,7 @@ server s1 { } -start -varnish v1 -vcl+backend { +varnish v1 -arg "-Wpoll" -vcl+backend { import ${vmod_std}; sub vcl_deliver { From phk at FreeBSD.org Fri Sep 4 13:54:56 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 34360fd Add some debugging (OSX64/m00011) Message-ID: commit 34360fd1bbecfc5b0a6b8a27c2fa97a19f0bcd6a Author: Poul-Henning Kamp Date: Tue Aug 25 19:43:51 2015 +0000 Add some debugging (OSX64/m00011) diff --git a/bin/varnishd/waiter/cache_waiter_poll.c b/bin/varnishd/waiter/cache_waiter_poll.c index 72c97fb..5e2edb8 100644 --- a/bin/varnishd/waiter/cache_waiter_poll.c +++ b/bin/varnishd/waiter/cache_waiter_poll.c @@ -171,12 +171,15 @@ vwp_main(void *priv) i = -1; else i = (int)floor(1e3 * (then - VTIM_real())); + assert(vwp->hpoll > 0); + AN(vwp->pollfd); v = poll(vwp->pollfd, vwp->hpoll, i); assert(v >= 0); now = VTIM_real(); if (vwp->pollfd[0].revents) v--; for (i = 1; i < vwp->hpoll;) { +VSL(SLT_Debug, vwp->pollfd[i].fd, "POLL loop i=%d revents=0x%x", i, vwp->pollfd[i].revents); assert(vwp->pollfd[i].fd != vwp->pipes[0]); wp = vwp->idx[i]; CHECK_OBJ_NOTNULL(wp, WAITED_MAGIC); From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:56 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] dc0b0ca Revert "Hide backends and directors implementation details" Message-ID: commit dc0b0ca1e818096505ea856b905c974fa847aa41 Author: Dridi Boukelmoune Date: Thu Aug 27 09:53:26 2015 +0200 Revert "Hide backends and directors implementation details" This reverts commit d771942c0c6f151e267b63bbc548a4d4371b25be, it needs to be discussed first. diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index eb01348..dd2bae2 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -99,8 +99,6 @@ varnishd_SOURCES = \ noinst_HEADERS = \ builtin_vcl.h \ - cache/cache_backend.h \ - cache/cache_director.h \ cache/cache_esi.h \ cache/cache_pool.h \ common/heritage.h \ @@ -118,6 +116,8 @@ noinst_HEADERS = \ nobase_pkginclude_HEADERS = \ cache/cache.h \ cache/cache_filter.h \ + cache/cache_backend.h \ + cache/cache_director.h \ common/common.h \ common/params.h \ waiter/waiter.h diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index ed72296..648dad4 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -190,47 +190,6 @@ struct http { }; /*-------------------------------------------------------------------- - * Director public APIs - */ - -typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *, - double *changed); - -typedef const struct director *vdi_resolve_f(const struct director *, - struct worker *, struct busyobj *); - -typedef int vdi_gethdrs_f(const struct director *, struct worker *, - struct busyobj *); -typedef int vdi_getbody_f(const struct director *, struct worker *, - struct busyobj *); -typedef const struct suckaddr *vdi_getip_f(const struct director *, - struct worker *, struct busyobj *); -typedef void vdi_finish_f(const struct director *, struct worker *, - struct busyobj *); - -typedef void vdi_http1pipe_f(const struct director *, struct req *, - struct busyobj *); - -typedef void vdi_panic_f(const struct director *, struct vsb *); - -struct director { - unsigned magic; -#define DIRECTOR_MAGIC 0x3336351d - const char *name; - char *vcl_name; - vdi_http1pipe_f *http1pipe; - vdi_healthy_f *healthy; - vdi_resolve_f *resolve; - vdi_gethdrs_f *gethdrs; - vdi_getbody_f *getbody; - vdi_getip_f *getip; - vdi_finish_f *finish; - vdi_panic_f *panic; - void *priv; - const void *priv2; -}; - -/*-------------------------------------------------------------------- * VFP filter state */ diff --git a/bin/varnishd/cache/cache_director.h b/bin/varnishd/cache/cache_director.h index 3bccf80..cf20dc1 100644 --- a/bin/varnishd/cache/cache_director.h +++ b/bin/varnishd/cache/cache_director.h @@ -37,6 +37,49 @@ * */ +/*-------------------------------------------------------------------- + * A director is a piece of code which selects one of possibly multiple + * backends to use. + */ + + +typedef unsigned vdi_healthy_f(const struct director *, const struct busyobj *, + double *changed); + +typedef const struct director *vdi_resolve_f(const struct director *, + struct worker *, struct busyobj *); + +typedef int vdi_gethdrs_f(const struct director *, struct worker *, + struct busyobj *); +typedef int vdi_getbody_f(const struct director *, struct worker *, + struct busyobj *); +typedef const struct suckaddr *vdi_getip_f(const struct director *, + struct worker *, struct busyobj *); +typedef void vdi_finish_f(const struct director *, struct worker *, + struct busyobj *); + +typedef void vdi_http1pipe_f(const struct director *, struct req *, + struct busyobj *); + +typedef void vdi_panic_f(const struct director *, struct vsb *); + +struct director { + unsigned magic; +#define DIRECTOR_MAGIC 0x3336351d + const char *name; + char *vcl_name; + vdi_http1pipe_f *http1pipe; + vdi_healthy_f *healthy; + vdi_resolve_f *resolve; + vdi_gethdrs_f *gethdrs; + vdi_getbody_f *getbody; + vdi_getip_f *getip; + vdi_finish_f *finish; + vdi_panic_f *panic; + void *priv; + const void *priv2; +}; + /* cache_director.c */ int VDI_GetHdr(struct worker *, struct busyobj *); diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index 1738bcf..411df34 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -31,6 +31,7 @@ #include #include "cache/cache.h" +#include "cache/cache_director.h" #include "vrt.h" #include "vbm.h" From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:56 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] e52a2cb Docs update on VCL temperature with fact checking Message-ID: commit e52a2cbc4b83df42b7fc2ec686be5328aa61883c Author: Dridi Boukelmoune Date: Wed Aug 26 23:45:41 2015 +0200 Docs update on VCL temperature with fact checking The Varnish CLI documentation was advertising an optional temperature parameter for `vcl.use`, and overall the test coverage wasn't deep enough. There is still room for improvement. The debug VMOD now logs some of the VCL events to help cover more behavior in `v00044.vtc`. diff --git a/bin/varnishtest/tests/v00044.vtc b/bin/varnishtest/tests/v00044.vtc index 6f44d82..c3fd107 100644 --- a/bin/varnishtest/tests/v00044.vtc +++ b/bin/varnishtest/tests/v00044.vtc @@ -7,7 +7,9 @@ server s1 -repeat 20 { close } -start +# The debug vmod logs some vcl events varnish v1 -arg "-p vcl_cooldown=1" -vcl { + import ${vmod_debug}; backend default { .host = "${s1_addr}"; .probe = { .interval = 1s; .initial = 1;} @@ -51,8 +53,34 @@ varnish v1 -expect VBE.vcl2.default.happy >= 0 delay 4 varnish v1 -expect !VBE.vcl2.default.happy -# Mark the used warm and use it the other +# Mark the used warm and use the other varnish v1 -cliok "vcl.state vcl1 warm" varnish v1 -cliok "vcl.use vcl2" + +# It will stay warm even after the cooldown period delay 4 +varnish v1 -expect VBE.vcl1.default.happy >= 0 varnish v1 -expect VBE.vcl2.default.happy >= 0 + +# You can't freeze the active VCL +varnish v1 -clierr 106 "vcl.state vcl2 cold" + +# However a warm event is guaranteed... +logexpect l1 -v v1 -g raw { + expect * 0 Debug "vcl1: VCL_EVENT_COLD" + expect * 0 Debug "vcl1: VCL_EVENT_WARM" + expect * 0 Debug "vcl1: VCL_EVENT_USE" +} -start + +# ...when you use a cold VCL +varnish v1 -cliok "vcl.state vcl1 cold" +varnish v1 -cliok "vcl.use vcl1" + +logexpect l1 -wait + +# It will apply the cooldown period once inactive +varnish v1 -cliok "vcl.use vcl2" +delay .4 +varnish v1 -expect VBE.vcl1.default.happy >= 0 +delay 4 +varnish v1 -expect !VBE.vcl1.default.happy diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index de321b2..9f1381c 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -116,9 +116,10 @@ backends. Finally, Varnish will take care of event propagation for *all* native backends, but dynamic backends can only be created when the VCL is warm. If your backends -are created by an independant thread (basically outside of VCL scope) you must +are created by an independent thread (basically outside of VCL scope) you must subscribe to VCL events and watch for VCL state (see -:ref:`ref-vmod-event-functions`). +:ref:`ref-vmod-event-functions`). You are also encouraged to comply with the +:ref:`ref_vcl_temperature` in general. .. _ref-writing-a-director-cluster: diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index e400408..4098afd 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -107,7 +107,7 @@ vcl.load [auto|cold|warm] vcl.inline [auto|cold|warm] Compile and load the VCL data under the name provided. -vcl.use [auto|cold|warm] +vcl.use Switch to the named configuration immediately. vcl.discard @@ -174,6 +174,28 @@ Integers can have "KB", "MB", "GB" or "TB" appended for size related fields. +.. _ref_vcl_temperature: + +VCL Temperature +--------------- + +A VCL program goes through several states related to the different commands: it +can be loaded, used, and later discarded. You can load several VCL programs and +switch at any time from one to another. There is only one active VCL, but the +previous active VCL will be maintained active until all its transactions are +over. + +Over time, if you often refresh your VCL and keep the previous versions around, +resource consumption will increase, you can't escape that. However, most of the +time you want only one to pay the price only for the active VCL and keep older +VCLs in case you'd need to rollback to a previous version. + +The VCL temperature allows you to minimize the footprint of inactive VCLs. Once +a VCL becomes cold, Varnish will release all the resources that can be be later +reacquired. You can manually set the temperature of a VCL or let varnish +automatically handle it. + + Scripting --------- diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 0446e83..b3ccefa 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -355,14 +355,14 @@ The per-call vmod_privs are freed before the per-vcl vmod_priv. Event functions =============== -VMODs can have an "event" function which is called when a VCL which -imports the VMOD is loaded, made active, or discarded. This corresponds -to the VCL_EVENT_LOAD, VCL_EVENT_USE, and VCL_EVENT_DISCARD events, -respectively. In addition, this function will be called when the VCL -state is changed to cold or warm, corresponding to the VCL_EVENT_COLD -and VCL_EVENT_WARM events. +VMODs can have an "event" function which is called when a VCL which imports +the VMOD is loaded, made active, or discarded. This corresponds to the +``VCL_EVENT_LOAD``, ``VCL_EVENT_USE``, and ``VCL_EVENT_DISCARD`` events, +respectively. In addition, this function will be called when the VCL state is +changed to cold or warm, corresponding to the ``VCL_EVENT_COLD`` and +``VCL_EVENT_WARM`` events. -The first argument to the event function is the VRT context. +The first argument to the event function is a VRT context. The second argument is the vmod_priv specific to this particular VCL, and if necessary, a VCL specific VMOD "fini" function can be attached @@ -371,9 +371,16 @@ to its "free" hook. The third argument is the event. If the VMOD has private global state, which includes any sockets or files -opened, any memory allocated to global or private variables in the C-code -etc, it is the VMODs own responsibility to track how many VCLs have called -init (& fini) and free this global state when the count reaches zero +opened, any memory allocated to global or private variables in the C-code etc, +it is the VMODs own responsibility to track how many VCLs were loaded or +discarded and free this global state when the count reaches zero. + +VMOD writers are *strongly* encouraged to release all per-VCL resources for a +given VCL when it emits a ``VCL_EVENT_COLD`` event. You will get a chance to +reacquire the resources before the VCL becomes active again and be notified +first with a ``VCL_EVENT_WARM`` event, and then a ``VCL_EVENT_USE`` event. +Unless a user decides that a given VCL should always be warm, an inactive VMOD +will eventually become cold and should manage resources accordingly. .. _ref-vmod-objects: diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index b7fd4da..4a948ca 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -61,7 +61,7 @@ Example:: VMOD writers should read up on the new vcl_event system to release unnecessary -state when a VCL is transitioned to cold. +state when a VCL is transitioned to cold (see ref:`ref-vmod-event-functions`). PROXY protocol support diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 3dddbac..c9b1028 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -253,6 +253,17 @@ int __match_proto__(vmod_event_f) event_function(VRT_CTX, struct vmod_priv *priv, enum vcl_event_e e) { struct priv_vcl *priv_vcl; + const char *ev; + + switch (e) { + case VCL_EVENT_COLD: ev = "VCL_EVENT_COLD"; break; + case VCL_EVENT_WARM: ev = "VCL_EVENT_WARM"; break; + case VCL_EVENT_USE: ev = "VCL_EVENT_USE"; break; + default: ev = NULL; + } + + if (ev != NULL) + VSL(SLT_Debug, 0, "%s: %s", VCL_Name(ctx->vcl), ev); if (e != VCL_EVENT_LOAD) return (0); From dridi.boukelmoune at gmail.com Fri Sep 4 13:54:56 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] b6b3883 Short introduction to VMOD backends in 4.1 changes Message-ID: commit b6b3883049f32f55cbe8c3151540bfddb8006a03 Author: Dridi Boukelmoune Date: Thu Aug 27 12:41:19 2015 +0200 Short introduction to VMOD backends in 4.1 changes diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 4a948ca..7b6eeba 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -94,7 +94,11 @@ in ``vcl_recv`` to see if traffic came in over the HTTP listening socket VMOD backends ============= -Not yet documented. +Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 +moved directors from VCL to VMODs, and VMODs can now also create backends. It +is possible to both create the same backends than VCL but dynamically, or +create backends that don't necesserally speak HTTP/1 over TCP to fetch +resources. More details in the :ref:`ref-writing-a-director` documentation. Surrogate keys From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 660d9b1 Add long descriptions for stevedore counters. Message-ID: commit 660d9b1da311cd2d3de72be9e8c74702c24e7ec9 Author: Lasse Karstensen Date: Thu Aug 27 16:19:11 2015 +0200 Add long descriptions for stevedore counters. I often have to look up which one is which, try to avoid that in the future. diff --git a/include/tbl/vsc_fields.h b/include/tbl/vsc_fields.h index 7d45f5c..fcf342f 100644 --- a/include/tbl/vsc_fields.h +++ b/include/tbl/vsc_fields.h @@ -123,31 +123,31 @@ VSC_F(locks, uint64_t, 0, 'c', 'i', debug, #if defined(VSC_DO_SMA) || defined (VSC_DO_SMF) VSC_F(c_req, uint64_t, 0, 'c', 'i', info, "Allocator requests", - "" + "Number of times the storage has been asked to provide a storage segment." ) VSC_F(c_fail, uint64_t, 0, 'c', 'i', info, "Allocator failures", - "" + "Number of times the storage has failed to provide a storage segment." ) VSC_F(c_bytes, uint64_t, 0, 'c', 'B', info, "Bytes allocated", - "" + "Number of total bytes allocated by this storage." ) VSC_F(c_freed, uint64_t, 0, 'c', 'B', info, "Bytes freed", - "" + "Number of total bytes returned to this storage." ) VSC_F(g_alloc, uint64_t, 0, 'g', 'i', info, "Allocations outstanding", - "" + "Number of storage allocations outstanding." ) VSC_F(g_bytes, uint64_t, 0, 'g', 'B', info, "Bytes outstanding", - "" + "Number of bytes allocated from the storage." ) VSC_F(g_space, uint64_t, 0, 'g', 'B', info, "Bytes available", - "" + "Number of bytes left in the storage." ) #endif From fgsch at lodoss.net Fri Sep 4 13:54:56 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 199de9b Spelling and formatting Message-ID: commit 199de9bef274ea923d87a06495aea8226c8ff8f7 Author: Federico G. Schwindt Date: Fri Aug 28 08:41:58 2015 +0100 Spelling and formatting diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 7b6eeba..b71cc85 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -3,7 +3,8 @@ Changes in Varnish 4.1 (unreleased) =================================== -Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. +Varnish 4.1 is the continuation of the new streaming architecture seen +in Varnish 4.0. Proactive security features @@ -12,25 +13,26 @@ Proactive security features New in 4.1 is support for different kinds of privilege separation methods, collectively described as jails. -On most systems, the Varnish parent process will now drop effective privileges -to normal user mode when not doing operations needing special access. +On most systems, the Varnish parent process will now drop effective +privileges to normal user mode when not doing operations needing special +access. The Varnish worker child should now be run as a separate `vcache` user. -``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities now must -be run in a context with `varnish` group membership. +``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities +now must be run in a context with `varnish` group membership. Warm and cold VCL configurations ================================ -Traditionally Varnish have had the concept of active and inactive loaded VCLs. -Any loaded VCL lead to state being kept, and a separate set of health checks (if -configured) were being run against the backends. +Traditionally Varnish have had the concept of active and inactive +loaded VCLs. Any loaded VCL lead to state being kept, and a separate +set of health checks (if configured) were being run against the backends. -To avoid the extra state and backend polling, a loaded VCL is now either warm -or cold. Runtime state (incl. backend counters) and health checks are not -present for cold VCLs. +To avoid the extra state and backend polling, a loaded VCL is now either +warm or cold. Runtime state (incl. backend counters) and health checks +are not present for cold VCLs. A warm VCL will automatically be set to cold after `vcl_cooldown` seconds. @@ -60,16 +62,17 @@ Example:: available auto/cold 0 62f5275f-a937-4df9-9fbb-c12336bdfdb8 -VMOD writers should read up on the new vcl_event system to release unnecessary -state when a VCL is transitioned to cold (see ref:`ref-vmod-event-functions`). +VMOD writers should read up on the new vcl_event system to +release unnecessary state when a VCL is transitioned to cold (see +:ref:`ref-vmod-event-functions`). PROXY protocol support ====================== -Socket support for PROXY protocol connections has been added. PROXY defines a -short preamble on the TCP connection where (usually) a SSL/TLS terminating -proxy can signal the real client address. +Socket support for PROXY protocol connections has been added. PROXY +defines a short preamble on the TCP connection where (usually) a SSL/TLS +terminating proxy can signal the real client address. The ``-a`` startup argument syntax has been expanded to allow for this:: @@ -94,11 +97,12 @@ in ``vcl_recv`` to see if traffic came in over the HTTP listening socket VMOD backends ============= -Before Varnish 4.1, backends could only be declared in native VCL. Varnish 4.0 -moved directors from VCL to VMODs, and VMODs can now also create backends. It -is possible to both create the same backends than VCL but dynamically, or -create backends that don't necesserally speak HTTP/1 over TCP to fetch -resources. More details in the :ref:`ref-writing-a-director` documentation. +Before Varnish 4.1, backends could only be declared in native VCL. Varnish +4.0 moved directors from VCL to VMODs, and VMODs can now also create +backends. It is possible to both create the same backends than VCL but +dynamically, or create backends that don't necessarily speak HTTP/1 over +TCP to fetch resources. More details in the :ref:`ref-writing-a-director` +documentation. Surrogate keys @@ -109,8 +113,8 @@ Not yet documented. Passing data between ESI requests ================================= -A new `req_top` identifier is available in VCL, which is a reference -to `req` in the top-level ESI request. +A new `req_top` identifier is available in VCL, which is a reference to +`req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request and any ESI subrequests it lead to. @@ -119,7 +123,9 @@ and any ESI subrequests it lead to. Other noteworthy small changes ============================== -* Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. -* Varnish will now discard remaining/older open backend connections when a failing connection is found. +* Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 + to set object grace time. +* Varnish will now discard remaining/older open backend connections when + a failing connection is found. * -smalloc storage is now recommended over -sfile on Linux systems. From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] a6162d5 Add contents for 3.0.7 from 3.0 branch. Message-ID: commit a6162d5baeff4dbcd8d7ac39aa24ec8c0c46b288 Author: Lasse Karstensen Date: Wed Sep 2 13:34:48 2015 +0200 Add contents for 3.0.7 from 3.0 branch. Fixes: #1782 diff --git a/doc/changes.rst b/doc/changes.rst index a2e4598..745d1bc 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -451,6 +451,38 @@ Open issues .. _1268: https://www.varnish-cache.org/trac/ticket/1268 +============================================ +Changes from 3.0.7-rc1 to 3.0.7 (2015-03-23) +============================================ + +- No changes. + +============================================ +Changes from 3.0.6 to 3.0.7-rc1 (2015-03-18) +============================================ + +- Requests with multiple Content-Length headers will now fail. + +- Stop recognizing a single CR (\r) as a HTTP line separator. + This opened up a possible cache poisioning attack in stacked installations + where sslterminator/varnish/backend had different CR handling. + +- Improved error detection on master-child process communication, leading to + faster recovery (child restart) if communication loses sync. + +- Fix a corner-case where Content-Length was wrong for HTTP 1.0 clients, + when using gzip and streaming. Bug 1627_. + +- More robust handling of hop-by-hop headers. + +- [packaging] Coherent Redhat pidfile in init script. Bug 1690_. + +- Avoid memory leak when adding bans. + +.. _1627: http://varnish-cache.org/trac/ticket/1627 +.. _1690: http://varnish-cache.org/trac/ticket/1690 + + =========================================== Changes from 3.0.6rc1 to 3.0.6 (2014-10-16) =========================================== From fgsch at lodoss.net Fri Sep 4 13:54:56 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 91085b2 Silence dns test output when offline Message-ID: commit 91085b2b00bc1d572ef3bba3511f2068d55ff645 Author: Federico G. Schwindt Date: Wed Sep 2 15:51:17 2015 +0100 Silence dns test output when offline diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index e1f15d1..cfdea02 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -416,10 +416,8 @@ dns_works(void) const char *msg; error = VSS_resolver("phk.freebsd.dk", NULL, dns_cb, &ret, &msg); - if (error || msg != NULL || ret != 1) { - fprintf(stderr, "DNS-test fails\n"); + if (error || msg != NULL || ret != 1) return (0); - } return (1); } From fgsch at lodoss.net Fri Sep 4 13:54:56 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 1858d35 GC unused prototypes Message-ID: commit 1858d35ca043ecacabe35d53cf2460acf880b1c6 Author: Federico G. Schwindt Date: Wed Sep 2 15:51:49 2015 +0100 GC unused prototypes diff --git a/include/vrt.h b/include/vrt.h index 4b429dd..2d0a012 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -253,9 +253,7 @@ void VRT_ban_string(VRT_CTX, const char *); void VRT_purge(VRT_CTX, double ttl, double grace, double keep); void VRT_count(VRT_CTX, unsigned); -int VRT_rewrite(const char *, const char *); void VRT_synth(VRT_CTX, unsigned, const char *); -int VRT_switch_config(const char *); struct http *VRT_selecthttp(VRT_CTX, enum gethdr_e); const char *VRT_GetHdr(VRT_CTX, const struct gethdr_s *); From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 81c0e4a Improve client workspace overflow handling. Message-ID: commit 81c0e4a64e5f5af967324b502661b243ffdbef00 Author: Lasse Karstensen Date: Thu Sep 3 15:02:49 2015 +0200 Improve client workspace overflow handling. Instead of asserting, return a 500 error to the client if running out of client workspace. This also extends vmod_debug with workspace handling functions, and adds two test cases that use these functions. As discussed at VDD15Q3. Reviewed by Martin. diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 324947b..c931971 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -58,6 +58,23 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, return (0); } +static void +v1d_error(struct req *req, const char *msg) { + static const char r_500[] = + "HTTP/1.1 500 Internal Server Error\r\n" + "Server: Varnish\r\n" + "Connection: close\r\n\r\n"; + + VSLb(req->vsl, SLT_Error, "%s", msg); + VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); + VSLb(req->vsl, SLT_RespStatus, "500"); + VSLb(req->vsl, SLT_RespReason, "Internal Server Error"); + + (void)write(req->sp->fd, r_500, sizeof r_500 - 1); + req->doclose = SC_TX_EOF; + return; +} + /*-------------------------------------------------------------------- */ @@ -105,6 +122,11 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); + if (WS_Overflowed(req->ws)) { + v1d_error(req, "workspace_client overflow"); + return; + } + req->acct.resp_hdrbytes += HTTP1_Write(req->wrk, req->resp, HTTP1_Resp); if (DO_DEBUG(DBG_FLUSH_HEAD)) (void)V1L_Flush(req->wrk); diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c index 2bcaf6e..04d2533 100644 --- a/bin/varnishd/http1/cache_http1_line.c +++ b/bin/varnishd/http1/cache_http1_line.c @@ -80,7 +80,8 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, res = WS_Snapshot(ws); v1l = WS_Alloc(ws, sizeof *v1l); - AN(v1l); + if (v1l == NULL) + return; INIT_OBJ(v1l, V1L_MAGIC); v1l->ws = ws; @@ -89,9 +90,12 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, u = WS_Reserve(ws, 0); u = PRNDDN(u); u /= sizeof(struct iovec); - if (u > IOV_MAX) + if (u == 0) { + WS_Release(ws, 0); + WS_MarkOverflow(ws); + return; + } else if (u > IOV_MAX) u = IOV_MAX; - AN(u); v1l->iov = (void*)PRNDUP(ws->f); v1l->siov = u; v1l->ciov = u; @@ -102,6 +106,7 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, v1l->t0 = t0; v1l->vsl = vsl; wrk->v1l = v1l; + return; } unsigned diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc new file mode 100644 index 0000000..27f339f --- /dev/null +++ b/bin/varnishtest/tests/c00070.vtc @@ -0,0 +1,55 @@ +varnishtest "Test workspace functions in vmod_debug" + +server s1 { + rxreq + txresp + + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import ${vmod_debug}; + sub vcl_backend_response { + set beresp.http.free_backend = debug.workspace_free(backend); + } + + sub vcl_deliver { + set resp.http.free_client = debug.workspace_free(client); + set resp.http.free_session = debug.workspace_free(session); + set resp.http.free_thread = debug.workspace_free(thread); + + set resp.http.overflowed = debug.workspace_overflowed(client); + debug.workspace_allocate(client, 2048); + + if (req.url == "/bar") { + debug.workspace_overflow(client); + } + } +} -start + +logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" { + expect 0 * Begin + expect * = Error "workspace_client overflow" + expect * = End +} -start + +client c1 { + txreq -url /foo + rxresp + expect resp.http.overflowed == "false" + + expect resp.http.free_client > 57000 + expect resp.http.free_backend > 57000 + expect resp.http.free_session > 250 + expect resp.http.free_thread > 2000 +} -run + +client c2 { + txreq -url /bar + rxresp + expect resp.status == 500 +} -run + +logexpect l1 -wait + diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc new file mode 100644 index 0000000..59e3281 --- /dev/null +++ b/bin/varnishtest/tests/c00071.vtc @@ -0,0 +1,47 @@ +varnishtest "Test actual client workspace overflow" + +server s1 { + rxreq + txresp + + rxreq + txresp + + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import ${vmod_debug}; + sub vcl_deliver { + debug.workspace_allocate(client, debug.workspace_free(client) - 200); + + if (req.url ~ "/bar") { + set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + } + else if (req.url ~ "/baz") { + set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"); + } + set resp.http.x-of = debug.workspace_overflowed(client); + } +} -start + +client c1 { + txreq -url /foo + rxresp + expect resp.status == 200 + expect resp.http.x-of == "false" + + txreq -url /bar + rxresp + expect resp.status == 500 + expect resp.http.x-of == +} -run + +client c2 { + txreq -url /baz + rxresp + expect resp.status == 500 + expect resp.http.x-of == +} -run + diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 8b32e92..dad36ec 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -122,3 +122,19 @@ Return the dynamic backend. $Method VOID .refresh(STRING addr, STRING port) Dynamically refresh & (always!) replace the backend by a new one. + +$Function VOID workspace_allocate(ENUM { client, backend, session, thread }, INT SIZE) + +Allocate and zero out SIZE bytes from a workspace. + +$Function BOOL workspace_overflowed(ENUM { client, backend, session, thread }) + +Return if the workspace overflow mark is set or not. + +$Function VOID workspace_overflow(ENUM { client, backend, session, thread }) + +Mark a workspace as overflowed. + +$Function INT workspace_free(ENUM { client, backend, session, thread }) + +Find how much unallocated space there is left in a workspace. diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index c9b1028..732d89a 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -290,3 +290,72 @@ vmod_sleep(VRT_CTX, VCL_DURATION t) CHECK_OBJ_ORNULL(ctx, VRT_CTX_MAGIC); VTIM_sleep(t); } + +static struct ws *wsfind(VRT_CTX, VCL_ENUM which) { + if (!strcmp(which, "client")) { + return ctx->ws; + } else if (!strcmp(which, "backend")) { + return ctx->bo->ws; + } else if (!strcmp(which, "session")) { + return ctx->req->sp->ws; + } else if (!strcmp(which, "thread")) { + return ctx->req->wrk->aws; + } else + WRONG("No such workspace."); +} + +void +vmod_workspace_allocate(VRT_CTX, VCL_ENUM which, VCL_INT size) +{ + struct ws *ws; + char *s; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + + WS_Assert(ws); + AZ(ws->r); + + s = WS_Alloc(ws, size); + if (!s) + return; + memset(s, '\0', size); +} + +VCL_INT +vmod_workspace_free(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + + WS_Assert(ws); + AZ(ws->r); + + return pdiff(ws->f, ws->e); +} + +VCL_BOOL +vmod_workspace_overflowed(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + WS_Assert(ws); + + return (WS_Overflowed(ws)); +} + +void +vmod_workspace_overflow(VRT_CTX, VCL_ENUM which) +{ + struct ws *ws; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + ws = wsfind(ctx, which); + WS_Assert(ws); + + WS_MarkOverflow(ws); +} From fgsch at lodoss.net Fri Sep 4 13:54:56 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] a3282ae Remove superfluous returns Message-ID: commit a3282aed553c7265fbe6111fc49c4008992c28f6 Author: Federico G. Schwindt Date: Thu Sep 3 21:15:27 2015 +0100 Remove superfluous returns diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 139e18b..c747ead 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -567,7 +567,6 @@ ccf_config_load(struct cli *cli, const char * const *av, void *priv) ASSERT_CLI(); if (VCL_Load(cli, av[2], av[3], av[4])) VCLI_SetResult(cli, CLIS_PARAM); - return; } static void __match_proto__(cli_func_t) @@ -640,7 +639,6 @@ ccf_config_use(struct cli *cli, const char * const *av, void *priv) Lck_Unlock(&vcl_mtx); } VSB_delete(vsb); - return; } static void __match_proto__(cli_func_t) diff --git a/bin/varnishd/hash/hash_classic.c b/bin/varnishd/hash/hash_classic.c index 9121ec1..ef817ea 100644 --- a/bin/varnishd/hash/hash_classic.c +++ b/bin/varnishd/hash/hash_classic.c @@ -78,7 +78,6 @@ hcl_init(int ac, char * const *av) } hcl_nhash = u; fprintf(stderr, "Classic hash: %u buckets\n", hcl_nhash); - return; } /*-------------------------------------------------------------------- diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index c931971..5d4e4f2 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -59,7 +59,8 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, } static void -v1d_error(struct req *req, const char *msg) { +v1d_error(struct req *req, const char *msg) +{ static const char r_500[] = "HTTP/1.1 500 Internal Server Error\r\n" "Server: Varnish\r\n" @@ -72,7 +73,6 @@ v1d_error(struct req *req, const char *msg) { (void)write(req->sp->fd, r_500, sizeof r_500 - 1); req->doclose = SC_TX_EOF; - return; } /*-------------------------------------------------------------------- diff --git a/bin/varnishd/http1/cache_http1_line.c b/bin/varnishd/http1/cache_http1_line.c index 04d2533..9c49fca 100644 --- a/bin/varnishd/http1/cache_http1_line.c +++ b/bin/varnishd/http1/cache_http1_line.c @@ -106,7 +106,6 @@ V1L_Reserve(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl, v1l->t0 = t0; v1l->vsl = vsl; wrk->v1l = v1l; - return; } unsigned diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c index d029861..433581e 100644 --- a/bin/varnishd/proxy/cache_proxy_proto.c +++ b/bin/varnishd/proxy/cache_proxy_proto.c @@ -381,5 +381,4 @@ VPX_Proto_Sess(struct worker *wrk, void *priv) req->sp->sess_step = S_STP_H1NEWREQ; wrk->task.func = SES_Proto_Req; wrk->task.priv = req; - return; } diff --git a/bin/varnishd/waiter/cache_waiter_ports.c b/bin/varnishd/waiter/cache_waiter_ports.c index 0a647ef..f9e3b52 100644 --- a/bin/varnishd/waiter/cache_waiter_ports.c +++ b/bin/varnishd/waiter/cache_waiter_ports.c @@ -131,7 +131,6 @@ vws_port_ev(struct vws *vws, struct waiter *w, port_event_t *ev, double now) { WAITER_REMCLOSE : WAITER_ACTION, now); } - return; } static void * diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index 9559016..ce4c2eb 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -397,7 +397,6 @@ vxp_expr_not(struct vxp *vxp, struct vex **pvex) } vxp_expr_group(vxp, pvex); - return; } /* diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index ea3e679..4a026b0 100644 --- a/lib/libvcc/vcc_action.c +++ b/lib/libvcc/vcc_action.c @@ -49,7 +49,6 @@ parse_call(struct vcc *tl) Fb(tl, 1, "if (VGC_function_%.*s(ctx))\n", PF(tl->t)); Fb(tl, 1, "\treturn (1);\n"); vcc_NextToken(tl); - return; } /*--------------------------------------------------------------------*/ diff --git a/lib/libvcc/vcc_backend_util.c b/lib/libvcc/vcc_backend_util.c index de361a5..c079b20 100644 --- a/lib/libvcc/vcc_backend_util.c +++ b/lib/libvcc/vcc_backend_util.c @@ -117,7 +117,6 @@ vcc_IsField(struct vcc *tl, struct token **t, struct fld_spec *fs) vcc_ErrToken(tl, t_field); VSB_printf(tl->sb, " at\n"); vcc_ErrWhere(tl, t_field); - return; } void From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] dd0e126 Clarify Github PR procedure. Message-ID: commit dd0e126a9b3a44c63a5f972aa3f423d61a11407d Author: Lasse Karstensen Date: Fri Sep 4 11:37:36 2015 +0200 Clarify Github PR procedure. diff --git a/CONTRIBUTING b/CONTRIBUTING index 3f15742..d7c0277 100644 --- a/CONTRIBUTING +++ b/CONTRIBUTING @@ -13,5 +13,11 @@ Official development tree is here: Patches can be sent to varnish-dev at varnish-cache.org. -Documentation fixes and other small items for the documentation team may be -sent as Github pull requests. + +Github pull requests +-------------------- + +Documentation updates and other non-trivial items for the documentation +team may be sent as Github pull requests. + +Pull requests outside of this scope will be closed without review. From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] d455255 Moving Redhat packaging files out of the tree. Message-ID: commit d455255536e23f1ca785b43f7ddd10f9a3ef50ab Author: Lasse Karstensen Date: Fri Sep 4 11:51:30 2015 +0200 Moving Redhat packaging files out of the tree. Redhat packaging files for the official varnish-cache.org RPMs will from now on live in a separate git repository. This decouples source releases (including release tagging) and the packaging work, which makes the release process easier. diff --git a/README.Packaging b/README.Packaging new file mode 100644 index 0000000..dbe4680 --- /dev/null +++ b/README.Packaging @@ -0,0 +1,35 @@ +Packaging +========= + +Varnish Cache packaging files are kept outside of the main distribution. + +The main reason for this is to decouple the development work from the packaging work. + +We want to be able to tag a release and do a tarball release without having +to wait for the packagers to finish their work/changes. + + +Official packages +----------------- + +The official Debian and Redhat packages are built by the Varnish Cache team +and made available on http://repo.varnish-cache.org/ . + +Packaging files for Debian: + + git://git.varnish-cache.org/varnish-cache-debian.git + +Packaging files for Redhat: + + https://github.com/varnish/varnish-cache-redhat + +Scripts that run the builds are available on: + + https://github.com/varnish/pkg-varnish-cache + + +Third-party packages +-------------------- + +Varnish Cache is built and packaged in many different operating systems and +distributions. Please see the wiki for more information. diff --git a/redhat/Makefile.am b/redhat/Makefile.am deleted file mode 100644 index 62997e1..0000000 --- a/redhat/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -# - -EXTRA_DIST = \ - README.redhat \ - varnish.initrc \ - varnish.logrotate \ - varnish_reload_vcl \ - varnish.spec \ - varnish.sysconfig \ - varnishlog.initrc \ - varnishncsa.initrc \ - varnish.params \ - varnish.service \ - varnishncsa.service \ - varnishlog.service \ - find-provides diff --git a/redhat/README.redhat b/redhat/README.redhat deleted file mode 100644 index 1f9c016..0000000 --- a/redhat/README.redhat +++ /dev/null @@ -1,59 +0,0 @@ -GCC -=== -Varnish requires a GCC-compiler compatible with the compiler used to -build varnish with. This means GCC 3.4.6 on a standard RHEL4 system. - -Varnish should work fine with GCC 3.3 and above. - -Building a RPM package from a git checkout -========================================== - -You may build an rpm package direct from a git checkout. Here is an -example on how you may do this: - -git clone git://git.varnish-cache.org/varnish-cache -cd varnish-cache -sed -i "s/^Release: .*/Release: 0.git$(date +%Y%m%d)%{?dist}/" \ - redhat/varnish.spec -./autogen.sh && ./configure -make dist && rpmbuild -ts varnish-trunk.tar.gz - -This builds a source rpm. Then you can, for example on a RHEL5 system, -do something like this: - -rpmbuild --define "dist .el5" --rebuild /path/to/varnish-3.0-0.git20110203.src.rpm - - -Configuration of addresses and ports -==================================== -In this package, varnish is configured to make the accelerator daemon -listen to port 6081. The administration interface listens to port 6082 -on 127.0.0.1. Addresses and ports can be changed in -/etc/sysconfig/varnish. - -The admin interface can be accessed by standard telnet. - -The default config will try to forward http requests to -localhost:80. You may change this in /etc/varnish/vcl.conf. Please -read the vcl(7) man page for more information on the vcl language. - -To gain actual value from varnish, you may want to move the listening -port to port 80, and your webserver to 8080 or similar. - -Running with jemalloc on ppc or ppc64 on fedora: Edit and recompile -=================================================================== -To get a package through to Fedora, it has to build in Red Hat's Koji -build environment. Their ppc and ppc64 builders run mock on a RHEL -ppc64 kernel. Our use of jemalloc does not work on this kernel, and -the build stays unsuccessful. As ppc64 is not the primary target of -varnish development, it may take some time to get this bug fixed. -To get the package through to Fedora, jemalloc is disabled in the ppc -and ppc64 builds. - -Now, varnish with jemalloc enabled is known to work at least on the -ppc (32bit) kernel in Fedora 9. If you run on ppc, and have a workload -that suits jemalloc better, you might want to change the specfile and -recompile. We would very much like feedback from anyone running -varnish on Fedora's own ppc64 kernel. - - diff --git a/redhat/find-provides b/redhat/find-provides deleted file mode 100755 index 2545e99..0000000 --- a/redhat/find-provides +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/sh - -# This script is used to inject the Varnish ABI into the provides. - -set -x - -if [ -x /usr/lib/rpm/redhat/find-provides ]; then - /usr/lib/rpm/redhat/find-provides "$@" -elif [ -x /usr/lib/rpm/find-provides ]; then - /usr/lib/rpm/find-provides "$@" -fi - -cd $(dirname $0)/.. - -printf '#include "vcs_version.h"\nVCS_Version\n' \ - | cpp - -Iinclude | sed -e '/^"/!d' -e 's/\"//g' -e 's/^/varnishabi-strict-/' - -printf '#include "vrt.h"\nvarnishabi- VRT_MAJOR_VERSION . VRT_MINOR_VERSION\n' \ - | cpp - -Iinclude \ - | sed -e '/^varnishabi-/!d' -e 's/U//g' -e 's/ //g' diff --git a/redhat/varnish.initrc b/redhat/varnish.initrc deleted file mode 100755 index 67b530a..0000000 --- a/redhat/varnish.initrc +++ /dev/null @@ -1,172 +0,0 @@ -#! /bin/sh -# -# varnish Control the Varnish Cache -# -# chkconfig: - 90 10 -# description: Varnish is a high-perfomance HTTP accelerator -# processname: varnishd -# config: /etc/sysconfig/varnish -# pidfile: /var/run/varnish.pid - -### BEGIN INIT INFO -# Provides: varnish -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Should-Start: $syslog -# Short-Description: start and stop varnishd -# Description: Varnish is a high-perfomance HTTP accelerator -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile=/var/run/varnish.pid - -exec="/usr/sbin/varnishd" -reload_exec="/usr/sbin/varnish_reload_vcl" -prog="varnishd" -config="/etc/sysconfig/varnish" -lockfile="/var/lock/subsys/varnish" - -# Include varnish defaults -[ -e /etc/sysconfig/varnish ] && . /etc/sysconfig/varnish - - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - if [ ! -f $config ] - then - echo $config not found - exit 6 - fi - echo -n "Starting Varnish Cache: " - - # Open files (usually 1024, which is way too small for varnish) - ulimit -n ${NFILES:-131072} - - # Varnish wants to lock shared memory log in memory. - ulimit -l ${MEMLOCK:-82000} - - # Maximum number of threads (default in CentOS is 1024, which - # is often too small for varnish) - ulimit -u ${NPROCS:-unlimited} - - # If defined, set maximum core size. - if [ -n "${DAEMON_COREFILE_LIMIT}" ] - then - ulimit -c ${DAEMON_COREFILE_LIMIT} - fi - - # $DAEMON_OPTS is set in /etc/sysconfig/varnish. At least, one - # has to set up a backend, or /tmp will be used, which is a bad idea. - if [ "$DAEMON_OPTS" = "" ]; then - echo "\$DAEMON_OPTS empty." - echo -n "Please put configuration options in $config" - return 6 - else - # Varnish always gives output on STDOUT - daemon --pidfile $pidfile $exec -P $pidfile "$DAEMON_OPTS" > /dev/null 2>&1 - retval=$? - if [ $retval -eq 0 ] - then - touch $lockfile - echo_success - echo - else - echo_failure - echo - fi - return $retval - fi -} - -stop() { - echo -n "Stopping Varnish Cache: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - if [ "$RELOAD_VCL" = "1" ] - then - $reload_exec - else - force_reload - fi -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -configtest() { - if [ -f "$VARNISH_VCL_CONF" ]; then - $exec -f "$VARNISH_VCL_CONF" -C "$DAEMON_OPTS" -n /tmp > /dev/null && echo "Syntax ok" - else - echo "VARNISH_VCL_CONF is unset or does not point to a file" - fi -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - configtest) - configtest - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnish.logrotate b/redhat/varnish.logrotate deleted file mode 100644 index f214d1b..0000000 --- a/redhat/varnish.logrotate +++ /dev/null @@ -1,10 +0,0 @@ -/var/log/varnish/varnish.log /var/log/varnish/varnishncsa.log { - missingok - notifempty - sharedscripts - delaycompress - postrotate - /bin/kill -HUP `cat /var/run/varnishlog.pid 2>/dev/null` 2> /dev/null || true - /bin/kill -HUP `cat /var/run/varnishncsa.pid 2>/dev/null` 2> /dev/null || true - endscript -} diff --git a/redhat/varnish.params b/redhat/varnish.params deleted file mode 100644 index 27a14dd..0000000 --- a/redhat/varnish.params +++ /dev/null @@ -1,35 +0,0 @@ -# Varnish environment configuration description. This was derived from -# the old style sysconfig/defaults settings - -# Set this to 1 to make systemd reload try to switch vcl without restart. -RELOAD_VCL=1 - -# Main configuration file. You probably want to change it. -VARNISH_VCL_CONF=/etc/varnish/default.vcl - -# Default address and port to bind to. Blank address means all IPv4 -# and IPv6 interfaces, otherwise specify a host name, an IPv4 dotted -# quad, or an IPv6 address in brackets. -# VARNISH_LISTEN_ADDRESS=192.168.1.5 -VARNISH_LISTEN_PORT=6081 - -# Admin interface listen address and port -VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -VARNISH_ADMIN_LISTEN_PORT=6082 - -# Shared secret file for admin interface -VARNISH_SECRET_FILE=/etc/varnish/secret - -# Backend storage specification, see Storage Types in the varnishd(5) -# man page for details. -VARNISH_STORAGE="file,/var/lib/varnish/varnish_storage.bin,1G" - -# Default TTL used when the backend does not specify one -VARNISH_TTL=120 - -# User and group for the varnishd worker processes -VARNISH_USER=varnish -VARNISH_GROUP=varnish - -# Other options, see the man page varnishd(1) -#DAEMON_OPTS="-p thread_pool_min=5 -p thread_pool_max=500 -p thread_pool_timeout=300" diff --git a/redhat/varnish.service b/redhat/varnish.service deleted file mode 100644 index 659dba2..0000000 --- a/redhat/varnish.service +++ /dev/null @@ -1,46 +0,0 @@ -[Unit] -Description=Varnish a high-perfomance HTTP accelerator -After=syslog.target network.target - -[Service] - -# -# If you want to make changes to this file, please copy it to -# /etc/systemd/system/varnish.service and make your changes there. -# This will override the file kept at /lib/systemd/system/varnish.service -# -# Enviroment variables may be found in /etc/varnish/varnish.params -# - -# Maximum number of open files (for ulimit -n) -LimitNOFILE=131072 - -# Locked shared memory (for ulimit -l) -# Default log size is 82MB + header -LimitMEMLOCK=82000 - -# Maximum size of the corefile. -LimitCORE=infinity - -EnvironmentFile=/etc/varnish/varnish.params - -Type=forking -PIDFile=/var/run/varnish.pid -PrivateTmp=true -ExecStart=/usr/sbin/varnishd \ - -P /var/run/varnish.pid \ - -f $VARNISH_VCL_CONF \ - -a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ - -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ - -t $VARNISH_TTL \ - -u $VARNISH_USER \ - -g $VARNISH_GROUP \ - -S $VARNISH_SECRET_FILE \ - -s $VARNISH_STORAGE \ - $DAEMON_OPTS - -ExecReload=/usr/sbin/varnish_reload_vcl - -[Install] -WantedBy=multi-user.target - diff --git a/redhat/varnish.spec b/redhat/varnish.spec deleted file mode 100644 index 9bce64d..0000000 --- a/redhat/varnish.spec +++ /dev/null @@ -1,645 +0,0 @@ -%define XXXv_rc rc1 -%define vd_rc %{?v_rc:-%{?v_rc}} -%define _use_internal_dependency_generator 0 -%define __find_provides %{_builddir}/varnish-%{version}%{?v_rc:-%{?v_rc}}/redhat/find-provides -Summary: High-performance HTTP accelerator -Name: varnish -Version: 4.0.1 -#Release: 0.20140328%{?v_rc}%{?dist} -Release: 1%{?v_rc}%{?dist} -License: BSD -Group: System Environment/Daemons -URL: https://www.varnish-cache.org/ -#Source0: http://repo.varnish-cache.org/source/%{name}-%{version}.tar.gz -Source0: %{name}-%{version}%{?vd_rc}.tar.gz -#Source0: %{name}-trunk.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -BuildRequires: automake -BuildRequires: autoconf -BuildRequires: jemalloc-devel -BuildRequires: libedit-devel -BuildRequires: libtool -BuildRequires: ncurses-devel -BuildRequires: pcre-devel -BuildRequires: pkgconfig -BuildRequires: python-docutils >= 0.6 -BuildRequires: python-sphinx -Requires: jemalloc -Requires: libedit -Requires: logrotate -Requires: ncurses -Requires: pcre -Requires: varnish-libs = %{version}-%{release} -Requires(pre): shadow-utils -Requires(post): /sbin/chkconfig, /usr/bin/uuidgen -Requires(preun): /sbin/chkconfig -Requires(preun): /sbin/service -%if %{undefined suse_version} -Requires(preun): initscripts -%endif -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -Requires(post): systemd-units -Requires(post): systemd-sysv -Requires(preun): systemd-units -Requires(postun): systemd-units -BuildRequires: systemd-units -%endif - -# Varnish actually needs gcc installed to work. It uses the C compiler -# at runtime to compile the VCL configuration files. This is by design. -Requires: gcc - -%description -This is Varnish Cache, a high-performance HTTP accelerator. - -Varnish Cache stores web pages in memory so web servers don't have to -create the same web page over and over again. Varnish serves pages -much faster than any application server; giving the website a -significant speed up. - -Documentation wiki and additional information about Varnish is -available on the following web site: https://www.varnish-cache.org/ - -%package libs -Summary: Libraries for %{name} -Group: System Environment/Libraries -BuildRequires: ncurses-devel -#Obsoletes: libvarnish1 - -%description libs -Libraries for %{name}. -Varnish Cache is a high-performance HTTP accelerator - -%package libs-devel -Summary: Development files for %{name}-libs -Group: System Environment/Libraries -BuildRequires: ncurses-devel -Requires: varnish-libs = %{version}-%{release} -Requires: python - -%description libs-devel -Development files for %{name}-libs -Varnish Cache is a high-performance HTTP accelerator - -%package docs -Summary: Documentation files for %name -Group: System Environment/Libraries - -%description docs -Documentation files for %name - -#%package libs-static -#Summary: Files for static linking of %{name} library functions -#Group: System Environment/Libraries -#BuildRequires: ncurses-devel -#Requires: varnish-libs-devel = %{version}-%{release} -# -#%description libs-static -#Files for static linking of varnish library functions -#Varnish Cache is a high-performance HTTP accelerator - -%prep -%setup -n varnish-%{version}%{?vd_rc} -#%setup -q -n varnish-trunk - -%build -# No pkgconfig/libpcre.pc in rhel4 -%if 0%{?rhel} == 4 - export PCRE_CFLAGS="`pcre-config --cflags`" - export PCRE_LIBS="`pcre-config --libs`" -%endif - -%if 0%{?rhel} == 6 -export CFLAGS="$CFLAGS -O2 -g -Wp,-D_FORTIFY_SOURCE=0" -%endif - -# Remove "--disable static" if you want to build static libraries -# jemalloc is not compatible with Red Hat's ppc64 RHEL kernel :-( -%ifarch ppc64 ppc - %configure --disable-static --localstatedir=/var/lib --without-jemalloc --without-rst2html -%else - %configure --disable-static --localstatedir=/var/lib --without-rst2html -%endif - -# 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; -# s|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool - -make %{?_smp_mflags} V=1 - -%if 0%{?fedora}%{?rhel} != 0 && 0%{?rhel} <= 4 && 0%{?fedora} <= 8 - # Old style daemon function - sed -i 's,--pidfile \$pidfile,,g; - s,status -p \$pidfile,status,g; - s,killproc -p \$pidfile,killproc,g' \ - redhat/varnish.initrc redhat/varnishlog.initrc redhat/varnishncsa.initrc -%endif - -rm -rf doc/sphinx/build/html/_sources -mv doc/sphinx/build/html doc -rm -rf doc/sphinx/build - -%check -# rhel5 on ppc64 is just too strange -%ifarch ppc64 - %if 0%{?rhel} > 4 - cp bin/varnishd/.libs/varnishd bin/varnishd/lt-varnishd - %endif -%endif - -# The redhat ppc builders seem to have some ulimit problems? -# These tests work on a rhel4 ppc/ppc64 instance outside the builders -%ifarch ppc64 ppc - %if 0%{?rhel} == 4 - rm bin/varnishtest/tests/c00031.vtc - rm bin/varnishtest/tests/r00387.vtc - %endif -%endif - -make check %{?_smp_mflags} LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcc/.libs:../../lib/libvgz/.libs" VERBOSE=1 - -%install -rm -rf %{buildroot} -make install DESTDIR=%{buildroot} INSTALL="install -p" - -# None of these for fedora -find %{buildroot}/%{_libdir}/ -name '*.la' -exec rm -f {} ';' - -# Remove this line to build a devel package with symlinks -#find %{buildroot}/%{_libdir}/ -name '*.so' -type l -exec rm -f {} ';' - -mkdir -p %{buildroot}/var/lib/varnish -mkdir -p %{buildroot}/var/log/varnish -mkdir -p %{buildroot}/var/run/varnish -mkdir -p %{buildroot}%{_sysconfdir}/ld.so.conf.d/ -install -D -m 0644 etc/example.vcl %{buildroot}%{_sysconfdir}/varnish/default.vcl -install -D -m 0644 redhat/varnish.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/varnish - -# systemd support -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -mkdir -p %{buildroot}%{_unitdir} -install -D -m 0644 redhat/varnish.service %{buildroot}%{_unitdir}/varnish.service -install -D -m 0644 redhat/varnish.params %{buildroot}%{_sysconfdir}/varnish/varnish.params -install -D -m 0644 redhat/varnishncsa.service %{buildroot}%{_unitdir}/varnishncsa.service -install -D -m 0644 redhat/varnishlog.service %{buildroot}%{_unitdir}/varnishlog.service -sed -i 's,sysconfig/varnish,varnish/varnish.params,' redhat/varnish_reload_vcl -# default is standard sysvinit -%else -install -D -m 0644 redhat/varnish.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/varnish -install -D -m 0755 redhat/varnish.initrc %{buildroot}%{_initrddir}/varnish -install -D -m 0755 redhat/varnishlog.initrc %{buildroot}%{_initrddir}/varnishlog -install -D -m 0755 redhat/varnishncsa.initrc %{buildroot}%{_initrddir}/varnishncsa -%endif -install -D -m 0755 redhat/varnish_reload_vcl %{buildroot}%{_sbindir}/varnish_reload_vcl - -echo %{_libdir}/varnish > %{buildroot}%{_sysconfdir}/ld.so.conf.d/varnish-%{_arch}.conf - -%clean -rm -rf %{buildroot} - -%files -%defattr(-,root,root,-) -%{_sbindir}/* -%{_bindir}/* -%{_var}/lib/varnish -%{_var}/log/varnish -%{_mandir}/man1/*.1* -%{_mandir}/man3/*.3* -%{_mandir}/man7/*.7* -%doc LICENSE README redhat/README.redhat ChangeLog -%{_docdir}/varnish/ -%dir %{_sysconfdir}/varnish/ -%config(noreplace) %{_sysconfdir}/varnish/default.vcl -%config(noreplace) %{_sysconfdir}/logrotate.d/varnish - -# systemd from fedora 17 and rhel 7 -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -%{_unitdir}/varnish.service -%{_unitdir}/varnishncsa.service -%{_unitdir}/varnishlog.service -%config(noreplace)%{_sysconfdir}/varnish/varnish.params - -# default is standard sysvinit -%else -%config(noreplace) %{_sysconfdir}/sysconfig/varnish -%{_initrddir}/varnish -%{_initrddir}/varnishlog -%{_initrddir}/varnishncsa -%endif - -%files libs -%defattr(-,root,root,-) -%{_libdir}/*.so.* -%{_libdir}/varnish -%doc LICENSE -%config %{_sysconfdir}/ld.so.conf.d/varnish-%{_arch}.conf - -%files libs-devel -%defattr(-,root,root,-) -%{_libdir}/lib*.so -%dir %{_includedir}/varnish -%{_includedir}/varnish/* -%{_libdir}/pkgconfig/varnishapi.pc -/usr/share/varnish -/usr/share/aclocal - -%doc LICENSE - -%files docs -%defattr(-,root,root,-) -%doc LICENSE -%doc doc/sphinx -%doc doc/html -%doc doc/changes*.html - -#%files libs-static -#%{_libdir}/libvarnish.a -#%{_libdir}/libvarnishapi.a -#%{_libdir}/libvarnishcompat.a -#%{_libdir}/libvcc.a -#%doc LICENSE - -%pre -getent group varnish >/dev/null || groupadd -r varnish -getent passwd varnish >/dev/null || \ - useradd -r -g varnish -d /var/lib/varnish -s /sbin/nologin \ - -c "Varnish Cache" varnish -exit 0 - -%post -%if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 -/bin/systemctl daemon-reload >/dev/null 2>&1 || : -%else -/sbin/chkconfig --add varnish -/sbin/chkconfig --add varnishlog -/sbin/chkconfig --add varnishncsa -%endif -test -f /etc/varnish/secret || (uuidgen > /etc/varnish/secret && chmod 0600 /etc/varnish/secret) - -%triggerun -- varnish < 3.0.2-1 -# Save the current service runlevel info -# User must manually run systemd-sysv-convert --apply varnish -# to migrate them to systemd targets -%{_bindir}/systemd-sysv-convert --save varnish >/dev/null 2>&1 ||: - -# If the package is allowed to autostart: -#/bin/systemctl --no-reload enable varnish.service >/dev/null 2>&1 ||: - -# Run these because the SysV package being removed won't do them -/sbin/chkconfig --del varnish >/dev/null 2>&1 || : -#/bin/systemctl try-restart varnish.service >/dev/null 2>&1 || : - -%preun -if [ $1 -lt 1 ]; then - # Package removal, not upgrade - %if 0%{?fedora} >= 17 || 0%{?rhel} >= 7 - /bin/systemctl --no-reload disable varnish.service > /dev/null 2>&1 || : - /bin/systemctl stop varnish.service > /dev/null 2>&1 || : - %else - /sbin/service varnish stop > /dev/null 2>&1 - /sbin/service varnishlog stop > /dev/null 2>&1 - /sbin/service varnishncsa stop > /dev/null 2>%1 - /sbin/chkconfig --del varnish - /sbin/chkconfig --del varnishlog - /sbin/chkconfig --del varnishncsa - %endif -fi - -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig - -%changelog -* Mon Mar 12 2012 Ingvar Hagelund - 3.0.2-2 -- Added PrivateTmp=true to varnishd unit file, closing #782539 -- Fixed comment typos in varnish unit file - -* Tue Mar 06 2012 Ingvar Hagelund - 3.0.2-1 -- New upstream version 3.0.2 -- Removed INSTALL as requested by rpmlint -- Added a ld.so.conf.d fragment file listing libdir/varnish -- Removed redundant doc/html/_sources -- systemd support from fedora 17 -- Stopped using macros for make and install, according to - Fedora's packaging guidelines -- Changes merged from upstream: - - Added suse_version macro - - Added comments on building from a git checkout - - mkpasswd -> uuidgen for fewer dependencies - - Fixed missing quotes around cflags for pcre - - Removed unnecessary 32/64 bit parallell build hack as this is fixed upstream - - Fixed typo in configure call, disable -> without - - Added lib/libvgz/.libs to LD_LIBRARY_PATH in make check - - Added section 3 manpages - - Configure with --without-rst2man --without-rst2html - - changelog entries -- Removed unnecessary patch for system jemalloc, upstream now supports this - -* Fri Feb 10 2012 Petr Pisar - 2.1.5-4 -- Rebuild against PCRE 8.30 - -* Sat Jan 14 2012 Fedora Release Engineering - 2.1.5-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild - -* Mon Feb 07 2011 Fedora Release Engineering - 2.1.5-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild - -* Tue Feb 01 2011 Ingvar Hagelund - 2.1.5-1 -- New upstream release -- New download location -- Moved varnish_reload_vcl to sbin -- Removed patches included upstream -- Use jemalloc as system installed library - -* Mon Nov 15 2010 Ingvar Hagelund - 3.0.0-0.svn20101115r5543 -- Merged some changes from fedora -- Upped general version to 3.0 prerelease in trunk - -* Thu Nov 04 2010 Ingvar Hagelund - 2.1.4-4 -- Added a patch fixing a missing echo in the init script that - masked failure output from the script -- Added a patch from upstream, fixing a problem with Content-Length - headers (upstream r5461, upstream bug #801) -- Added a patch from upstream, adding empty Default-Start and Default-Stop - to initscripts for better lsb compliance -- Added varnish_reload_vcl from trunk -- Synced descriptions from release spec - -* Thu Oct 28 2010 Ingvar Hagelund - 2.1.4-3 -- Fixed missing manpages because of no rst2man in rhel4 and 5 - -* Mon Oct 25 2010 Ingvar Hagelund - 2.1.4-2 -- Removed RHEL6/ppc64 specific patch that has been included upstream - -* Mon Oct 25 2010 Ingvar Hagelund - 2.1.4-1 -- New upstream release -- New URL for source tarball and main website -- Prebuilt html docs now included, use that instead of running sphinx -- Putting sphinx generated doc in a separate subpackage -- Replaced specific include files with a wildcard glob -- Needs python-sphinx and deps to build sphinx documentation - -* Tue Aug 24 2010 Ingvar Hagelund - 2.1.3-2 -- Added a RHEL6/ppc64 specific patch that changes the hard coded - stack size in tests/c00031.vtc - -* Thu Jul 29 2010 Ingvar Hagelund - 2.1.4-0.svn20100824r5117 -- Replaced specific include files with a wildcard glob -- Needs python-sphinx and deps to build sphinx documentation -- Builds html and latex documentation. Put that in a subpackage varnish-docs - -* Thu Jul 29 2010 Ingvar Hagelund - 2.1.3-1 -- New upstream release -- Add a patch for jemalloc on s390 that lacks upstream - -* Wed May 05 2010 Ingvar Hagelund - 2.1.2-1 -- New upstream release -- Remove patches merged upstream - -* Tue Apr 27 2010 Ingvar Hagelund - 2.1.1-1 -- New upstream release -- Added a fix for missing pkgconfig/libpcre.pc on rhel4 -- Added a patch from trunk making the rpm buildable on lowspec - build hosts (like Red Hat's ppc build farm nodes) -- Removed patches that are merged upstream - -* 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) -- Removed tests c00031.vtc and r00387on rhel4/ppc as they fail - on the Red Hat ppc builders (but works on my rhel4 ppc instance) -- Added a patch that fixes broken changes-2.0.6.html in doc - -* Mon Dec 14 2009 Ingvar Hagelund - 2.0.6-1 -- New upstream release -- Removed patches for libjemalloc, as they are added upstream - -* Mon Nov 09 2009 Ingvar Hagelund - 2.0.5-1 -- New upstream release - -* Thu Aug 13 2009 Ingvar Hagelund - 2.0.4-4 -- Added a sparc specific patch to libjemalloc. - -* Sun Jul 26 2009 Fedora Release Engineering - 2.0.4-3 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild - -* Thu Jun 04 2009 Ingvar Hagelund - 2.0.4-2 -- Added a s390 specific patch to libjemalloc. - -* Fri Mar 27 2009 Ingvar Hagelund - 2.0.4-1 - New upstream release 2.0.4 - -* Wed Feb 25 2009 Fedora Release Engineering - 2.0.3-2 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Wed Feb 11 2009 Ingvar Hagelund - 2.0.3-1 - New upstream release 2.0.3. A bugfix and feature enhancement release - -* Fri Dec 12 2008 Ingvar Hagelund - 2.0.2-2 - Added a fix for a timeout bug, backported from trunk - -* Mon Nov 10 2008 Ingvar Hagelund - 2.0.2-1 - New upstream release 2.0.2. A bugfix release - -* Sun Nov 02 2008 Ingvar Hagelund - 2.0.1-2 -- Removed the requirement for kernel => 2.6.0. All supported - platforms meets this, and it generates strange errors in EPEL - -* Fri Oct 17 2008 Ingvar Hagelund - 2.0.1-1 -- 2.0.1 released, a bugfix release. New upstream sources -- Package now also available in EPEL - -* Thu Oct 16 2008 Ingvar Hagelund - 2.0-2 -- Readded the debugflag patch. It's so practical -- Added a strange workaround for make check on ppc64 - -* Wed Oct 15 2008 Ingvar Hagelund - 2.0-1 -- 2.0 released. New upstream sources -- Disabled jemalloc on ppc and ppc64. Added a note in README.redhat -- Synced to upstream again. No more patches needed - -* Wed Oct 08 2008 Ingvar Hagelund - 2.0-0.11.rc1 -- 2.0-rc1 released. New upstream sources -- Added a patch for pagesize to match redhat's rhel5 ppc64 koji build boxes -- Added a patch for test a00008, from r3269 -- Removed condrestart in postscript at upgrade. We don't want that - -* Fri Sep 26 2008 Ingvar Hagelund - 2.0-0.10.beta2 -- 2.0-beta2 released. New upstream sources -- Whitespace changes to make rpmlint more happy - -* Fri Sep 12 2008 Ingvar Hagelund - 2.0-0.9.20080912svn3184 -- Added varnisncsa init script (Colin Hill) -- Corrected varnishlog init script (Colin Hill) - -* Tue Sep 09 2008 Ingvar Hagelund - 2.0-0.8.beta1 -- Added a patch from r3171 that fixes an endian bug on ppc and ppc64 -- Added a hack that changes the varnishtest ports for 64bits builds, - so they can run in parallell with 32bits build on same build host - -* Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.7.beta1 -- Added a patch from r3156 and r3157, hiding a legit errno in make check - -* Tue Sep 02 2008 Ingvar Hagelund - 2.0-0.6.beta1 -- Added a commented option for max coresize in the sysconfig script -- Added a comment in README.redhat about upgrading from 1.x to 2.0 - -* Fri Aug 29 2008 Ingvar Hagelund - 2.0-0.5.beta1 -- Bumped version numbers and source url for first beta release \o/ -- Added a missing directory to the libs-devel package (Michael Schwendt) -- Added the LICENSE file to the libs-devel package -- Moved make check to its proper place -- Removed superfluous definition of lockfile in initscripts - -* Wed Aug 27 2008 Ingvar Hagelund - 2.0-0.4.20080827svn3136 -- Fixed up init script for varnishlog too - -* Mon Aug 25 2008 Ingvar Hagelund - 2.0-0.3.20080825svn3125 -- Fixing up init script according to newer Fedora standards -- The build now runs the test suite after compiling -- Requires initscripts -- Change default.vcl from nothing but comments to point to localhost:80, - -* Mon Aug 18 2008 Ingvar Hagelund - 2.0-0.2.tp2 -- Changed source, version and release to match 2.0-tp2 - -* Thu Aug 14 2008 Ingvar Hagelund - 2.0-0.1.20080814svn -- default.vcl has moved -- Added groff to build requirements - -* Tue Feb 19 2008 Fedora Release Engineering - 1.1.2-6 -- Autorebuild for GCC 4.3 - -* Sat Dec 29 2007 Ingvar Hagelund - 1.1.2-5 -- Added missing configuration examples -- Corrected the license to "BSD" - -* Fri Dec 28 2007 Ingvar Hagelund - 1.1.2-4 -- Build for fedora update - -* Fri Dec 28 2007 Ingvar Hagelund - 1.1.2-2 -- Added missing changelog items - -* Thu Dec 20 2007 Stig Sandbeck Mathisen - 1.1.2-1 -- Bumped the version number to 1.1.2. -- Addeed build dependency on libxslt - -* Fri Sep 07 2007 Ingvar Hagelund - 1.1.1-3 -- Added a patch, changeset 1913 from svn trunk. This makes varnish - more stable under specific loads. - -* Thu Sep 06 2007 Ingvar Hagelund - 1.1.1-2 -- Removed autogen call (only diff from relase tarball) - -* Mon Aug 20 2007 Ingvar Hagelund - 1.1.1-1 -- Bumped the version number to 1.1.1. - -* Tue Aug 14 2007 Ingvar Hagelund - 1.1.svn -- Update for 1.1 branch -- Added the devel package for the header files and static library files -- Added a varnish user, and fixed the init script accordingly - -* Thu Jul 05 2007 Dag-Erling Sm?rgrav - 1.1-1 -- Bump Version and Release for 1.1 - -* Mon May 28 2007 Ingvar Hagelund - 1.0.4-3 -- Fixed initrc-script bug only visible on el4 (fixes #107) - -* Sun May 20 2007 Ingvar Hagelund - 1.0.4-2 -- Repack from unchanged 1.0.4 tarball -- Final review request and CVS request for Fedora Extras -- Repack with extra obsoletes for upgrading from older sf.net package - -* Fri May 18 2007 Dag-Erling Sm?rgrav - 1.0.4-1 -- Bump Version and Release for 1.0.4 - -* Wed May 16 2007 Ingvar Hagelund - 1.0.svn-20070517 -- Wrapping up for 1.0.4 -- Changes in sysconfig and init scripts. Syncing with files in - trunk/debian - -* Fri May 11 2007 Ingvar Hagelund - 1.0.svn-20070511 -- Threw latest changes into svn trunk -- Removed the conversion of manpages into utf8. They are all utf8 in trunk - -* Wed May 09 2007 Ingvar Hagelund - 1.0.3-7 -- Simplified the references to the subpackage names -- Added init and logrotate scripts for varnishlog - -* Mon Apr 23 2007 Ingvar Hagelund - 1.0.3-6 -- Removed unnecessary macro lib_name -- Fixed inconsistently use of brackets in macros -- Added a condrestart to the initscript -- All manfiles included, not just the compressed ones -- Removed explicit requirement for ncurses. rpmbuild figures out the - correct deps by itself. -- Added ulimit value to initskript and sysconfig file -- Many thanks to Matthias Saou for valuable input - -* Mon Apr 16 2007 Ingvar Hagelund - 1.0.3-5 -- Added the dist tag -- Exchanged RPM_BUILD_ROOT variable for buildroot macro -- Removed stripping of binaries to create a meaningful debug package -- Removed BuildRoot and URL from subpackages, they are picked from the - main package -- Removed duplication of documentation files in the subpackages -- 'chkconfig --list' removed from post script -- Package now includes _sysconfdir/varnish/ -- Trimmed package information -- Removed static libs and .so-symlinks. They can be added to a -devel package - later if anybody misses them - -* Wed Feb 28 2007 Ingvar Hagelund - 1.0.3-4 -- More small specfile fixes for Fedora Extras Package - Review Request, see bugzilla ticket 230275 -- Removed rpath (only visible on x86_64 and probably ppc64) - -* Tue Feb 27 2007 Ingvar Hagelund - 1.0.3-3 -- Made post-1.0.3 changes into a patch to the upstream tarball -- First Fedora Extras Package Review Request - -* Fri Feb 23 2007 Ingvar Hagelund - 1.0.3-2 -- A few other small changes to make rpmlint happy - -* Thu Feb 22 2007 Ingvar Hagelund - 1.0.3-1 -- New release 1.0.3. See the general ChangeLog -- Splitted the package into varnish, libvarnish1 and - libvarnish1-devel - -* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-7 -- Added a Vendor tag - -* Thu Oct 19 2006 Ingvar Hagelund - 1.0.2-6 -- Added redhat subdir to svn -- Removed default vcl config file. Used the new upstream variant instead. -- Based build on svn. Running autogen.sh as start of build. Also added - libtool, autoconf and automake to BuildRequires. -- Removed rule to move varnishd to sbin. This is now fixed in upstream -- Changed the sysconfig script to include a lot more nice features. - Most of these were ripped from the Debian package. Updated initscript - to reflect this. - -* Tue Oct 10 2006 Ingvar Hagelund - 1.0.1-3 -- Moved Red Hat specific files to its own subdirectory - -* Tue Sep 26 2006 Ingvar Hagelund - 1.0.1-2 -- Added gcc requirement. -- Changed to an even simpler example vcl in to /etc/varnish (thanks, perbu) -- Added a sysconfig entry - -* Fri Sep 22 2006 Ingvar Hagelund - 1.0.1-1 -- Initial build. diff --git a/redhat/varnish.sysconfig b/redhat/varnish.sysconfig deleted file mode 100644 index 6aa2354..0000000 --- a/redhat/varnish.sysconfig +++ /dev/null @@ -1,111 +0,0 @@ -# Configuration file for varnish -# -# /etc/init.d/varnish expects the variable $DAEMON_OPTS to be set from this -# shell script fragment. -# - -# Maximum number of open files (for ulimit -n) -NFILES=131072 - -# Locked shared memory (for ulimit -l) -# Default log size is 82MB + header -MEMLOCK=82000 - -# Maximum number of threads (for ulimit -u) -NPROCS="unlimited" - -# Maximum size of corefile (for ulimit -c). Default in Fedora is 0 -# DAEMON_COREFILE_LIMIT="unlimited" - -# Set this to 1 to make init script reload try to switch vcl without restart. -# To make this work, you need to set the following variables -# explicit: VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_ADDRESS, -# VARNISH_ADMIN_LISTEN_PORT, VARNISH_SECRET_FILE, or in short, -# use Alternative 3, Advanced configuration, below -RELOAD_VCL=1 - -# This file contains 4 alternatives, please use only one. - -## Alternative 1, Minimal configuration, no VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# content server on localhost:8080. Use a fixed-size cache file. -# -#DAEMON_OPTS="-a :6081 \ -# -T localhost:6082 \ -# -b localhost:8080 \ -# -u varnish -g varnish \ -# -s file,/var/lib/varnish/varnish_storage.bin,1G" - - -## Alternative 2, Configuration with VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# one content server selected by the vcl file, based on the request. Use a -# fixed-size cache file. -# -#DAEMON_OPTS="-a :6081 \ -# -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" - - -## Alternative 3, Advanced configuration -# -# See varnishd(1) for more information. -# -# # Main configuration file. You probably want to change it :) -VARNISH_VCL_CONF=/etc/varnish/default.vcl -# -# # Default address and port to bind to -# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify -# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. -# VARNISH_LISTEN_ADDRESS= -VARNISH_LISTEN_PORT=6081 -# -# # Telnet admin interface listen address and port -VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -VARNISH_ADMIN_LISTEN_PORT=6082 -# -# # Shared secret file for admin interface -VARNISH_SECRET_FILE=/etc/varnish/secret -# -# # The minimum number of worker threads to start -VARNISH_MIN_THREADS=50 -# -# # The Maximum number of worker threads to start -VARNISH_MAX_THREADS=1000 -# -# # Idle timeout for worker threads -VARNISH_THREAD_TIMEOUT=120 -# -# # Cache file size: in bytes, optionally using k / M / G / T suffix, -# # or in percentage of available disk space using the % suffix. -VARNISH_STORAGE_SIZE=256M -# -# # Backend storage specification -VARNISH_STORAGE="malloc,${VARNISH_STORAGE_SIZE}" -# -# # Default TTL used when the backend does not specify one -VARNISH_TTL=120 -# -# # DAEMON_OPTS is used by the init script. If you add or remove options, make -# # sure you update this section, too. -DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ - -f ${VARNISH_VCL_CONF} \ - -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ - -t ${VARNISH_TTL} \ - -p thread_pool_min=${VARNISH_MIN_THREADS} \ - -p thread_pool_max=${VARNISH_MAX_THREADS} \ - -p thread_pool_timeout=${VARNISH_THREAD_TIMEOUT} \ - -u varnish -g varnish \ - -S ${VARNISH_SECRET_FILE} \ - -s ${VARNISH_STORAGE}" -# - - -## Alternative 4, Do It Yourself. See varnishd(1) for more information. -# -# DAEMON_OPTS="" diff --git a/redhat/varnish_reload_vcl b/redhat/varnish_reload_vcl deleted file mode 100755 index 2f47f3e..0000000 --- a/redhat/varnish_reload_vcl +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/bash -# -# reload vcl revisited -# A script that loads new vcl based on data from /etc/sysconfig/varnish -# Ingvar Hagelund -# -# This is free software, distributed under the standard 2 clause BSD license, -# see the LICENSE file in the Varnish documentation directory -# -# The following environment variables have to be set: -# RELOAD_VCL, VARNISH_VCL_CONF, VARNISH_ADMIN_LISTEN_PORT -# The following are optional: -# VARNISH_SECRET_FILE, VARNISH_ADMIN_LISTEN_ADDRESS -# -# Requires GNU bash and GNU date -# - -debug=false - -missing() { - echo "Missing configuration variable: $1" - exit 2 -} - -print_debug() { - echo " -Parsed configuration: -RELOAD_VCL=\"$RELOAD_VCL\" -VARNISH_VCL_CONF=\"$VARNISH_VCL_CONF\" -VARNISH_ADMIN_LISTEN_ADDRESS=\"$VARNISH_ADMIN_LISTEN_ADDRESS\" -VARNISH_ADMIN_LISTEN_PORT=\"$VARNISH_ADMIN_LISTEN_PORT\" -VARNISH_SECRET_FILE=\"$VARNISH_SECRET_FILE\" -" -} - -# Fallback to the default configuration -if [ -z "$VARNISH_VCL_CONF" ]; then - . /etc/sysconfig/varnish -fi - -$debug && print_debug - -# Check configuration -if [ ! "$RELOAD_VCL" = "1" ]; then - echo "Error: RELOAD_VCL is not set to 1" - exit 2 - -elif [ -z "$VARNISH_VCL_CONF" ]; then - echo "Error: VARNISH_VCL_CONF is not set" - exit 2 - -elif [ ! -s "$VARNISH_VCL_CONF" ]; then - echo "Eror: VCL config $VARNISH_VCL_CONF is unreadable or empty" - exit 2 - -elif [ -z "$VARNISH_ADMIN_LISTEN_ADDRESS" ]; then - echo "Warning: VARNISH_ADMIN_LISTEN_ADDRESS is not set, using 127.0.0.1" - VARNISH_ADMIN_LISTEN_ADDRESS="127.0.0.1" - -elif [ -z "$VARNISH_ADMIN_LISTEN_PORT" ]; then - echo "Error: VARNISH_ADMIN_LISTEN_PORT is not set" - exit 2 - -elif [ -z "$VARNISH_SECRET_FILE" ]; then - echo "Warning: VARNISH_SECRET_FILE is not set" - secret="" - -elif [ ! -s "$VARNISH_SECRET_FILE" ]; then - echo "Error: varnish secret file $VARNISH_SECRET_FILE is unreadable or empty" - exit 2 -else - secret="-S $VARNISH_SECRET_FILE" -fi - -# Done parsing, set up command -VARNISHADM="varnishadm $secret -T $VARNISH_ADMIN_LISTEN_ADDRESS:$VARNISH_ADMIN_LISTEN_PORT" - -# Now do the real work -new_config="reload_$(date +%FT%H:%M:%S)" - -# Check if we are able to connect at all -if $VARNISHADM vcl.list > /dev/null; then - $debug && echo vcl.list succeeded -else - echo "Unable to run $VARNISHADM vcl.list" - exit 1 -fi - -if $VARNISHADM vcl.list | awk ' { print $3 } ' | grep -q $new_config; then - echo Trying to use new config $new_config, but that is already in use - exit 2 -fi - -current_config=$( $VARNISHADM vcl.list | awk ' /^active/ { print $3 } ' ) - -echo "Loading vcl from $VARNISH_VCL_CONF" -echo "Current running config name is $current_config" -echo "Using new config name $new_config" - -if $VARNISHADM vcl.load $new_config $VARNISH_VCL_CONF; then - $debug && echo "$VARNISHADM vcl.load succeded" -else - echo "$VARNISHADM vcl.load failed" - exit 1 -fi - -if $VARNISHADM vcl.use $new_config; then - $debug && echo "$VARNISHADM vcl.use succeded" -else - echo "$VARNISHADM vcl.use failed" - exit 1 -fi -$VARNISHADM vcl.list -echo Done -exit 0 - diff --git a/redhat/varnishlog.initrc b/redhat/varnishlog.initrc deleted file mode 100644 index 2b5fc51..0000000 --- a/redhat/varnishlog.initrc +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -# -# varnishlog Control the Varnish logging daemon -# -# chkconfig: - 90 10 -# description: Varnish Cache logging daemon -# processname: varnishlog -# config: -# pidfile: /var/run/varnishlog.pid - -### BEGIN INIT INFO -# Provides: varnishlog -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Short-Description: start and stop varnishlog -# Description: Varnish Cache logging daemon -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile="/var/run/varnishlog.pid" -lockfile="/var/lock/subsys/varnishlog" -logfile="/var/log/varnish/varnish.log" - -exec="/usr/bin/varnishlog" -prog="varnishlog" - -DAEMON_OPTS="-a -w $logfile -D -P $pidfile" - -# Include varnishlog defaults -[ -e /etc/sysconfig/varnishlog ] && . /etc/sysconfig/varnishlog - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - echo -n "Starting varnish logging daemon: " - - daemon --pidfile $pidfile $exec "$DAEMON_OPTS" - echo - return $retval -} - -stop() { - echo -n "Stopping varnish logging daemon: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnishlog.service b/redhat/varnishlog.service deleted file mode 100644 index c7a0193..0000000 --- a/redhat/varnishlog.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Varnish HTTP accelerator logging daemon -After=varnish.service - -[Service] -Type=forking -PIDFile=/run/varnishlog.pid -ExecStart=/usr/bin/varnishlog -a -w /var/log/varnish/varnish.log -D -P /run/varnishlog.pid - -[Install] -WantedBy=multi-user.target diff --git a/redhat/varnishncsa.initrc b/redhat/varnishncsa.initrc deleted file mode 100644 index b23fa48..0000000 --- a/redhat/varnishncsa.initrc +++ /dev/null @@ -1,116 +0,0 @@ -#! /bin/sh -# -# varnishncsa Control the Varnish NCSA logging daemon -# -# chkconfig: - 90 10 -# description: Varnish Cache logging daemon -# processname: varnishncsa -# config: -# pidfile: /var/run/varnishncsa.pid - -### BEGIN INIT INFO -# Provides: varnishncsa -# Required-Start: $network $local_fs $remote_fs -# Required-Stop: $network $local_fs $remote_fs -# Default-Start: -# Default-Stop: -# Short-Description: start and stop varnishncsa -# Description: Varnish Cache NCSA logging daemon -### END INIT INFO - -# Source function library. -. /etc/init.d/functions - -retval=0 -pidfile="/var/run/varnishncsa.pid" -lockfile="/var/lock/subsys/varnishncsa" -logfile="/var/log/varnish/varnishncsa.log" - -exec="/usr/bin/varnishncsa" -prog="varnishncsa" - -DAEMON_OPTS="-a -w $logfile -D -P $pidfile" - -# Include varnishncsa defaults -[ -e /etc/sysconfig/varnishncsa ] && . /etc/sysconfig/varnishncsa - -start() { - - if [ ! -x $exec ] - then - echo $exec not found - exit 5 - fi - - echo -n "Starting varnish ncsa logging daemon: " - - daemon --pidfile $pidfile $exec "$DAEMON_OPTS" - echo - return $retval -} - -stop() { - echo -n "Stopping varnish ncsa logging daemon: " - killproc -p $pidfile $prog - retval=$? - echo - [ $retval -eq 0 ] && rm -f $lockfile - return $retval -} - -restart() { - stop - start -} - -reload() { - restart -} - -force_reload() { - restart -} - -rh_status() { - status -p $pidfile $prog -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - $1 - ;; - stop) - rh_status_q || exit 0 - $1 - ;; - restart) - $1 - ;; - reload) - rh_status_q || exit 7 - $1 - ;; - force-reload) - force_reload - ;; - status) - rh_status - ;; - condrestart|try-restart) - rh_status_q || exit 0 - restart - ;; - *) - echo "Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - - exit 2 -esac - -exit $? - diff --git a/redhat/varnishncsa.service b/redhat/varnishncsa.service deleted file mode 100644 index e2ebdcd..0000000 --- a/redhat/varnishncsa.service +++ /dev/null @@ -1,11 +0,0 @@ -[Unit] -Description=Varnish HTTP accelerator NCSA daemon -After=varnish.service - -[Service] -Type=forking -PIDFile=/run/varnishncsa.pid -ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa.pid - -[Install] -WantedBy=multi-user.target From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 7ba6b84 Remove last traces of redhat packaging files. Message-ID: commit 7ba6b842ee813ad738c9231414d727b2f959a6bc Author: Lasse Karstensen Date: Fri Sep 4 11:59:05 2015 +0200 Remove last traces of redhat packaging files. diff --git a/Makefile.am b/Makefile.am index 7624ec5..e49505f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,6 +1,6 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = include lib bin etc doc man redhat +SUBDIRS = include lib bin etc doc man pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = varnishapi.pc @@ -20,15 +20,6 @@ DISTCHECK_CONFIGURE_FLAGS = \ install-data-local: $(install_sh) -d -m 0755 $(DESTDIR)$(localstatedir)/varnish -distcheck-hook: - V="@PACKAGE_VERSION@" ; \ - V="$${V%%-*}" ; \ - if ! grep "^Version: $$V$$" $(top_distdir)/redhat/varnish.spec && \ - [ "@PACKAGE_VERSION@" != "trunk" ]; then \ - echo "$$V" ; \ - echo "redhat/varnish.spec does not have a version number matching the package" ; \ - exit 1 ; \ - fi distcleancheck_listfiles = \ find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \ diff --git a/configure.ac b/configure.ac index 6c4d5f2..48af690 100644 --- a/configure.ac +++ b/configure.ac @@ -658,7 +658,6 @@ AC_CONFIG_FILES([ lib/libvmod_std/Makefile lib/libvmod_directors/Makefile man/Makefile - redhat/Makefile varnishapi.pc varnishapi-uninstalled.pc ]) From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 23b1979 Merge branch 'master' into 4.1 Message-ID: commit 23b197969a6c1ddd9ac45d687af1a1b55b8d3e01 Merge: edf4762 7ba6b84 Author: Lasse Karstensen Date: Fri Sep 4 15:41:09 2015 +0200 Merge branch 'master' into 4.1 Conflicts: redhat/varnish.spec From lkarsten at varnish-software.com Fri Sep 4 13:54:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Sep 2015 15:54:56 +0200 Subject: [4.1] 860bb1d Nudge us along towards -beta1. Message-ID: commit 860bb1db934c445ba77df3dca9b16630c7efe7fb Author: Lasse Karstensen Date: Fri Sep 4 15:47:37 2015 +0200 Nudge us along towards -beta1. diff --git a/configure.ac b/configure.ac index 9981df1..1963a97 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2014 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [4.1.0-tp1], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.1.0-beta1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/doc/changes.rst b/doc/changes.rst index 745d1bc..3f7950f 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,9 +1,26 @@ +====================================== +Varnish Cache 4.1.0-beta1 (unreleased) +====================================== + +- Redhat packaging files are now separate from the normal tree. + +- Client workspace overflow should now result in a 500 response + instead of panic. + +- [varnishstat] -w option has been retired. + +Bugs fixed +---------- + +- 1777_ - Disable speculative Range handling on streaming transactions. + +.. _1777: https://www.varnish-cache.org/trac/ticket/1777 + + ==================================== -Varnish Cache 4.1.0-dev (unreleased) +Varnish Cache 4.1.0-tp1 (2015-07-08) ==================================== -This is a placeholder entry for the upcoming 4.1.0 prereleases. - Changes between 4.0 and 4.1 are numerous. Please read the upgrade section in the documentation for a general overview. From phk at FreeBSD.org Mon Sep 7 09:06:12 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 11:06:12 +0200 Subject: [master] b9a9c5d Removing confusing, non-effective permissions Message-ID: commit b9a9c5d0a06d1ea37ae16854e2c59570d3ae4e4c Author: Poul-Henning Kamp Date: Tue Sep 1 12:14:22 2015 +0000 Removing confusing, non-effective permissions diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c index 89a7935..1afcfbf 100644 --- a/bin/varnishd/mgt/mgt_shmem.c +++ b/bin/varnishd/mgt/mgt_shmem.c @@ -104,7 +104,7 @@ vsm_n_check(void) struct VSM_head vsmh; int retval = 1; - fd = open(VSM_FILENAME, O_RDWR, 0644); + fd = open(VSM_FILENAME, O_RDWR); if (fd < 0) return (0); From phk at FreeBSD.org Mon Sep 7 09:06:12 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 11:06:12 +0200 Subject: [master] e79fce2 White-space OCD Message-ID: commit e79fce21c8d175935f103750a17095424e831b02 Author: Poul-Henning Kamp Date: Mon Sep 7 08:59:51 2015 +0000 White-space OCD diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 5d4e4f2..21fc961 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -61,10 +61,10 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, static void v1d_error(struct req *req, const char *msg) { - static const char r_500[] = - "HTTP/1.1 500 Internal Server Error\r\n" - "Server: Varnish\r\n" - "Connection: close\r\n\r\n"; + static const char r_500[] = + "HTTP/1.1 500 Internal Server Error\r\n" + "Server: Varnish\r\n" + "Connection: close\r\n\r\n"; VSLb(req->vsl, SLT_Error, "%s", msg); VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); @@ -122,7 +122,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); - if (WS_Overflowed(req->ws)) { + if (WS_Overflowed(req->ws)) { v1d_error(req, "workspace_client overflow"); return; } From phk at FreeBSD.org Mon Sep 7 09:06:12 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 11:06:12 +0200 Subject: [master] 28a648f Give the "topline" header-id's a length-field in HTTPHdrPack. Message-ID: commit 28a648f6c3c1d87e23f5524793e18f6124f5ad73 Author: Poul-Henning Kamp Date: Mon Sep 7 09:04:56 2015 +0000 Give the "topline" header-id's a length-field in HTTPHdrPack. Patch by: martin (slightly polished) diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 648dad4..9461429 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -845,6 +845,9 @@ unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*); #define HTTPH(a, b, c) extern char b[]; #include "tbl/http_headers.h" #undef HTTPH +extern const char H__Status[]; +extern const char H__Proto[]; +extern const char H__Reason[]; /* cache_main.c */ #define VXID(u) ((u) & VSL_IDENTMASK) diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 699bcf5..fd596f7 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -857,7 +857,7 @@ ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc, arg1 = HTTP_GetHdrPack(wrk, oc, bt.arg1_spec); break; case BANS_ARG_OBJSTATUS: - arg1 = HTTP_GetHdrPack(wrk, oc, ":status"); + arg1 = HTTP_GetHdrPack(wrk, oc, H__Status); break; default: WRONG("Wrong BAN_ARG code"); diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index e832992..fac57cc 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -44,6 +44,10 @@ #include "tbl/http_headers.h" #undef HTTPH +const char H__Status[] = "\010:status:"; +const char H__Proto[] = "\007:proto:"; +const char H__Reason[] = "\010:reason:"; + /*-------------------------------------------------------------------- * These two functions are in an incestous relationship with the * order of macros in include/tbl/vsl_tags_http.h @@ -901,6 +905,12 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(hdr); + l = hdr[0]; + assert(l > 0); + assert(l == strlen(hdr + 1)); + assert(hdr[l] == ':'); + hdr++; + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); @@ -909,21 +919,16 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto")) + if (!strcmp(hdr, ":proto:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status")) + if (!strcmp(hdr, ":status:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason")) + if (!strcmp(hdr, ":reason:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - l = hdr[0]; - assert(l == strlen(hdr + 1)); - assert(hdr[l] == ':'); - hdr++; - while (*ptr != '\0') { if (!strncasecmp(ptr, hdr, l)) { ptr += l; diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index cc302c5..c51007b 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -157,7 +157,7 @@ VRT_r_obj_proto(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":proto")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Proto)); } const char * @@ -167,7 +167,7 @@ VRT_r_obj_reason(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":reason")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Reason)); } /*-------------------------------------------------------------------- From phk at FreeBSD.org Mon Sep 7 09:49:28 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 11:49:28 +0200 Subject: [master] 65e64b7 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Message-ID: commit 65e64b741bd56da8241e65bc419da7f49f9e0ad0 Author: Poul-Henning Kamp Date: Mon Sep 7 09:48:39 2015 +0000 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Patch by: martin Some rework by: phk diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 9461429..7c8411a 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -831,8 +831,10 @@ void http_CollectHdr(struct http *hp, const char *hdr); void http_VSL_log(const struct http *hp); void HTTP_Merge(struct worker *, struct objcore *, struct http *to); uint16_t HTTP_GetStatusPack(struct worker *, struct objcore *oc); -const char *HTTP_GetHdrPack(struct worker *, struct objcore *, - const char *hdr); +int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **); +#define HTTP_FOREACH_PACK(wrk, oc, ptr) \ + for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));) +const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr); enum sess_close http_DoConnection(struct http *hp); /* cache_http1_proto.c */ diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index fac57cc..9080641 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -806,6 +806,11 @@ http_EstimateWS(const struct http *fm, unsigned how) /*-------------------------------------------------------------------- * Encode http struct as byte string. + * + * XXX: We could save considerable special-casing below by encoding also + * XXX: H__Status, H__Reason and H__Proto into the string, but it would + * XXX: add 26-30 bytes to all encoded objects to save a little code. + * XXX: It could possibly be a good idea for later HTTP versions. */ void @@ -895,6 +900,32 @@ HTTP_GetStatusPack(struct worker *wrk, struct objcore *oc) /*--------------------------------------------------------------------*/ +/* Get the first packed header */ +int +HTTP_IterHdrPack(struct worker *wrk, struct objcore *oc, const char **p) +{ + const char *ptr; + + CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(p); + + if (*p == NULL) { + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ + ptr = strchr(ptr, '\0') + 1; /* Skip :proto: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :status: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :reason: */ + *p = ptr; + } else { + *p = strchr(*p, '\0') + 1; /* Skip to next header */ + } + if (**p == '\0') + return (0); + return (1); +} + const char * HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) { @@ -911,33 +942,32 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) assert(hdr[l] == ':'); hdr++; - ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); - AN(ptr); + if (hdr[0] == ':') { + /* Special cases */ + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ - /* Skip nhd and status */ - ptr += 4; - VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); - - /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":proto:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":status:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":reason:")) + return (ptr); + WRONG("Unknown magic packed header"); + } - while (*ptr != '\0') { + HTTP_FOREACH_PACK(wrk, oc, ptr) { if (!strncasecmp(ptr, hdr, l)) { ptr += l; while (vct_islws(*ptr)) ptr++; return (ptr); } - ptr = strchr(ptr, '\0') + 1; } + return (NULL); } From phk at FreeBSD.org Mon Sep 7 10:06:56 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 12:06:56 +0200 Subject: [master] b999dba add coverage for obj.status Message-ID: commit b999dba2308474d2ac70c2d644a753bc6ab3bf4f Author: Poul-Henning Kamp Date: Mon Sep 7 10:06:41 2015 +0000 add coverage for obj.status diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc index fbb0fb8..02788d4 100644 --- a/bin/varnishtest/tests/v00025.vtc +++ b/bin/varnishtest/tests/v00025.vtc @@ -42,6 +42,7 @@ varnish v1 -arg "-i J.F.Nobody" -vcl+backend { } sub vcl_hit { + if (obj.status != 200) { return(synth(700)); } if (obj.proto) { } if (obj.reason) { } if (obj.keep > 1m) { } From phk at FreeBSD.org Mon Sep 7 12:46:45 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 07 Sep 2015 14:46:45 +0200 Subject: [master] 57baf76 Start sequestering our truly private bits into cache_priv.h which VMODs should never, ever, see. Message-ID: commit 57baf76f48f10443f079ef3b045fd17adbd39680 Author: Poul-Henning Kamp Date: Mon Sep 7 12:46:10 2015 +0000 Start sequestering our truly private bits into cache_priv.h which VMODs should never, ever, see. diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index dd2bae2..e4d2ab5 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -101,6 +101,7 @@ noinst_HEADERS = \ builtin_vcl.h \ cache/cache_esi.h \ cache/cache_pool.h \ + cache/cache_priv.h \ common/heritage.h \ hash/hash_slinger.h \ http1/cache_http1.h \ @@ -124,6 +125,7 @@ nobase_pkginclude_HEADERS = \ varnishd_CFLAGS = \ @PCRE_CFLAGS@ \ + -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVARNISH_VMOD_DIR='"${pkglibdir}/vmods"' \ -DVARNISH_VCL_DIR='"${varnishconfdir}"' diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 7c8411a..742f89e 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -648,46 +648,18 @@ struct sess { }; -/*-------------------------------------------------------------------- - * A transport is how we talk HTTP for a given request. - * This is different from a protocol because ESI child requests have - * their own "protocol" to talk to the parent ESI request, which may - * or may not, be talking a "real" HTTP protocol itself. - */ - -typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); - -struct transport { - unsigned magic; -#define TRANSPORT_MAGIC 0xf157f32f - vtr_deliver_f *deliver; -}; - /* Prototypes etc ----------------------------------------------------*/ /* Cross file typedefs */ typedef enum htc_status_e htc_complete_f(struct http_conn *); -/* cache_acceptor.c */ -void VCA_Init(void); -void VCA_Shutdown(void); - -/* cache_backend_cfg.c */ -void VBE_InitCfg(void); -void VBE_Poll(void); - -/* cache_backend_poll.c */ -void VBP_Init(void); - /* cache_ban.c */ struct ban *BAN_New(void); int BAN_AddTest(struct ban *, const char *, const char *, const char *); void BAN_Free(struct ban *b); char *BAN_Insert(struct ban *b); void BAN_Free_Errormsg(char *); -void BAN_Init(void); -void BAN_Shutdown(void); void BAN_NewObjCore(struct objcore *oc); void BAN_DestroyObj(struct objcore *oc); int BAN_CheckObject(struct worker *, struct objcore *, struct req *); @@ -699,7 +671,6 @@ void BAN_TailDeref(struct ban **ban); double BAN_Time(const struct ban *ban); /* cache_busyobj.c */ -void VBO_Init(void); struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *); void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj); void VBO_extend(struct busyobj *, ssize_t); @@ -719,9 +690,6 @@ enum req_fsm_nxt CNT_Request(struct worker *, struct req *); void CNT_AcctLogCharge(struct dstat *, struct req *); /* cache_cli.c [CLI] */ -void CLI_Init(void); -void CLI_Run(void); -void CLI_AddFuncs(struct cli_proto *p); extern pthread_t cli_thread; #define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0) @@ -732,7 +700,6 @@ double EXP_Ttl(const struct req *, const struct exp*); double EXP_When(const struct exp *exp); void EXP_Insert(struct worker *wrk, struct objcore *oc); void EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru); -void EXP_Init(void); void EXP_Rearm(struct objcore *, double now, double ttl, double grace, double keep); void EXP_Touch(struct objcore *oc, double now); @@ -758,9 +725,6 @@ enum vbf_fetch_mode_e { void VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e); -/* cache_fetch_proc.c */ -void VFP_Init(void); - /* cache_gzip.c */ struct vgz; @@ -797,7 +761,6 @@ void HTTP_Copy(struct http *to, const struct http * const fm); struct http *HTTP_create(void *p, uint16_t nhttp); const char *http_Status2Reason(unsigned); unsigned http_EstimateWS(const struct http *fm, unsigned how); -void HTTP_Init(void); void http_PutResponse(struct http *to, const char *proto, uint16_t status, const char *response); void http_FilterReq(struct http *to, const struct http *fm, unsigned how); @@ -856,12 +819,6 @@ extern const char H__Reason[]; uint32_t VXID_Get(struct worker *, uint32_t marker); extern volatile struct params * cache_param; extern pthread_key_t witness_key; -void THR_SetName(const char *name); -const char* THR_GetName(void); -void THR_SetBusyobj(const struct busyobj *); -struct busyobj * THR_GetBusyobj(void); -void THR_SetRequest(const struct req *); -struct req * THR_GetRequest(void); /* cache_lck.c */ @@ -873,7 +830,6 @@ void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *); void Lck__Assert(const struct lock *lck, int held); /* public interface: */ -void LCK_Init(void); void Lck_Delete(struct lock *lck); int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double); @@ -933,12 +889,10 @@ int ObjCheckFlag(struct worker *, struct objcore *oc, enum obj_flags of); void ObjSetFlag(struct worker *, struct objcore *, enum obj_flags of, int val); /* cache_panic.c */ -void PAN_Init(void); const char *body_status_2str(enum body_status e); const char *sess_close_2str(enum sess_close sc, int want_desc); /* cache_pool.c */ -void Pool_Init(void); int Pool_Task(struct pool *pp, struct pool_task *task, enum task_how how); int Pool_Task_Arg(struct worker *, task_func_t *, const void *arg, size_t arg_len); @@ -947,9 +901,6 @@ int Pool_TrySumstat(struct worker *wrk); void Pool_PurgeStat(unsigned nobj); int Pool_Task_Any(struct pool_task *task, enum task_how how); -/* cache_proxy.c [VPX] */ -task_func_t VPX_Proto_Sess; - /* cache_range.c [VRG] */ void VRG_dorange(struct req *req, const char *r); @@ -997,13 +948,8 @@ const char *SES_Get_String_Attr(const struct sess *sp, enum sess_attr a); /* cache_shmlog.c */ extern struct VSC_C_main *VSC_C_main; -void VSM_Init(void); void *VSM_Alloc(unsigned size, const char *class, const char *type, const char *ident); -void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len); -void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, - uint32_t vxid); -void VSL_End(struct vsl_log *vsl); void VSM_Free(void *ptr); #ifdef VSL_ENDMARKER void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...) @@ -1047,13 +993,8 @@ enum vry_finish_flag { KEEP, DISCARD }; void VRY_Finish(struct req *req, enum vry_finish_flag); /* cache_vcl.c */ -struct director *VCL_DefaultDirector(const struct vcl *); -const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *); -void VCL_Init(void); const char *VCL_Method_Name(unsigned); const char *VCL_Name(const struct vcl *); -void VCL_Panic(struct vsb *, const struct vcl *); -void VCL_Poll(void); void VCL_Ref(struct vcl *); void VCL_Refresh(struct vcl **); void VCL_Rel(struct vcl **); @@ -1073,11 +1014,6 @@ const char *VCL_Return_Name(unsigned); */ const char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap); char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap); -void VRTPRIV_init(struct vrt_privs *privs); -void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id); - -/* cache_vrt_vmod.c */ -void VMOD_Init(void); /* cache_wrk.c */ @@ -1119,10 +1055,6 @@ void STV_close(void); int STV_BanInfo(enum baninfo event, const uint8_t *ban, unsigned len); void STV_BanExport(const uint8_t *bans, unsigned len); -/* storage_persistent.c */ -void SMP_Init(void); -void SMP_Ready(void); - /* * A normal pointer difference is signed, but we never want a negative value * so this little tool will make sure we don't get that. @@ -1183,3 +1115,8 @@ DO_DEBUG(enum debug_bits x) if (DO_DEBUG(debug_bit)) \ VSL(SLT_Debug, (id), __VA_ARGS__); \ } while (0) + +#ifdef VARNISHD_IS_NOT_A_VMOD +# include "cache/cache_priv.h" +#endif + diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h new file mode 100644 index 0000000..8fa4a9a --- /dev/null +++ b/bin/varnishd/cache/cache_priv.h @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2015 Varnish Software 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. + * + * Stuff that should *never* be exposed to a VMOD + */ + +/*-------------------------------------------------------------------- + * A transport is how we talk HTTP for a given request. + * This is different from a protocol because ESI child requests have + * their own "protocol" to talk to the parent ESI request, which may + * or may not, be talking a "real" HTTP protocol itself. + */ + +typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); + +struct transport { + unsigned magic; +#define TRANSPORT_MAGIC 0xf157f32f + vtr_deliver_f *deliver; +}; + +/* Prototypes etc ----------------------------------------------------*/ + +/* cache_acceptor.c */ +void VCA_Init(void); +void VCA_Shutdown(void); + +/* cache_backend_cfg.c */ +void VBE_InitCfg(void); +void VBE_Poll(void); + +/* cache_backend_poll.c */ +void VBP_Init(void); + +/* cache_ban.c */ +void BAN_Init(void); +void BAN_Shutdown(void); + +/* cache_busyobj.c */ +void VBO_Init(void); + +/* cache_cli.c [CLI] */ +void CLI_Init(void); +void CLI_Run(void); +void CLI_AddFuncs(struct cli_proto *p); + +/* cache_expire.c */ +void EXP_Init(void); + +/* cache_fetch_proc.c */ +void VFP_Init(void); + +/* cache_http.c */ +void HTTP_Init(void); + +/* cache_main.c */ +void THR_SetName(const char *name); +const char* THR_GetName(void); +void THR_SetBusyobj(const struct busyobj *); +struct busyobj * THR_GetBusyobj(void); +void THR_SetRequest(const struct req *); +struct req * THR_GetRequest(void); + +/* cache_lck.c */ +void LCK_Init(void); + +/* cache_panic.c */ +void PAN_Init(void); + +/* cache_pool.c */ +void Pool_Init(void); + +/* cache_proxy.c [VPX] */ +task_func_t VPX_Proto_Sess; + +/* cache_shmlog.c */ +void VSM_Init(void); +void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len); +void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, + uint32_t vxid); +void VSL_End(struct vsl_log *vsl); + +/* cache_vcl.c */ +struct director *VCL_DefaultDirector(const struct vcl *); +const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *); +void VCL_Init(void); +void VCL_Panic(struct vsb *, const struct vcl *); +void VCL_Poll(void); + +/* cache_vrt.c */ +void VRTPRIV_init(struct vrt_privs *privs); +void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id); + +/* cache_vrt_vmod.c */ +void VMOD_Init(void); + +/* storage_persistent.c */ +void SMP_Init(void); +void SMP_Ready(void); + diff --git a/bin/varnishd/flint.sh b/bin/varnishd/flint.sh index dfe59c2..f96d0fc 100755 --- a/bin/varnishd/flint.sh +++ b/bin/varnishd/flint.sh @@ -15,6 +15,7 @@ flexelint \ -I../../lib/libvgz \ -I../.. \ -I/usr/local/include \ + -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR=\"foo\" \ -DVARNISH_VMOD_DIR=\"foo\" \ -DVARNISH_VCL_DIR=\"foo\" \ From lkarsten at varnish-software.com Mon Sep 7 12:48:53 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 14:48:53 +0200 Subject: [4.1] cfeb697 HTML docs have moved. Message-ID: commit cfeb6972b5cda7648044d5aaefdeb4a40524a9f9 Author: Lasse Karstensen Date: Mon Sep 7 14:48:50 2015 +0200 HTML docs have moved. diff --git a/varnish-doc.docs b/varnish-doc.docs index f77d301..3e0e276 100644 --- a/varnish-doc.docs +++ b/varnish-doc.docs @@ -1,3 +1,3 @@ -doc/sphinx/build/html +doc/html doc/*.html doc/*.css From martin at varnish-software.com Mon Sep 7 13:41:16 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Mon, 07 Sep 2015 15:41:16 +0200 Subject: [4.1] 6385b5e Give the "topline" header-id's a length-field in HTTPHdrPack. Message-ID: commit 6385b5e7d9348998ba008f35bac27938c6072bd4 Author: Poul-Henning Kamp Date: Mon Sep 7 09:04:56 2015 +0000 Give the "topline" header-id's a length-field in HTTPHdrPack. Patch by: martin (slightly polished) diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 648dad4..9461429 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -845,6 +845,9 @@ unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*); #define HTTPH(a, b, c) extern char b[]; #include "tbl/http_headers.h" #undef HTTPH +extern const char H__Status[]; +extern const char H__Proto[]; +extern const char H__Reason[]; /* cache_main.c */ #define VXID(u) ((u) & VSL_IDENTMASK) diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 699bcf5..fd596f7 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -857,7 +857,7 @@ ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc, arg1 = HTTP_GetHdrPack(wrk, oc, bt.arg1_spec); break; case BANS_ARG_OBJSTATUS: - arg1 = HTTP_GetHdrPack(wrk, oc, ":status"); + arg1 = HTTP_GetHdrPack(wrk, oc, H__Status); break; default: WRONG("Wrong BAN_ARG code"); diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index e832992..fac57cc 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -44,6 +44,10 @@ #include "tbl/http_headers.h" #undef HTTPH +const char H__Status[] = "\010:status:"; +const char H__Proto[] = "\007:proto:"; +const char H__Reason[] = "\010:reason:"; + /*-------------------------------------------------------------------- * These two functions are in an incestous relationship with the * order of macros in include/tbl/vsl_tags_http.h @@ -901,6 +905,12 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(hdr); + l = hdr[0]; + assert(l > 0); + assert(l == strlen(hdr + 1)); + assert(hdr[l] == ':'); + hdr++; + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); @@ -909,21 +919,16 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto")) + if (!strcmp(hdr, ":proto:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status")) + if (!strcmp(hdr, ":status:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason")) + if (!strcmp(hdr, ":reason:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - l = hdr[0]; - assert(l == strlen(hdr + 1)); - assert(hdr[l] == ':'); - hdr++; - while (*ptr != '\0') { if (!strncasecmp(ptr, hdr, l)) { ptr += l; diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index cc302c5..c51007b 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -157,7 +157,7 @@ VRT_r_obj_proto(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":proto")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Proto)); } const char * @@ -167,7 +167,7 @@ VRT_r_obj_reason(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":reason")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Reason)); } /*-------------------------------------------------------------------- From martin at varnish-software.com Mon Sep 7 13:41:16 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Mon, 07 Sep 2015 15:41:16 +0200 Subject: [4.1] 017ec21 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Message-ID: commit 017ec218a4ee2a345f189295934f2d6e19da3a46 Author: Poul-Henning Kamp Date: Mon Sep 7 09:48:39 2015 +0000 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Patch by: martin Some rework by: phk diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 9461429..7c8411a 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -831,8 +831,10 @@ void http_CollectHdr(struct http *hp, const char *hdr); void http_VSL_log(const struct http *hp); void HTTP_Merge(struct worker *, struct objcore *, struct http *to); uint16_t HTTP_GetStatusPack(struct worker *, struct objcore *oc); -const char *HTTP_GetHdrPack(struct worker *, struct objcore *, - const char *hdr); +int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **); +#define HTTP_FOREACH_PACK(wrk, oc, ptr) \ + for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));) +const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr); enum sess_close http_DoConnection(struct http *hp); /* cache_http1_proto.c */ diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index fac57cc..9080641 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -806,6 +806,11 @@ http_EstimateWS(const struct http *fm, unsigned how) /*-------------------------------------------------------------------- * Encode http struct as byte string. + * + * XXX: We could save considerable special-casing below by encoding also + * XXX: H__Status, H__Reason and H__Proto into the string, but it would + * XXX: add 26-30 bytes to all encoded objects to save a little code. + * XXX: It could possibly be a good idea for later HTTP versions. */ void @@ -895,6 +900,32 @@ HTTP_GetStatusPack(struct worker *wrk, struct objcore *oc) /*--------------------------------------------------------------------*/ +/* Get the first packed header */ +int +HTTP_IterHdrPack(struct worker *wrk, struct objcore *oc, const char **p) +{ + const char *ptr; + + CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(p); + + if (*p == NULL) { + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ + ptr = strchr(ptr, '\0') + 1; /* Skip :proto: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :status: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :reason: */ + *p = ptr; + } else { + *p = strchr(*p, '\0') + 1; /* Skip to next header */ + } + if (**p == '\0') + return (0); + return (1); +} + const char * HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) { @@ -911,33 +942,32 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) assert(hdr[l] == ':'); hdr++; - ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); - AN(ptr); + if (hdr[0] == ':') { + /* Special cases */ + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ - /* Skip nhd and status */ - ptr += 4; - VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); - - /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":proto:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":status:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":reason:")) + return (ptr); + WRONG("Unknown magic packed header"); + } - while (*ptr != '\0') { + HTTP_FOREACH_PACK(wrk, oc, ptr) { if (!strncasecmp(ptr, hdr, l)) { ptr += l; while (vct_islws(*ptr)) ptr++; return (ptr); } - ptr = strchr(ptr, '\0') + 1; } + return (NULL); } From lkarsten at varnish-software.com Mon Sep 7 19:57:50 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 21:57:50 +0200 Subject: [4.1] 01ff71c Reduce the init script complexity. Message-ID: commit 01ff71cdc765d23f61c7fad951a80ee36efbaca0 Author: Lasse Karstensen Date: Mon Sep 7 21:29:17 2015 +0200 Reduce the init script complexity. I think we have enough options as it is with Varnish, we don't need another layer of complexity just to stitch together the startup arguments. diff --git a/varnish.default b/varnish.default index a9a063e..f8db015 100644 --- a/varnish.default +++ b/varnish.default @@ -1,4 +1,4 @@ -# Configuration file for varnish +# Configuration file for Varnish Cache. # # /etc/init.d/varnish expects the variables $DAEMON_OPTS, $NFILES and $MEMLOCK # to be set from this shell script fragment. @@ -18,94 +18,9 @@ NFILES=131072 # you need to increase this number as well MEMLOCK=82000 -# Default varnish instance name is the local nodename. Can be overridden with -# the -n switch, to have more instances on a single server. -# INSTANCE=$(uname -n) - -# This file contains 4 alternatives, please use only one. - -## Alternative 1, Minimal configuration, no VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# content server on localhost:8080. Use a 1GB fixed-size cache file. -# -# DAEMON_OPTS="-a :6081 \ -# -T localhost:6082 \ -# -b localhost:8080 \ -# -u varnish -g varnish \ -# -S /etc/varnish/secret \ -# -s file,/var/lib/varnish/$INSTANCE/varnish_storage.bin,1G" - - -## Alternative 2, Configuration with VCL -# -# Listen on port 6081, administration on localhost:6082, and forward to -# one content server selected by the vcl file, based on the request. -# Use a 256MB memory based cache. -# DAEMON_OPTS="-a :6081 \ -T localhost:6082 \ -f /etc/varnish/default.vcl \ -S /etc/varnish/secret \ -s malloc,256m" - -## Alternative 3, Advanced configuration -# -# See varnishd(1) for more information. -# -# # Main configuration file. You probably want to change it :) -# VARNISH_VCL_CONF=/etc/varnish/default.vcl -# -# # Default address and port to bind to -# # Blank address means all IPv4 and IPv6 interfaces, otherwise specify -# # a host name, an IPv4 dotted quad, or an IPv6 address in brackets. -# VARNISH_LISTEN_ADDRESS= -# VARNISH_LISTEN_PORT=6081 -# -# # Telnet admin interface listen address and port -# VARNISH_ADMIN_LISTEN_ADDRESS=127.0.0.1 -# VARNISH_ADMIN_LISTEN_PORT=6082 -# -# # The minimum number of worker threads to start -# VARNISH_MIN_THREADS=1 -# -# # The Maximum number of worker threads to start -# VARNISH_MAX_THREADS=1000 -# -# # Idle timeout for worker threads -# VARNISH_THREAD_TIMEOUT=120 -# -# # Cache file location -# VARNISH_STORAGE_FILE=/var/lib/varnish/$INSTANCE/varnish_storage.bin -# -# # Cache file size: in bytes, optionally using k / M / G / T suffix, -# # or in percentage of available disk space using the % suffix. -# VARNISH_STORAGE_SIZE=1G -# -# # File containing administration secret -# VARNISH_SECRET_FILE=/etc/varnish/secret -# -# # Backend storage specification -# VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}" -# -# # Default TTL used when the backend does not specify one -# VARNISH_TTL=120 -# -# # DAEMON_OPTS is used by the init script. If you add or remove options, make -# # sure you update this section, too. -# DAEMON_OPTS="-a ${VARNISH_LISTEN_ADDRESS}:${VARNISH_LISTEN_PORT} \ -# -f ${VARNISH_VCL_CONF} \ -# -T ${VARNISH_ADMIN_LISTEN_ADDRESS}:${VARNISH_ADMIN_LISTEN_PORT} \ -# -t ${VARNISH_TTL} \ -# -p thread_pool_min=${VARNISH_MIN_THREADS} \ -# -p thread_pool_max=${VARNISH_MAX_THREADS} \ -# -p thread_pool_timeout=${VARNISH_THREAD_TIMEOUT} \ -# -S ${VARNISH_SECRET_FILE} \ -# -s ${VARNISH_STORAGE}" -# - - -## Alternative 4, Do It Yourself -# -# DAEMON_OPTS="" From lkarsten at varnish-software.com Mon Sep 7 19:57:50 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 21:57:50 +0200 Subject: [4.1] 862c056 There is no quilt here. Message-ID: commit 862c0569e9f80f17a54d33d9257b7163bdbb4346 Author: Lasse Karstensen Date: Mon Sep 7 21:33:20 2015 +0200 There is no quilt here. diff --git a/README.source b/README.source deleted file mode 100644 index 12f96c9..0000000 --- a/README.source +++ /dev/null @@ -1,5 +0,0 @@ -This package uses quilt to manage all modifications to the upstream -source. Changes are stored in the source package as diffs in -debian/patches and applied during the build. - -See /usr/share/doc/quilt/README.source for more information. From lkarsten at varnish-software.com Mon Sep 7 19:57:50 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 21:57:50 +0200 Subject: [4.1] 2b7f570 Remove unused file. Message-ID: commit 2b7f570c7588df79204a0f236a322a6af0c13b03 Author: Lasse Karstensen Date: Mon Sep 7 21:33:54 2015 +0200 Remove unused file. diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index ae80072..0000000 --- a/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ -# $Id: Makefile.am 2173 2007-10-28 18:43:24Z des $ - -EXTRA_DIST = \ - README.Debian \ - changelog \ - compat \ - control \ - copyright \ - libvarnish0-dev.dirs \ - libvarnish0-dev.install \ - libvarnish0.dirs \ - libvarnish0.install \ - lintian-override \ - rules \ - varnish.default \ - varnish.dirs \ - varnish.examples \ - varnish.init \ - varnish.install \ - varnish.logrotate \ - varnish.manpages \ - varnish.postinst \ - varnish.postrm \ - varnish.varnishlog.init \ - watch From lkarsten at varnish-software.com Mon Sep 7 19:57:50 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 21:57:50 +0200 Subject: [4.1] f9baeb5 Be consistent when naming Varnish Cache. Message-ID: commit f9baeb529e15985748adafc42ae0d8a5c5af5733 Author: Lasse Karstensen Date: Mon Sep 7 21:34:48 2015 +0200 Be consistent when naming Varnish Cache. diff --git a/control b/control index e510849..e67a508 100644 --- a/control +++ b/control @@ -59,7 +59,7 @@ Conflicts: libvarnish1 Pre-Depends: multiarch-support Depends: ${shlibs:Depends}, ${misc:Depends} Description: shared libraries for Varnish - Shared libraries for the Varnish HTTP accelerator. + Shared libraries for Varnish Cache HTTP accelerator. Package: libvarnishapi-dev Section: libdevel @@ -68,7 +68,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libvarnishapi1 (= ${binary:Version} Provides: libvarnish-dev Conflicts: libvarnish-dev Description: development files for Varnish - Development files for the Varnish HTTP accelerator. + Development files for Varnish Cache HTTP accelerator. Package: varnish-dbg Section: debug @@ -77,7 +77,7 @@ Architecture: any Depends: varnish (= ${binary:Version}), ${misc:Depends} Description: debugging symbols for varnish - This package contains the detached debugging symbols for varnish. + This package contains the detached debugging symbols for Varnish Cache. . Varnish Cache is a state of the art web accelerator written with performance and flexibility in mind. diff --git a/varnish.service b/varnish.service index 0e2050a..717c9fc 100644 --- a/varnish.service +++ b/varnish.service @@ -1,5 +1,5 @@ [Unit] -Description=Varnish HTTP accelerator +Description=Varnish Cache HTTP accelerator [Service] Type=forking From lkarsten at varnish-software.com Mon Sep 7 19:57:50 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 07 Sep 2015 21:57:50 +0200 Subject: [4.1] 2a89fb9 Output configuration errors to stdout. Message-ID: commit 2a89fb932c600deeabedc2968f10392dd4de735e Author: Lasse Karstensen Date: Mon Sep 7 21:57:18 2015 +0200 Output configuration errors to stdout. If Varnish doesn't like the config, let us do the admin the service of actually telling her what is wrong. diff --git a/varnish.init b/varnish.init index b86a4f8..8ea10c9 100644 --- a/varnish.init +++ b/varnish.init @@ -101,11 +101,14 @@ status_varnishd() { } configtest() { - $DAEMON ${DAEMON_OPTS} -C -n /tmp > /dev/null + $DAEMON ${DAEMON_OPTS} -C -n /tmp 2>/dev/null + if [ "$?" != 0 ]; then + $DAEMON ${DAEMON_OPTS} -C -n /tmp + return $? + fi } - case "$1" in start) case "${START:-}" in From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] b9a9c5d Removing confusing, non-effective permissions Message-ID: commit b9a9c5d0a06d1ea37ae16854e2c59570d3ae4e4c Author: Poul-Henning Kamp Date: Tue Sep 1 12:14:22 2015 +0000 Removing confusing, non-effective permissions diff --git a/bin/varnishd/mgt/mgt_shmem.c b/bin/varnishd/mgt/mgt_shmem.c index 89a7935..1afcfbf 100644 --- a/bin/varnishd/mgt/mgt_shmem.c +++ b/bin/varnishd/mgt/mgt_shmem.c @@ -104,7 +104,7 @@ vsm_n_check(void) struct VSM_head vsmh; int retval = 1; - fd = open(VSM_FILENAME, O_RDWR, 0644); + fd = open(VSM_FILENAME, O_RDWR); if (fd < 0) return (0); From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] e79fce2 White-space OCD Message-ID: commit e79fce21c8d175935f103750a17095424e831b02 Author: Poul-Henning Kamp Date: Mon Sep 7 08:59:51 2015 +0000 White-space OCD diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 5d4e4f2..21fc961 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -61,10 +61,10 @@ v1d_bytes(struct req *req, enum vdp_action act, void **priv, static void v1d_error(struct req *req, const char *msg) { - static const char r_500[] = - "HTTP/1.1 500 Internal Server Error\r\n" - "Server: Varnish\r\n" - "Connection: close\r\n\r\n"; + static const char r_500[] = + "HTTP/1.1 500 Internal Server Error\r\n" + "Server: Varnish\r\n" + "Connection: close\r\n\r\n"; VSLb(req->vsl, SLT_Error, "%s", msg); VSLb(req->vsl, SLT_RespProtocol, "HTTP/1.1"); @@ -122,7 +122,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); - if (WS_Overflowed(req->ws)) { + if (WS_Overflowed(req->ws)) { v1d_error(req, "workspace_client overflow"); return; } From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] 28a648f Give the "topline" header-id's a length-field in HTTPHdrPack. Message-ID: commit 28a648f6c3c1d87e23f5524793e18f6124f5ad73 Author: Poul-Henning Kamp Date: Mon Sep 7 09:04:56 2015 +0000 Give the "topline" header-id's a length-field in HTTPHdrPack. Patch by: martin (slightly polished) diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 648dad4..9461429 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -845,6 +845,9 @@ unsigned HTTP1_Write(const struct worker *w, const struct http *hp, const int*); #define HTTPH(a, b, c) extern char b[]; #include "tbl/http_headers.h" #undef HTTPH +extern const char H__Status[]; +extern const char H__Proto[]; +extern const char H__Reason[]; /* cache_main.c */ #define VXID(u) ((u) & VSL_IDENTMASK) diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 699bcf5..fd596f7 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -857,7 +857,7 @@ ban_evaluate(struct worker *wrk, const uint8_t *bs, struct objcore *oc, arg1 = HTTP_GetHdrPack(wrk, oc, bt.arg1_spec); break; case BANS_ARG_OBJSTATUS: - arg1 = HTTP_GetHdrPack(wrk, oc, ":status"); + arg1 = HTTP_GetHdrPack(wrk, oc, H__Status); break; default: WRONG("Wrong BAN_ARG code"); diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index e832992..fac57cc 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -44,6 +44,10 @@ #include "tbl/http_headers.h" #undef HTTPH +const char H__Status[] = "\010:status:"; +const char H__Proto[] = "\007:proto:"; +const char H__Reason[] = "\010:reason:"; + /*-------------------------------------------------------------------- * These two functions are in an incestous relationship with the * order of macros in include/tbl/vsl_tags_http.h @@ -901,6 +905,12 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(hdr); + l = hdr[0]; + assert(l > 0); + assert(l == strlen(hdr + 1)); + assert(hdr[l] == ':'); + hdr++; + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); AN(ptr); @@ -909,21 +919,16 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto")) + if (!strcmp(hdr, ":proto:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status")) + if (!strcmp(hdr, ":status:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason")) + if (!strcmp(hdr, ":reason:")) return (ptr); ptr = strchr(ptr, '\0') + 1; - l = hdr[0]; - assert(l == strlen(hdr + 1)); - assert(hdr[l] == ':'); - hdr++; - while (*ptr != '\0') { if (!strncasecmp(ptr, hdr, l)) { ptr += l; diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index cc302c5..c51007b 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -157,7 +157,7 @@ VRT_r_obj_proto(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":proto")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Proto)); } const char * @@ -167,7 +167,7 @@ VRT_r_obj_reason(VRT_CTX) CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC); - return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, ":reason")); + return (HTTP_GetHdrPack(ctx->req->wrk, ctx->req->objcore, H__Reason)); } /*-------------------------------------------------------------------- From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] 65e64b7 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Message-ID: commit 65e64b741bd56da8241e65bc419da7f49f9e0ad0 Author: Poul-Henning Kamp Date: Mon Sep 7 09:48:39 2015 +0000 Pack the HdrPack iterator into a function so other code than HTTP_GetHdrPack() can also use it. Patch by: martin Some rework by: phk diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 9461429..7c8411a 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -831,8 +831,10 @@ void http_CollectHdr(struct http *hp, const char *hdr); void http_VSL_log(const struct http *hp); void HTTP_Merge(struct worker *, struct objcore *, struct http *to); uint16_t HTTP_GetStatusPack(struct worker *, struct objcore *oc); -const char *HTTP_GetHdrPack(struct worker *, struct objcore *, - const char *hdr); +int HTTP_IterHdrPack(struct worker *, struct objcore *, const char **); +#define HTTP_FOREACH_PACK(wrk, oc, ptr) \ + for ((ptr) = NULL; HTTP_IterHdrPack(wrk, oc, &(ptr));) +const char *HTTP_GetHdrPack(struct worker *, struct objcore *, const char *hdr); enum sess_close http_DoConnection(struct http *hp); /* cache_http1_proto.c */ diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index fac57cc..9080641 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -806,6 +806,11 @@ http_EstimateWS(const struct http *fm, unsigned how) /*-------------------------------------------------------------------- * Encode http struct as byte string. + * + * XXX: We could save considerable special-casing below by encoding also + * XXX: H__Status, H__Reason and H__Proto into the string, but it would + * XXX: add 26-30 bytes to all encoded objects to save a little code. + * XXX: It could possibly be a good idea for later HTTP versions. */ void @@ -895,6 +900,32 @@ HTTP_GetStatusPack(struct worker *wrk, struct objcore *oc) /*--------------------------------------------------------------------*/ +/* Get the first packed header */ +int +HTTP_IterHdrPack(struct worker *wrk, struct objcore *oc, const char **p) +{ + const char *ptr; + + CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); + CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(p); + + if (*p == NULL) { + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ + ptr = strchr(ptr, '\0') + 1; /* Skip :proto: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :status: */ + ptr = strchr(ptr, '\0') + 1; /* Skip :reason: */ + *p = ptr; + } else { + *p = strchr(*p, '\0') + 1; /* Skip to next header */ + } + if (**p == '\0') + return (0); + return (1); +} + const char * HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) { @@ -911,33 +942,32 @@ HTTP_GetHdrPack(struct worker *wrk, struct objcore *oc, const char *hdr) assert(hdr[l] == ':'); hdr++; - ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); - AN(ptr); + if (hdr[0] == ':') { + /* Special cases */ + ptr = ObjGetattr(wrk, oc, OA_HEADERS, NULL); + AN(ptr); + ptr += 4; /* Skip nhd and status */ - /* Skip nhd and status */ - ptr += 4; - VSL(SLT_Debug, 0, "%d %s", __LINE__, ptr); - - /* Skip PROTO, STATUS and REASON */ - if (!strcmp(hdr, ":proto:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":status:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; - if (!strcmp(hdr, ":reason:")) - return (ptr); - ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":proto:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":status:")) + return (ptr); + ptr = strchr(ptr, '\0') + 1; + if (!strcmp(hdr, ":reason:")) + return (ptr); + WRONG("Unknown magic packed header"); + } - while (*ptr != '\0') { + HTTP_FOREACH_PACK(wrk, oc, ptr) { if (!strncasecmp(ptr, hdr, l)) { ptr += l; while (vct_islws(*ptr)) ptr++; return (ptr); } - ptr = strchr(ptr, '\0') + 1; } + return (NULL); } From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] b999dba add coverage for obj.status Message-ID: commit b999dba2308474d2ac70c2d644a753bc6ab3bf4f Author: Poul-Henning Kamp Date: Mon Sep 7 10:06:41 2015 +0000 add coverage for obj.status diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc index fbb0fb8..02788d4 100644 --- a/bin/varnishtest/tests/v00025.vtc +++ b/bin/varnishtest/tests/v00025.vtc @@ -42,6 +42,7 @@ varnish v1 -arg "-i J.F.Nobody" -vcl+backend { } sub vcl_hit { + if (obj.status != 200) { return(synth(700)); } if (obj.proto) { } if (obj.reason) { } if (obj.keep > 1m) { } From phk at FreeBSD.org Tue Sep 8 09:52:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] 57baf76 Start sequestering our truly private bits into cache_priv.h which VMODs should never, ever, see. Message-ID: commit 57baf76f48f10443f079ef3b045fd17adbd39680 Author: Poul-Henning Kamp Date: Mon Sep 7 12:46:10 2015 +0000 Start sequestering our truly private bits into cache_priv.h which VMODs should never, ever, see. diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index dd2bae2..e4d2ab5 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -101,6 +101,7 @@ noinst_HEADERS = \ builtin_vcl.h \ cache/cache_esi.h \ cache/cache_pool.h \ + cache/cache_priv.h \ common/heritage.h \ hash/hash_slinger.h \ http1/cache_http1.h \ @@ -124,6 +125,7 @@ nobase_pkginclude_HEADERS = \ varnishd_CFLAGS = \ @PCRE_CFLAGS@ \ + -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' \ -DVARNISH_VMOD_DIR='"${pkglibdir}/vmods"' \ -DVARNISH_VCL_DIR='"${varnishconfdir}"' diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 7c8411a..742f89e 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -648,46 +648,18 @@ struct sess { }; -/*-------------------------------------------------------------------- - * A transport is how we talk HTTP for a given request. - * This is different from a protocol because ESI child requests have - * their own "protocol" to talk to the parent ESI request, which may - * or may not, be talking a "real" HTTP protocol itself. - */ - -typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); - -struct transport { - unsigned magic; -#define TRANSPORT_MAGIC 0xf157f32f - vtr_deliver_f *deliver; -}; - /* Prototypes etc ----------------------------------------------------*/ /* Cross file typedefs */ typedef enum htc_status_e htc_complete_f(struct http_conn *); -/* cache_acceptor.c */ -void VCA_Init(void); -void VCA_Shutdown(void); - -/* cache_backend_cfg.c */ -void VBE_InitCfg(void); -void VBE_Poll(void); - -/* cache_backend_poll.c */ -void VBP_Init(void); - /* cache_ban.c */ struct ban *BAN_New(void); int BAN_AddTest(struct ban *, const char *, const char *, const char *); void BAN_Free(struct ban *b); char *BAN_Insert(struct ban *b); void BAN_Free_Errormsg(char *); -void BAN_Init(void); -void BAN_Shutdown(void); void BAN_NewObjCore(struct objcore *oc); void BAN_DestroyObj(struct objcore *oc); int BAN_CheckObject(struct worker *, struct objcore *, struct req *); @@ -699,7 +671,6 @@ void BAN_TailDeref(struct ban **ban); double BAN_Time(const struct ban *ban); /* cache_busyobj.c */ -void VBO_Init(void); struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *); void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj); void VBO_extend(struct busyobj *, ssize_t); @@ -719,9 +690,6 @@ enum req_fsm_nxt CNT_Request(struct worker *, struct req *); void CNT_AcctLogCharge(struct dstat *, struct req *); /* cache_cli.c [CLI] */ -void CLI_Init(void); -void CLI_Run(void); -void CLI_AddFuncs(struct cli_proto *p); extern pthread_t cli_thread; #define ASSERT_CLI() do {assert(pthread_self() == cli_thread);} while (0) @@ -732,7 +700,6 @@ double EXP_Ttl(const struct req *, const struct exp*); double EXP_When(const struct exp *exp); void EXP_Insert(struct worker *wrk, struct objcore *oc); void EXP_Inject(struct worker *wrk, struct objcore *oc, struct lru *lru); -void EXP_Init(void); void EXP_Rearm(struct objcore *, double now, double ttl, double grace, double keep); void EXP_Touch(struct objcore *oc, double now); @@ -758,9 +725,6 @@ enum vbf_fetch_mode_e { void VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, struct objcore *oldoc, enum vbf_fetch_mode_e); -/* cache_fetch_proc.c */ -void VFP_Init(void); - /* cache_gzip.c */ struct vgz; @@ -797,7 +761,6 @@ void HTTP_Copy(struct http *to, const struct http * const fm); struct http *HTTP_create(void *p, uint16_t nhttp); const char *http_Status2Reason(unsigned); unsigned http_EstimateWS(const struct http *fm, unsigned how); -void HTTP_Init(void); void http_PutResponse(struct http *to, const char *proto, uint16_t status, const char *response); void http_FilterReq(struct http *to, const struct http *fm, unsigned how); @@ -856,12 +819,6 @@ extern const char H__Reason[]; uint32_t VXID_Get(struct worker *, uint32_t marker); extern volatile struct params * cache_param; extern pthread_key_t witness_key; -void THR_SetName(const char *name); -const char* THR_GetName(void); -void THR_SetBusyobj(const struct busyobj *); -struct busyobj * THR_GetBusyobj(void); -void THR_SetRequest(const struct req *); -struct req * THR_GetRequest(void); /* cache_lck.c */ @@ -873,7 +830,6 @@ void Lck__New(struct lock *lck, struct VSC_C_lck *, const char *); void Lck__Assert(const struct lock *lck, int held); /* public interface: */ -void LCK_Init(void); void Lck_Delete(struct lock *lck); int Lck_CondWait(pthread_cond_t *cond, struct lock *lck, double); @@ -933,12 +889,10 @@ int ObjCheckFlag(struct worker *, struct objcore *oc, enum obj_flags of); void ObjSetFlag(struct worker *, struct objcore *, enum obj_flags of, int val); /* cache_panic.c */ -void PAN_Init(void); const char *body_status_2str(enum body_status e); const char *sess_close_2str(enum sess_close sc, int want_desc); /* cache_pool.c */ -void Pool_Init(void); int Pool_Task(struct pool *pp, struct pool_task *task, enum task_how how); int Pool_Task_Arg(struct worker *, task_func_t *, const void *arg, size_t arg_len); @@ -947,9 +901,6 @@ int Pool_TrySumstat(struct worker *wrk); void Pool_PurgeStat(unsigned nobj); int Pool_Task_Any(struct pool_task *task, enum task_how how); -/* cache_proxy.c [VPX] */ -task_func_t VPX_Proto_Sess; - /* cache_range.c [VRG] */ void VRG_dorange(struct req *req, const char *r); @@ -997,13 +948,8 @@ const char *SES_Get_String_Attr(const struct sess *sp, enum sess_attr a); /* cache_shmlog.c */ extern struct VSC_C_main *VSC_C_main; -void VSM_Init(void); void *VSM_Alloc(unsigned size, const char *class, const char *type, const char *ident); -void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len); -void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, - uint32_t vxid); -void VSL_End(struct vsl_log *vsl); void VSM_Free(void *ptr); #ifdef VSL_ENDMARKER void VSL(enum VSL_tag_e tag, uint32_t vxid, const char *fmt, ...) @@ -1047,13 +993,8 @@ enum vry_finish_flag { KEEP, DISCARD }; void VRY_Finish(struct req *req, enum vry_finish_flag); /* cache_vcl.c */ -struct director *VCL_DefaultDirector(const struct vcl *); -const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *); -void VCL_Init(void); const char *VCL_Method_Name(unsigned); const char *VCL_Name(const struct vcl *); -void VCL_Panic(struct vsb *, const struct vcl *); -void VCL_Poll(void); void VCL_Ref(struct vcl *); void VCL_Refresh(struct vcl **); void VCL_Rel(struct vcl **); @@ -1073,11 +1014,6 @@ const char *VCL_Return_Name(unsigned); */ const char *VRT_String(struct ws *ws, const char *h, const char *p, va_list ap); char *VRT_StringList(char *d, unsigned dl, const char *p, va_list ap); -void VRTPRIV_init(struct vrt_privs *privs); -void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id); - -/* cache_vrt_vmod.c */ -void VMOD_Init(void); /* cache_wrk.c */ @@ -1119,10 +1055,6 @@ void STV_close(void); int STV_BanInfo(enum baninfo event, const uint8_t *ban, unsigned len); void STV_BanExport(const uint8_t *bans, unsigned len); -/* storage_persistent.c */ -void SMP_Init(void); -void SMP_Ready(void); - /* * A normal pointer difference is signed, but we never want a negative value * so this little tool will make sure we don't get that. @@ -1183,3 +1115,8 @@ DO_DEBUG(enum debug_bits x) if (DO_DEBUG(debug_bit)) \ VSL(SLT_Debug, (id), __VA_ARGS__); \ } while (0) + +#ifdef VARNISHD_IS_NOT_A_VMOD +# include "cache/cache_priv.h" +#endif + diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h new file mode 100644 index 0000000..8fa4a9a --- /dev/null +++ b/bin/varnishd/cache/cache_priv.h @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2015 Varnish Software 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. + * + * Stuff that should *never* be exposed to a VMOD + */ + +/*-------------------------------------------------------------------- + * A transport is how we talk HTTP for a given request. + * This is different from a protocol because ESI child requests have + * their own "protocol" to talk to the parent ESI request, which may + * or may not, be talking a "real" HTTP protocol itself. + */ + +typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); + +struct transport { + unsigned magic; +#define TRANSPORT_MAGIC 0xf157f32f + vtr_deliver_f *deliver; +}; + +/* Prototypes etc ----------------------------------------------------*/ + +/* cache_acceptor.c */ +void VCA_Init(void); +void VCA_Shutdown(void); + +/* cache_backend_cfg.c */ +void VBE_InitCfg(void); +void VBE_Poll(void); + +/* cache_backend_poll.c */ +void VBP_Init(void); + +/* cache_ban.c */ +void BAN_Init(void); +void BAN_Shutdown(void); + +/* cache_busyobj.c */ +void VBO_Init(void); + +/* cache_cli.c [CLI] */ +void CLI_Init(void); +void CLI_Run(void); +void CLI_AddFuncs(struct cli_proto *p); + +/* cache_expire.c */ +void EXP_Init(void); + +/* cache_fetch_proc.c */ +void VFP_Init(void); + +/* cache_http.c */ +void HTTP_Init(void); + +/* cache_main.c */ +void THR_SetName(const char *name); +const char* THR_GetName(void); +void THR_SetBusyobj(const struct busyobj *); +struct busyobj * THR_GetBusyobj(void); +void THR_SetRequest(const struct req *); +struct req * THR_GetRequest(void); + +/* cache_lck.c */ +void LCK_Init(void); + +/* cache_panic.c */ +void PAN_Init(void); + +/* cache_pool.c */ +void Pool_Init(void); + +/* cache_proxy.c [VPX] */ +task_func_t VPX_Proto_Sess; + +/* cache_shmlog.c */ +void VSM_Init(void); +void VSL_Setup(struct vsl_log *vsl, void *ptr, size_t len); +void VSL_ChgId(struct vsl_log *vsl, const char *typ, const char *why, + uint32_t vxid); +void VSL_End(struct vsl_log *vsl); + +/* cache_vcl.c */ +struct director *VCL_DefaultDirector(const struct vcl *); +const struct vrt_backend_probe *VCL_DefaultProbe(const struct vcl *); +void VCL_Init(void); +void VCL_Panic(struct vsb *, const struct vcl *); +void VCL_Poll(void); + +/* cache_vrt.c */ +void VRTPRIV_init(struct vrt_privs *privs); +void VRTPRIV_dynamic_kill(struct vrt_privs *privs, uintptr_t id); + +/* cache_vrt_vmod.c */ +void VMOD_Init(void); + +/* storage_persistent.c */ +void SMP_Init(void); +void SMP_Ready(void); + diff --git a/bin/varnishd/flint.sh b/bin/varnishd/flint.sh index dfe59c2..f96d0fc 100755 --- a/bin/varnishd/flint.sh +++ b/bin/varnishd/flint.sh @@ -15,6 +15,7 @@ flexelint \ -I../../lib/libvgz \ -I../.. \ -I/usr/local/include \ + -DVARNISHD_IS_NOT_A_VMOD \ -DVARNISH_STATE_DIR=\"foo\" \ -DVARNISH_VMOD_DIR=\"foo\" \ -DVARNISH_VCL_DIR=\"foo\" \ From lkarsten at varnish-software.com Tue Sep 8 09:52:24 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 11:52:24 +0200 Subject: [4.1] 73daf17 Merge branch 'master' into 4.1 Message-ID: commit 73daf17190781975c6f7052ce4a95503439f1111 Merge: 017ec21 57baf76 Author: Lasse Karstensen Date: Tue Sep 8 11:45:56 2015 +0200 Merge branch 'master' into 4.1 From lkarsten at varnish-software.com Tue Sep 8 10:00:27 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 12:00:27 +0200 Subject: [master] bf0f54d Fix WS overflow test cases for i386. Message-ID: commit bf0f54d37a1f3f5004d81222560828e02308d537 Author: Lasse Karstensen Date: Tue Sep 8 11:58:15 2015 +0200 Fix WS overflow test cases for i386. Some of the WS sizes are adjusted on startup when running on i386/i686. Adjust the test cases to take that into account. diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index 27f339f..d389ce3 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -15,7 +15,6 @@ varnish v1 -vcl+backend { } sub vcl_deliver { - set resp.http.free_client = debug.workspace_free(client); set resp.http.free_session = debug.workspace_free(session); set resp.http.free_thread = debug.workspace_free(thread); @@ -39,8 +38,7 @@ client c1 { rxresp expect resp.http.overflowed == "false" - expect resp.http.free_client > 57000 - expect resp.http.free_backend > 57000 + expect resp.http.free_backend > 9000 expect resp.http.free_session > 250 expect resp.http.free_thread > 2000 } -run @@ -52,4 +50,3 @@ client c2 { } -run logexpect l1 -wait - diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc index 59e3281..9cd4a1f 100644 --- a/bin/varnishtest/tests/c00071.vtc +++ b/bin/varnishtest/tests/c00071.vtc @@ -17,7 +17,7 @@ varnish v1 -vcl+backend { debug.workspace_allocate(client, debug.workspace_free(client) - 200); if (req.url ~ "/bar") { - set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; } else if (req.url ~ "/baz") { set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"); From lkarsten at varnish-software.com Tue Sep 8 10:06:42 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 12:06:42 +0200 Subject: [4.1] bf0f54d Fix WS overflow test cases for i386. Message-ID: commit bf0f54d37a1f3f5004d81222560828e02308d537 Author: Lasse Karstensen Date: Tue Sep 8 11:58:15 2015 +0200 Fix WS overflow test cases for i386. Some of the WS sizes are adjusted on startup when running on i386/i686. Adjust the test cases to take that into account. diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index 27f339f..d389ce3 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -15,7 +15,6 @@ varnish v1 -vcl+backend { } sub vcl_deliver { - set resp.http.free_client = debug.workspace_free(client); set resp.http.free_session = debug.workspace_free(session); set resp.http.free_thread = debug.workspace_free(thread); @@ -39,8 +38,7 @@ client c1 { rxresp expect resp.http.overflowed == "false" - expect resp.http.free_client > 57000 - expect resp.http.free_backend > 57000 + expect resp.http.free_backend > 9000 expect resp.http.free_session > 250 expect resp.http.free_thread > 2000 } -run @@ -52,4 +50,3 @@ client c2 { } -run logexpect l1 -wait - diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc index 59e3281..9cd4a1f 100644 --- a/bin/varnishtest/tests/c00071.vtc +++ b/bin/varnishtest/tests/c00071.vtc @@ -17,7 +17,7 @@ varnish v1 -vcl+backend { debug.workspace_allocate(client, debug.workspace_free(client) - 200); if (req.url ~ "/bar") { - set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; } else if (req.url ~ "/baz") { set resp.http.x-foo = regsub(req.url, "baz", "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaz"); From lkarsten at varnish-software.com Tue Sep 8 10:06:42 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 12:06:42 +0200 Subject: [4.1] 8993e19 Merge branch 'master' into 4.1 Message-ID: commit 8993e19b9b5e7b5d470409aa09b70717fb10b1eb Merge: 73daf17 bf0f54d Author: Lasse Karstensen Date: Tue Sep 8 12:06:30 2015 +0200 Merge branch 'master' into 4.1 From lkarsten at varnish-software.com Tue Sep 8 11:52:04 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 13:52:04 +0200 Subject: [master] 3091011 Remove build artifacts from distributed HTML docs. Message-ID: commit 3091011ac6716320a7fa7dca54d2ca26be2b3069 Author: Lasse Karstensen Date: Tue Sep 8 13:51:12 2015 +0200 Remove build artifacts from distributed HTML docs. diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am index 6d71c14..fbfe06b 100644 --- a/doc/sphinx/Makefile.am +++ b/doc/sphinx/Makefile.am @@ -118,6 +118,8 @@ dist-hook: $(MAKE) html rm -rf $(BUILDDIR)/doctrees cp -r $(BUILDDIR)/html $(distdir)/../ + @ # Remove build artifacts. + rm $(distdir)/../html/.buildinfo $(distdir)/../html/*.inv distclean-local: rm -rf $(BUILDDIR) From lkarsten at varnish-software.com Tue Sep 8 11:52:56 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 13:52:56 +0200 Subject: [4.1] 2cb715a Remove build artifacts from distributed HTML docs. Message-ID: commit 2cb715a7c1517e563f9cb79538c5aa3c7776de4c Author: Lasse Karstensen Date: Tue Sep 8 13:51:12 2015 +0200 Remove build artifacts from distributed HTML docs. diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am index 6d71c14..fbfe06b 100644 --- a/doc/sphinx/Makefile.am +++ b/doc/sphinx/Makefile.am @@ -118,6 +118,8 @@ dist-hook: $(MAKE) html rm -rf $(BUILDDIR)/doctrees cp -r $(BUILDDIR)/html $(distdir)/../ + @ # Remove build artifacts. + rm $(distdir)/../html/.buildinfo $(distdir)/../html/*.inv distclean-local: rm -rf $(BUILDDIR) From lkarsten at varnish-software.com Tue Sep 8 12:23:47 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 14:23:47 +0200 Subject: [4.1] 72a0d5d Commit to test push hook for documentation. Message-ID: commit 72a0d5de421cf17638547eee433e5ab181c8c76b Author: Lasse Karstensen Date: Tue Sep 8 14:23:26 2015 +0200 Commit to test push hook for documentation. diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 6b9716c..5e22e66 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -35,9 +35,9 @@ Conventions used in this manual include: Longer listings like example command output and VCL look like this:: $ /opt/varnish/sbin/varnishd -V - varnishd (varnish-4.0.0-tp1 revision ddd00e1) + varnishd (varnish-trunk revision 199de9b) Copyright (c) 2006 Verdens Gang AS - Copyright (c) 2006-2011 Varnish Software AS + Copyright (c) 2006-2015 Varnish Software AS .. For maintainers: From lkarsten at varnish-software.com Tue Sep 8 16:06:12 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 08 Sep 2015 18:06:12 +0200 Subject: [master] ca88bce Commit to test push hook for documentation. Message-ID: commit ca88bcec3535f053350719fb7b7787bbecce6cb4 Author: Lasse Karstensen Date: Tue Sep 8 14:23:26 2015 +0200 Commit to test push hook for documentation. diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 6b9716c..5e22e66 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -35,9 +35,9 @@ Conventions used in this manual include: Longer listings like example command output and VCL look like this:: $ /opt/varnish/sbin/varnishd -V - varnishd (varnish-4.0.0-tp1 revision ddd00e1) + varnishd (varnish-trunk revision 199de9b) Copyright (c) 2006 Verdens Gang AS - Copyright (c) 2006-2011 Varnish Software AS + Copyright (c) 2006-2015 Varnish Software AS .. For maintainers: From lkarsten at varnish-software.com Wed Sep 9 12:23:26 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 09 Sep 2015 14:23:26 +0200 Subject: [master] cc5acbf Expand on closing of idle backend connections. Message-ID: commit cc5acbfcba0a1d40c1257c39a4e5d90389ed0c38 Author: Lasse Karstensen Date: Wed Sep 9 14:22:59 2015 +0200 Expand on closing of idle backend connections. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index b71cc85..0c8028b 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -105,6 +105,18 @@ TCP to fetch resources. More details in the :ref:`ref-writing-a-director` documentation. +Backend connection timeout +========================== + +Backend connections will now ble closed by Varnish after `backend_idle_timeout` +seconds of inactivity. + +Previously they were kept around forever and the backend servers would close +the connection without Varnish noticing it. On the next traffic spike needing +these extra backend connections, the request would fail, perhaps multiple +times, before a working backend connection was found/created. + + Surrogate keys ============== @@ -125,7 +137,5 @@ Other noteworthy small changes * Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. -* Varnish will now discard remaining/older open backend connections when - a failing connection is found. * -smalloc storage is now recommended over -sfile on Linux systems. From lkarsten at varnish-software.com Wed Sep 9 12:46:57 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 09 Sep 2015 14:46:57 +0200 Subject: [master] e36108a Improve spelling. Message-ID: commit e36108a410602c65f1286fba216291d14883b30b Author: Lasse Karstensen Date: Wed Sep 9 14:46:38 2015 +0200 Improve spelling. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 0c8028b..31019dd 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -108,7 +108,7 @@ documentation. Backend connection timeout ========================== -Backend connections will now ble closed by Varnish after `backend_idle_timeout` +Backend connections will now be closed by Varnish after `backend_idle_timeout` seconds of inactivity. Previously they were kept around forever and the backend servers would close @@ -129,7 +129,7 @@ A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request -and any ESI subrequests it lead to. +and any ESI sub-requests it lead to. Other noteworthy small changes diff --git a/doc/sphinx/whats-new/upgrade-4.0.rst b/doc/sphinx/whats-new/upgrade-4.0.rst index d1df915..f96c173 100644 --- a/doc/sphinx/whats-new/upgrade-4.0.rst +++ b/doc/sphinx/whats-new/upgrade-4.0.rst @@ -132,7 +132,7 @@ Remember to import the std module if you're not doing so already. client.port, and server.port replaced by respectively std.port(client.ip) and std.port(server.ip) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -`client.ip` and `server.ip` are now proper datatypes, which renders +`client.ip` and `server.ip` are now proper data types, which renders as an IP address by default. You need to use the `std.port()` function to get the port number. diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index 058aa5e..bcdf8c5 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -63,12 +63,12 @@ replaced as the active VCL. The following parameters have been retired: -* `group` (security rewamp) -* `group_cc` (security rewamp) -* `listen_address` (security rewamp) +* `group` (security revamp) +* `group_cc` (security revamp) +* `listen_address` (security revamp) * `pool_vbc` * `timeout_req` - merged with `timeout_idle`. -* `user` (security rewamp) +* `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. From lkarsten at varnish-software.com Wed Sep 9 13:13:27 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 09 Sep 2015 15:13:27 +0200 Subject: [master] d8e1f8a One more spelling fix. Message-ID: commit d8e1f8a9ab50f5179e88005f666c9bc7201dd07e Author: Lasse Karstensen Date: Wed Sep 9 15:02:42 2015 +0200 One more spelling fix. As noted by Dridi. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 31019dd..1da50fe 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -129,7 +129,7 @@ A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request -and any ESI sub-requests it lead to. +and any ESI sub-requests it leads to. Other noteworthy small changes From phk at FreeBSD.org Wed Sep 9 19:29:08 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 09 Sep 2015 21:29:08 +0200 Subject: [master] 7dd36b4 White-space OCD Message-ID: commit 7dd36b42f6c7b50db1ca277db6623efebb498edb Author: Poul-Henning Kamp Date: Wed Sep 9 19:24:49 2015 +0000 White-space OCD diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index d389ce3..770fcd6 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -28,9 +28,9 @@ varnish v1 -vcl+backend { } -start logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" { - expect 0 * Begin - expect * = Error "workspace_client overflow" - expect * = End + expect 0 * Begin + expect * = Error "workspace_client overflow" + expect * = End } -start client c1 { From phk at FreeBSD.org Wed Sep 9 19:29:08 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 09 Sep 2015 21:29:08 +0200 Subject: [master] 723f8a5 Propagate gzip CRC upwards from nested ESI includes. Message-ID: commit 723f8a5219e622c10302a70c0596b34d1116418b Author: Poul-Henning Kamp Date: Wed Sep 9 19:27:08 2015 +0000 Propagate gzip CRC upwards from nested ESI includes. Detected by: Laurent Lavaud Patched by: martin (with minor shuffle by me) Fixes: #1781 diff --git a/bin/varnishtest/tests/r01781.vtc b/bin/varnishtest/tests/r01781.vtc new file mode 100644 index 0000000..5b796d8 --- /dev/null +++ b/bin/varnishtest/tests/r01781.vtc @@ -0,0 +1,27 @@ +varnishtest "#1781 gzip checksum with multilevel esi" + +server s1 { + rxreq + txresp -body {Baz} + + rxreq + txresp -body {Bar} + + rxreq + txresp -body {Foo} +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.do_gzip = true; + set beresp.do_esi = true; + } +} -start + +client c1 { + txreq -hdr "Accept-Encoding: gzip" + rxresp + expect resp.http.content-encoding == "gzip" + gunzip + expect resp.body == "FooBarBaz" +} -run From phk at FreeBSD.org Wed Sep 9 19:37:00 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 09 Sep 2015 21:37:00 +0200 Subject: [master] 2367d52 The actual fix for #1781 Message-ID: commit 2367d528ab370381a6d94551136aa18e977f2716 Author: Poul-Henning Kamp Date: Wed Sep 9 19:36:44 2015 +0000 The actual fix for #1781 See previous commit. diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index ff30ae3..5649769 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -228,7 +228,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, uint32_t icrc = 0; uint8_t tailbuf[8 + 5]; const uint8_t *pp; - struct ecx *ecx; + struct ecx *ecx, *pecx; int retval = 0; if (act == VDP_INIT) { @@ -360,6 +360,13 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, (void)VDP_bytes(req, VDP_NULL, tailbuf, 13); } + if (req->transport->deliver == VED_Deliver) { + CAST_OBJ_NOTNULL(pecx, req->transport_priv, + ECX_MAGIC); + pecx->crc = crc32_combine(pecx->crc, + ecx->crc, ecx->l_crc); + pecx->l_crc += ecx->l_crc; + } retval = VDP_bytes(req, VDP_FLUSH, NULL, 0); ecx->state = 99; return (retval); From phk at FreeBSD.org Thu Sep 10 09:17:22 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 11:17:22 +0200 Subject: [master] a6a6e97 Align code with RFC7230 section 3.3.3 which allows POST without a body. Message-ID: commit a6a6e97a4db6e94b14f81af55fea4d07aa06d0af Author: Poul-Henning Kamp Date: Thu Sep 10 09:16:33 2015 +0000 Align code with RFC7230 section 3.3.3 which allows POST without a body. Fixes: #1783 diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c index 77b8f5b..8fa7e9e 100644 --- a/bin/varnishd/http1/cache_http1_proto.c +++ b/bin/varnishd/http1/cache_http1_proto.c @@ -282,15 +282,19 @@ http1_body_status(struct http *hp, struct http_conn *htc) htc->content_length = -1; - if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) { - http_Unset(hp, H_Content_Length); + cl = http_GetContentLength(hp); + if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { + if (strcasecmp(b, "chunked")) + return (BS_ERROR); + if (cl != -1) { + /* + * RFC7230 3.3.3 allows more lenient handling + * but we're going to be strict. + */ + return (BS_ERROR); + } return (BS_CHUNKED); } - - if (http_GetHdr(hp, H_Transfer_Encoding, &b)) - return (BS_ERROR); - - cl = http_GetContentLength(hp); if (cl == -2) return (BS_ERROR); if (cl >= 0) { @@ -298,6 +302,9 @@ http1_body_status(struct http *hp, struct http_conn *htc) return (cl == 0 ? BS_NONE : BS_LENGTH); } + if (hp->protover == 11) + return (BS_NONE); + if (http_HdrIs(hp, H_Connection, "keep-alive")) { /* * Keep alive with neither TE=Chunked or C-Len is impossible. @@ -306,20 +313,6 @@ http1_body_status(struct http *hp, struct http_conn *htc) return (BS_NONE); } - if (http_HdrIs(hp, H_Connection, "close")) { - /* - * In this case, it is safe to just read what comes. - */ - return (BS_EOF); - } - - if (hp->protover < 11) { - /* - * With no Connection header, assume EOF. - */ - return (BS_EOF); - } - /* * Fall back to EOF transfer. */ diff --git a/bin/varnishtest/tests/b00011.vtc b/bin/varnishtest/tests/b00011.vtc index 82381a8..d6c9eab 100644 --- a/bin/varnishtest/tests/b00011.vtc +++ b/bin/varnishtest/tests/b00011.vtc @@ -2,7 +2,7 @@ varnishtest "Check HTTP/1.0 EOF transmission" server s1 { rxreq - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send "Body line 1\n" diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index 1448ed5..d601501 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 # send "Baba\n" } -start diff --git a/bin/varnishtest/tests/b00021.vtc b/bin/varnishtest/tests/b00021.vtc index 3d4e241..46be8cb 100644 --- a/bin/varnishtest/tests/b00021.vtc +++ b/bin/varnishtest/tests/b00021.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 4.0 send "Baba\n" } -start @@ -26,7 +26,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.0 send "Baba\n" delay 1.0 diff --git a/bin/varnishtest/tests/b00022.vtc b/bin/varnishtest/tests/b00022.vtc index c232408..7bf6d95 100644 --- a/bin/varnishtest/tests/b00022.vtc +++ b/bin/varnishtest/tests/b00022.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 send "Baba\n" } -start @@ -28,7 +28,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 diff --git a/bin/varnishtest/tests/c00013.vtc b/bin/varnishtest/tests/c00013.vtc index 081ed1f..689e118 100644 --- a/bin/varnishtest/tests/c00013.vtc +++ b/bin/varnishtest/tests/c00013.vtc @@ -3,7 +3,7 @@ varnishtest "Test parking second request on backend delay" server s1 { rxreq expect req.url == "/foo" - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay .2 sema r1 sync 2 delay .2 diff --git a/bin/varnishtest/tests/e00007.vtc b/bin/varnishtest/tests/e00007.vtc index a03ef55..635f19e 100644 --- a/bin/varnishtest/tests/e00007.vtc +++ b/bin/varnishtest/tests/e00007.vtc @@ -16,7 +16,7 @@ varnishtest "ESI spanning storage bits" server s1 { rxreq expect req.url == "/foo/bar" - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send { diff --git a/bin/varnishtest/tests/e00014.vtc b/bin/varnishtest/tests/e00014.vtc index 0097f13..0f90331 100644 --- a/bin/varnishtest/tests/e00014.vtc +++ b/bin/varnishtest/tests/e00014.vtc @@ -3,7 +3,7 @@ varnishtest "Check } diff --git a/bin/varnishtest/tests/g00002.vtc b/bin/varnishtest/tests/g00002.vtc index 712d51b..1abdd8e 100644 --- a/bin/varnishtest/tests/g00002.vtc +++ b/bin/varnishtest/tests/g00002.vtc @@ -4,7 +4,7 @@ server s1 { rxreq expect req.http.accept-encoding == "gzip" expect req.url == "/foo" - txresp -nolen -gziplen 4100 + txresp -proto HTTP/1.0 -nolen -gziplen 4100 accept rxreq expect req.url == "/bar" diff --git a/bin/varnishtest/tests/r00733.vtc b/bin/varnishtest/tests/r00733.vtc index 365f0ec..b6a1170 100644 --- a/bin/varnishtest/tests/r00733.vtc +++ b/bin/varnishtest/tests/r00733.vtc @@ -2,7 +2,7 @@ varnishtest "HTTP/1.1 Backend sends no length hint" server s1 { rxreq - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "\n" send "12345" } -start diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index dd7e0da..a01bab2 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -1,30 +1,10 @@ varnishtest "C-L/T-E:chunked conflict" server s1 { - rxreqhdrs - expect req.http.content-length == - expect req.http.transfer-encoding == chunked - rxreqbody - expect req.url == /1 + rxreq expect req.bodylen == 20 - send "HTTP/1.1 200 OK" - send "Content-Length: 31\r\n" - send "Transfer-Encoding: chunked\r\n" - send "\r\n" - send "14\r\n" - send "0123456789" - send "0123456789" - send "0\r\n" - send "\r\n" - - rxreqhdrs - expect req.http.content-length == 20 - expect req.http.transfer-encoding == - expect req.url == /2 - expect req.bodylen == 20 - - send "HTTP/1.1 200 OK" + send "HTTP/1.1 200 OK\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" @@ -36,14 +16,7 @@ server s1 { } -start -varnish v1 -vcl+backend { - import ${vmod_std}; - sub vcl_recv { - if (req.url == "/2") { - std.cache_req_body(1KB); - } - } -} -start +varnish v1 -vcl+backend { } -start client c1 { @@ -56,12 +29,14 @@ client c1 { send "0123456789" send "0\r\n" send "\r\n" + rxresp - expect resp.bodylen == 20 + expect resp.status == 400 +} -run +client c1 { send "PUT /2 HTTP/1.1\r\n" - send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" send "14\r\n" @@ -69,7 +44,8 @@ client c1 { send "0123456789" send "0\r\n" send "\r\n" + rxresp - expect resp.bodylen == 20 + expect resp.status == 503 } -run diff --git a/bin/varnishtest/tests/r01783.vtc b/bin/varnishtest/tests/r01783.vtc new file mode 100644 index 0000000..c44b77f --- /dev/null +++ b/bin/varnishtest/tests/r01783.vtc @@ -0,0 +1,19 @@ +varnishtest "POST with no body" + +server s1 { + rxreq + txresp -hdr "foo: 1" + rxreq + txresp -hdr "foo: 2" +} -start + +varnish v1 -vcl+backend {} -start + +client c1 { + txreq -req "POST" -nolen + rxresp + expect resp.http.foo == 1 + txreq -req "POST" -nolen + rxresp + expect resp.http.foo == 2 +} -run From lkarsten at varnish-software.com Thu Sep 10 12:29:03 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:29:03 +0200 Subject: [master] 8e5c7a0 Add fallback on std conversion functions. Message-ID: commit 8e5c7a0a610200089d7aca5edbde6e25de5e804d Author: Lasse Karstensen Date: Thu Sep 10 14:21:04 2015 +0200 Add fallback on std conversion functions. Handle that conversion between VCL data type can fail, and return a user-specificed fallback in those cases. Mostly identical to patch from Arianna Aondio. diff --git a/bin/varnishtest/tests/m00016.vtc b/bin/varnishtest/tests/m00016.vtc index ef51f93..261f840 100644 --- a/bin/varnishtest/tests/m00016.vtc +++ b/bin/varnishtest/tests/m00016.vtc @@ -1,4 +1,4 @@ -varnishtest "Test std.real2time, std.time2integer and std.time2real" +varnishtest "Test real2integer, real2time, time2integer and time2real in std" server s1 { rxreq @@ -10,8 +10,18 @@ varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.x-foo = std.integer(req.http.foo, 0); - set resp.http.x-bar = std.time2integer(std.real2time(std.real(resp.http.x-foo, 0.0))); - set resp.http.x-baz = std.time2real(std.real2time(std.real(resp.http.x-foo, 0.0))); + set resp.http.x-bar = std.time2integer(std.real2time( + std.real(resp.http.x-foo, 0.0), now), 1); + + set resp.http.x-baz = std.time2real(std.real2time( + std.real(resp.http.x-foo, 0.0), now), 1.0); + + set resp.http.x-qux = std.real2integer( + std.real(req.http.foo, 2.0), 2); + + # Representation of 9e99, which is larger than what fits in the + # 128bit integers on $exotic_platform. + set resp.http.x-int-fallback = std.real2integer(9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000, 2); } } -start @@ -20,4 +30,15 @@ client c1 { rxresp expect resp.http.x-foo == resp.http.x-bar expect resp.http.x-baz == 1140618699.000 + expect resp.http.x-qux == 1140618699 + expect resp.http.x-int-fallback == 2 +} -run + +# check we get the fallback if the conversion fails +client c2 { + txreq -hdr "foo: -9e99+1" + rxresp + expect resp.http.x-bar == 0 + expect resp.http.x-baz == 0.000 + expect resp.http.x-qux == 2 } -run diff --git a/bin/varnishtest/tests/r01532.vtc b/bin/varnishtest/tests/r01532.vtc index c189f55..b1ff007 100644 --- a/bin/varnishtest/tests/r01532.vtc +++ b/bin/varnishtest/tests/r01532.vtc @@ -9,7 +9,7 @@ varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { - set resp.http.x-foo = std.real2time(1140618699.00); + set resp.http.x-foo = std.real2time(1140618699.00, now); } } -start diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index 0ad385f..b082da3 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -128,7 +128,7 @@ Example $Function INT integer(STRING s, INT fallback) Description - Converts the string *s* to an integer. If conversion fails, + Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example | if (std.integer(req.http.foo, 0) > 5) { @@ -139,7 +139,7 @@ $Function IP ip(STRING s, IP fallback) Description Converts the string *s* to the first IP number returned by - the system library function getaddrinfo(3). If conversion + the system library function getaddrinfo(3). If conversion fails, *fallback* will be returned. Example | if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { @@ -149,33 +149,44 @@ Example $Function REAL real(STRING s, REAL fallback) Description - Converts the string *s* to a real. If conversion fails, + Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } -$Function TIME real2time(REAL r) +$Function INT real2integer(REAL r, INT fallback) Description - Converts the real *r* to a time. + Converts the real *r* to an integer. If conversion fails, + *fallback* will be returned. +Example + set req.http.integer = std.real2integer(1140618699.00, 0); + +$Function TIME real2time(REAL r, TIME fallback) + +Description + Converts the real *r* to a time. If conversion fails, + *fallback* will be returned. Example - set req.http.time = std.real2time(1140618699.00); + set req.http.time = std.real2time(1140618699.00, now); -$Function INT time2integer(TIME t) +$Function INT time2integer(TIME t, INT fallback) Description - Converts the time *t* to a integer. + Converts the time *t* to a integer. If conversion fails, + *fallback* will be returned. Example - set req.http.int = std.time2integer(now); + set req.http.int = std.time2integer(now, 0); -$Function REAL time2real(TIME t) +$Function REAL time2real(TIME t, REAL fallback) Description - Converts the time *t* to a real. + Converts the time *t* to a real. If conversion fails, + *fallback* will be returned. Example - set req.http.real = std.time2real(now); + set req.http.real = std.time2real(now, 1.0); $Function BOOL healthy(BACKEND be) @@ -241,7 +252,7 @@ Example $Function TIME time(STRING s, TIME fallback) Description - Converts the string *s* to a time. If conversion fails, + Converts the string *s* to a time. If conversion fails, *fallback* will be returned. Supported formats: diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 95bb003..131c3c1 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -187,27 +187,51 @@ vmod_real(VRT_CTX, VCL_STRING p, VCL_REAL d) return (r); } +VCL_INT __match_proto__(td_std_real2integer) +vmod_real2integer(VRT_CTX, VCL_REAL r, VCL_INT i) +{ + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + if (!isfinite(r)) + return (i); + r = round(r); + if (r > LONG_MAX || r < LONG_MIN) + return(i); + return ((long)r); +} + VCL_TIME __match_proto__(td_std_real2time) -vmod_real2time(VRT_CTX, VCL_REAL r) +vmod_real2time(VRT_CTX, VCL_REAL r, VCL_TIME t) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + if (!isfinite(r)) + return (t); + return (r); } VCL_INT __match_proto__(td_std_time2integer) -vmod_time2integer(VRT_CTX, VCL_TIME t) +vmod_time2integer(VRT_CTX, VCL_TIME t, VCL_INT i) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); - return ((long)floor(t)); + if (!isfinite(t)) + return (i); + t = round(t); + if (t > LONG_MAX || t < LONG_MIN) + return(i); + return ((long)t); } VCL_REAL __match_proto__(td_std_time2real) -vmod_time2real(VRT_CTX, VCL_TIME t) +vmod_time2real(VRT_CTX, VCL_TIME t, VCL_REAL r) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + if (!isfinite(t)) + return (r); + return (t); } From lkarsten at varnish-software.com Thu Sep 10 12:29:03 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:29:03 +0200 Subject: [master] a0d628d Correct use of whitespace. Message-ID: commit a0d628d2a58192ab306e8e186bfea9241de67ef9 Author: Lasse Karstensen Date: Thu Sep 10 14:24:34 2015 +0200 Correct use of whitespace. diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index b082da3..0002426 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -109,7 +109,7 @@ $Function VOID collect(HEADER hdr) Description Collapses multiple *hdr* headers into one long header. - Care should be taken when collapsing headers. In particular + Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side. Example diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 131c3c1..65df00c 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -142,7 +142,7 @@ vmod_ip(VRT_CTX, VCL_STRING s, VCL_IP d) p = WS_Alloc(ctx->ws, vsa_suckaddr_len); if (p == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, - "vmod std.ip(): insufficient workspace"); + "vmod std.ip(): insufficient workspace"); return d; } r = NULL; From lkarsten at varnish-software.com Thu Sep 10 12:37:28 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] 3091011 Remove build artifacts from distributed HTML docs. Message-ID: commit 3091011ac6716320a7fa7dca54d2ca26be2b3069 Author: Lasse Karstensen Date: Tue Sep 8 13:51:12 2015 +0200 Remove build artifacts from distributed HTML docs. diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am index 6d71c14..fbfe06b 100644 --- a/doc/sphinx/Makefile.am +++ b/doc/sphinx/Makefile.am @@ -118,6 +118,8 @@ dist-hook: $(MAKE) html rm -rf $(BUILDDIR)/doctrees cp -r $(BUILDDIR)/html $(distdir)/../ + @ # Remove build artifacts. + rm $(distdir)/../html/.buildinfo $(distdir)/../html/*.inv distclean-local: rm -rf $(BUILDDIR) From lkarsten at varnish-software.com Thu Sep 10 12:37:28 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] ca88bce Commit to test push hook for documentation. Message-ID: commit ca88bcec3535f053350719fb7b7787bbecce6cb4 Author: Lasse Karstensen Date: Tue Sep 8 14:23:26 2015 +0200 Commit to test push hook for documentation. diff --git a/doc/sphinx/index.rst b/doc/sphinx/index.rst index 6b9716c..5e22e66 100644 --- a/doc/sphinx/index.rst +++ b/doc/sphinx/index.rst @@ -35,9 +35,9 @@ Conventions used in this manual include: Longer listings like example command output and VCL look like this:: $ /opt/varnish/sbin/varnishd -V - varnishd (varnish-4.0.0-tp1 revision ddd00e1) + varnishd (varnish-trunk revision 199de9b) Copyright (c) 2006 Verdens Gang AS - Copyright (c) 2006-2011 Varnish Software AS + Copyright (c) 2006-2015 Varnish Software AS .. For maintainers: From lkarsten at varnish-software.com Thu Sep 10 12:37:28 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] cc5acbf Expand on closing of idle backend connections. Message-ID: commit cc5acbfcba0a1d40c1257c39a4e5d90389ed0c38 Author: Lasse Karstensen Date: Wed Sep 9 14:22:59 2015 +0200 Expand on closing of idle backend connections. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index b71cc85..0c8028b 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -105,6 +105,18 @@ TCP to fetch resources. More details in the :ref:`ref-writing-a-director` documentation. +Backend connection timeout +========================== + +Backend connections will now ble closed by Varnish after `backend_idle_timeout` +seconds of inactivity. + +Previously they were kept around forever and the backend servers would close +the connection without Varnish noticing it. On the next traffic spike needing +these extra backend connections, the request would fail, perhaps multiple +times, before a working backend connection was found/created. + + Surrogate keys ============== @@ -125,7 +137,5 @@ Other noteworthy small changes * Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. -* Varnish will now discard remaining/older open backend connections when - a failing connection is found. * -smalloc storage is now recommended over -sfile on Linux systems. From lkarsten at varnish-software.com Thu Sep 10 12:37:28 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] e36108a Improve spelling. Message-ID: commit e36108a410602c65f1286fba216291d14883b30b Author: Lasse Karstensen Date: Wed Sep 9 14:46:38 2015 +0200 Improve spelling. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 0c8028b..31019dd 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -108,7 +108,7 @@ documentation. Backend connection timeout ========================== -Backend connections will now ble closed by Varnish after `backend_idle_timeout` +Backend connections will now be closed by Varnish after `backend_idle_timeout` seconds of inactivity. Previously they were kept around forever and the backend servers would close @@ -129,7 +129,7 @@ A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request -and any ESI subrequests it lead to. +and any ESI sub-requests it lead to. Other noteworthy small changes diff --git a/doc/sphinx/whats-new/upgrade-4.0.rst b/doc/sphinx/whats-new/upgrade-4.0.rst index d1df915..f96c173 100644 --- a/doc/sphinx/whats-new/upgrade-4.0.rst +++ b/doc/sphinx/whats-new/upgrade-4.0.rst @@ -132,7 +132,7 @@ Remember to import the std module if you're not doing so already. client.port, and server.port replaced by respectively std.port(client.ip) and std.port(server.ip) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -`client.ip` and `server.ip` are now proper datatypes, which renders +`client.ip` and `server.ip` are now proper data types, which renders as an IP address by default. You need to use the `std.port()` function to get the port number. diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index 058aa5e..bcdf8c5 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -63,12 +63,12 @@ replaced as the active VCL. The following parameters have been retired: -* `group` (security rewamp) -* `group_cc` (security rewamp) -* `listen_address` (security rewamp) +* `group` (security revamp) +* `group_cc` (security revamp) +* `listen_address` (security revamp) * `pool_vbc` * `timeout_req` - merged with `timeout_idle`. -* `user` (security rewamp) +* `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. From lkarsten at varnish-software.com Thu Sep 10 12:37:28 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] d8e1f8a One more spelling fix. Message-ID: commit d8e1f8a9ab50f5179e88005f666c9bc7201dd07e Author: Lasse Karstensen Date: Wed Sep 9 15:02:42 2015 +0200 One more spelling fix. As noted by Dridi. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 31019dd..1da50fe 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -129,7 +129,7 @@ A new `req_top` identifier is available in VCL, which is a reference to `req` in the top-level ESI request. This is useful to pass data back and forth between the main ESI request -and any ESI sub-requests it lead to. +and any ESI sub-requests it leads to. Other noteworthy small changes From phk at FreeBSD.org Thu Sep 10 12:37:28 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] 7dd36b4 White-space OCD Message-ID: commit 7dd36b42f6c7b50db1ca277db6623efebb498edb Author: Poul-Henning Kamp Date: Wed Sep 9 19:24:49 2015 +0000 White-space OCD diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index d389ce3..770fcd6 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -28,9 +28,9 @@ varnish v1 -vcl+backend { } -start logexpect l1 -v v1 -d 1 -g vxid -q "Error ~ 'overflow'" { - expect 0 * Begin - expect * = Error "workspace_client overflow" - expect * = End + expect 0 * Begin + expect * = Error "workspace_client overflow" + expect * = End } -start client c1 { From phk at FreeBSD.org Thu Sep 10 12:37:28 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] 723f8a5 Propagate gzip CRC upwards from nested ESI includes. Message-ID: commit 723f8a5219e622c10302a70c0596b34d1116418b Author: Poul-Henning Kamp Date: Wed Sep 9 19:27:08 2015 +0000 Propagate gzip CRC upwards from nested ESI includes. Detected by: Laurent Lavaud Patched by: martin (with minor shuffle by me) Fixes: #1781 diff --git a/bin/varnishtest/tests/r01781.vtc b/bin/varnishtest/tests/r01781.vtc new file mode 100644 index 0000000..5b796d8 --- /dev/null +++ b/bin/varnishtest/tests/r01781.vtc @@ -0,0 +1,27 @@ +varnishtest "#1781 gzip checksum with multilevel esi" + +server s1 { + rxreq + txresp -body {Baz} + + rxreq + txresp -body {Bar} + + rxreq + txresp -body {Foo} +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.do_gzip = true; + set beresp.do_esi = true; + } +} -start + +client c1 { + txreq -hdr "Accept-Encoding: gzip" + rxresp + expect resp.http.content-encoding == "gzip" + gunzip + expect resp.body == "FooBarBaz" +} -run From phk at FreeBSD.org Thu Sep 10 12:37:28 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 14:37:28 +0200 Subject: [4.1] 2367d52 The actual fix for #1781 Message-ID: commit 2367d528ab370381a6d94551136aa18e977f2716 Author: Poul-Henning Kamp Date: Wed Sep 9 19:36:44 2015 +0000 The actual fix for #1781 See previous commit. diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index ff30ae3..5649769 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -228,7 +228,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, uint32_t icrc = 0; uint8_t tailbuf[8 + 5]; const uint8_t *pp; - struct ecx *ecx; + struct ecx *ecx, *pecx; int retval = 0; if (act == VDP_INIT) { @@ -360,6 +360,13 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, (void)VDP_bytes(req, VDP_NULL, tailbuf, 13); } + if (req->transport->deliver == VED_Deliver) { + CAST_OBJ_NOTNULL(pecx, req->transport_priv, + ECX_MAGIC); + pecx->crc = crc32_combine(pecx->crc, + ecx->crc, ecx->l_crc); + pecx->l_crc += ecx->l_crc; + } retval = VDP_bytes(req, VDP_FLUSH, NULL, 0); ecx->state = 99; return (retval); From phk at FreeBSD.org Thu Sep 10 12:37:29 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 14:37:29 +0200 Subject: [4.1] a6a6e97 Align code with RFC7230 section 3.3.3 which allows POST without a body. Message-ID: commit a6a6e97a4db6e94b14f81af55fea4d07aa06d0af Author: Poul-Henning Kamp Date: Thu Sep 10 09:16:33 2015 +0000 Align code with RFC7230 section 3.3.3 which allows POST without a body. Fixes: #1783 diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c index 77b8f5b..8fa7e9e 100644 --- a/bin/varnishd/http1/cache_http1_proto.c +++ b/bin/varnishd/http1/cache_http1_proto.c @@ -282,15 +282,19 @@ http1_body_status(struct http *hp, struct http_conn *htc) htc->content_length = -1; - if (http_HdrIs(hp, H_Transfer_Encoding, "chunked")) { - http_Unset(hp, H_Content_Length); + cl = http_GetContentLength(hp); + if (http_GetHdr(hp, H_Transfer_Encoding, &b)) { + if (strcasecmp(b, "chunked")) + return (BS_ERROR); + if (cl != -1) { + /* + * RFC7230 3.3.3 allows more lenient handling + * but we're going to be strict. + */ + return (BS_ERROR); + } return (BS_CHUNKED); } - - if (http_GetHdr(hp, H_Transfer_Encoding, &b)) - return (BS_ERROR); - - cl = http_GetContentLength(hp); if (cl == -2) return (BS_ERROR); if (cl >= 0) { @@ -298,6 +302,9 @@ http1_body_status(struct http *hp, struct http_conn *htc) return (cl == 0 ? BS_NONE : BS_LENGTH); } + if (hp->protover == 11) + return (BS_NONE); + if (http_HdrIs(hp, H_Connection, "keep-alive")) { /* * Keep alive with neither TE=Chunked or C-Len is impossible. @@ -306,20 +313,6 @@ http1_body_status(struct http *hp, struct http_conn *htc) return (BS_NONE); } - if (http_HdrIs(hp, H_Connection, "close")) { - /* - * In this case, it is safe to just read what comes. - */ - return (BS_EOF); - } - - if (hp->protover < 11) { - /* - * With no Connection header, assume EOF. - */ - return (BS_EOF); - } - /* * Fall back to EOF transfer. */ diff --git a/bin/varnishtest/tests/b00011.vtc b/bin/varnishtest/tests/b00011.vtc index 82381a8..d6c9eab 100644 --- a/bin/varnishtest/tests/b00011.vtc +++ b/bin/varnishtest/tests/b00011.vtc @@ -2,7 +2,7 @@ varnishtest "Check HTTP/1.0 EOF transmission" server s1 { rxreq - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send "Body line 1\n" diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index 1448ed5..d601501 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 # send "Baba\n" } -start diff --git a/bin/varnishtest/tests/b00021.vtc b/bin/varnishtest/tests/b00021.vtc index 3d4e241..46be8cb 100644 --- a/bin/varnishtest/tests/b00021.vtc +++ b/bin/varnishtest/tests/b00021.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 4.0 send "Baba\n" } -start @@ -26,7 +26,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.0 send "Baba\n" delay 1.0 diff --git a/bin/varnishtest/tests/b00022.vtc b/bin/varnishtest/tests/b00022.vtc index c232408..7bf6d95 100644 --- a/bin/varnishtest/tests/b00022.vtc +++ b/bin/varnishtest/tests/b00022.vtc @@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 1.5 send "Baba\n" } -start @@ -28,7 +28,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 diff --git a/bin/varnishtest/tests/c00013.vtc b/bin/varnishtest/tests/c00013.vtc index 081ed1f..689e118 100644 --- a/bin/varnishtest/tests/c00013.vtc +++ b/bin/varnishtest/tests/c00013.vtc @@ -3,7 +3,7 @@ varnishtest "Test parking second request on backend delay" server s1 { rxreq expect req.url == "/foo" - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay .2 sema r1 sync 2 delay .2 diff --git a/bin/varnishtest/tests/e00007.vtc b/bin/varnishtest/tests/e00007.vtc index a03ef55..635f19e 100644 --- a/bin/varnishtest/tests/e00007.vtc +++ b/bin/varnishtest/tests/e00007.vtc @@ -16,7 +16,7 @@ varnishtest "ESI spanning storage bits" server s1 { rxreq expect req.url == "/foo/bar" - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "Connection: close\n" send "\n" send { diff --git a/bin/varnishtest/tests/e00014.vtc b/bin/varnishtest/tests/e00014.vtc index 0097f13..0f90331 100644 --- a/bin/varnishtest/tests/e00014.vtc +++ b/bin/varnishtest/tests/e00014.vtc @@ -3,7 +3,7 @@ varnishtest "Check } diff --git a/bin/varnishtest/tests/g00002.vtc b/bin/varnishtest/tests/g00002.vtc index 712d51b..1abdd8e 100644 --- a/bin/varnishtest/tests/g00002.vtc +++ b/bin/varnishtest/tests/g00002.vtc @@ -4,7 +4,7 @@ server s1 { rxreq expect req.http.accept-encoding == "gzip" expect req.url == "/foo" - txresp -nolen -gziplen 4100 + txresp -proto HTTP/1.0 -nolen -gziplen 4100 accept rxreq expect req.url == "/bar" diff --git a/bin/varnishtest/tests/r00733.vtc b/bin/varnishtest/tests/r00733.vtc index 365f0ec..b6a1170 100644 --- a/bin/varnishtest/tests/r00733.vtc +++ b/bin/varnishtest/tests/r00733.vtc @@ -2,7 +2,7 @@ varnishtest "HTTP/1.1 Backend sends no length hint" server s1 { rxreq - send "HTTP/1.1 200 OK\n" + send "HTTP/1.0 200 OK\n" send "\n" send "12345" } -start diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index dd7e0da..a01bab2 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -1,30 +1,10 @@ varnishtest "C-L/T-E:chunked conflict" server s1 { - rxreqhdrs - expect req.http.content-length == - expect req.http.transfer-encoding == chunked - rxreqbody - expect req.url == /1 + rxreq expect req.bodylen == 20 - send "HTTP/1.1 200 OK" - send "Content-Length: 31\r\n" - send "Transfer-Encoding: chunked\r\n" - send "\r\n" - send "14\r\n" - send "0123456789" - send "0123456789" - send "0\r\n" - send "\r\n" - - rxreqhdrs - expect req.http.content-length == 20 - expect req.http.transfer-encoding == - expect req.url == /2 - expect req.bodylen == 20 - - send "HTTP/1.1 200 OK" + send "HTTP/1.1 200 OK\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" @@ -36,14 +16,7 @@ server s1 { } -start -varnish v1 -vcl+backend { - import ${vmod_std}; - sub vcl_recv { - if (req.url == "/2") { - std.cache_req_body(1KB); - } - } -} -start +varnish v1 -vcl+backend { } -start client c1 { @@ -56,12 +29,14 @@ client c1 { send "0123456789" send "0\r\n" send "\r\n" + rxresp - expect resp.bodylen == 20 + expect resp.status == 400 +} -run +client c1 { send "PUT /2 HTTP/1.1\r\n" - send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" send "14\r\n" @@ -69,7 +44,8 @@ client c1 { send "0123456789" send "0\r\n" send "\r\n" + rxresp - expect resp.bodylen == 20 + expect resp.status == 503 } -run diff --git a/bin/varnishtest/tests/r01783.vtc b/bin/varnishtest/tests/r01783.vtc new file mode 100644 index 0000000..c44b77f --- /dev/null +++ b/bin/varnishtest/tests/r01783.vtc @@ -0,0 +1,19 @@ +varnishtest "POST with no body" + +server s1 { + rxreq + txresp -hdr "foo: 1" + rxreq + txresp -hdr "foo: 2" +} -start + +varnish v1 -vcl+backend {} -start + +client c1 { + txreq -req "POST" -nolen + rxresp + expect resp.http.foo == 1 + txreq -req "POST" -nolen + rxresp + expect resp.http.foo == 2 +} -run From lkarsten at varnish-software.com Thu Sep 10 12:37:29 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:29 +0200 Subject: [4.1] 8e5c7a0 Add fallback on std conversion functions. Message-ID: commit 8e5c7a0a610200089d7aca5edbde6e25de5e804d Author: Lasse Karstensen Date: Thu Sep 10 14:21:04 2015 +0200 Add fallback on std conversion functions. Handle that conversion between VCL data type can fail, and return a user-specificed fallback in those cases. Mostly identical to patch from Arianna Aondio. diff --git a/bin/varnishtest/tests/m00016.vtc b/bin/varnishtest/tests/m00016.vtc index ef51f93..261f840 100644 --- a/bin/varnishtest/tests/m00016.vtc +++ b/bin/varnishtest/tests/m00016.vtc @@ -1,4 +1,4 @@ -varnishtest "Test std.real2time, std.time2integer and std.time2real" +varnishtest "Test real2integer, real2time, time2integer and time2real in std" server s1 { rxreq @@ -10,8 +10,18 @@ varnish v1 -vcl+backend { sub vcl_deliver { set resp.http.x-foo = std.integer(req.http.foo, 0); - set resp.http.x-bar = std.time2integer(std.real2time(std.real(resp.http.x-foo, 0.0))); - set resp.http.x-baz = std.time2real(std.real2time(std.real(resp.http.x-foo, 0.0))); + set resp.http.x-bar = std.time2integer(std.real2time( + std.real(resp.http.x-foo, 0.0), now), 1); + + set resp.http.x-baz = std.time2real(std.real2time( + std.real(resp.http.x-foo, 0.0), now), 1.0); + + set resp.http.x-qux = std.real2integer( + std.real(req.http.foo, 2.0), 2); + + # Representation of 9e99, which is larger than what fits in the + # 128bit integers on $exotic_platform. + set resp.http.x-int-fallback = std.real2integer(9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.000, 2); } } -start @@ -20,4 +30,15 @@ client c1 { rxresp expect resp.http.x-foo == resp.http.x-bar expect resp.http.x-baz == 1140618699.000 + expect resp.http.x-qux == 1140618699 + expect resp.http.x-int-fallback == 2 +} -run + +# check we get the fallback if the conversion fails +client c2 { + txreq -hdr "foo: -9e99+1" + rxresp + expect resp.http.x-bar == 0 + expect resp.http.x-baz == 0.000 + expect resp.http.x-qux == 2 } -run diff --git a/bin/varnishtest/tests/r01532.vtc b/bin/varnishtest/tests/r01532.vtc index c189f55..b1ff007 100644 --- a/bin/varnishtest/tests/r01532.vtc +++ b/bin/varnishtest/tests/r01532.vtc @@ -9,7 +9,7 @@ varnish v1 -vcl+backend { import ${vmod_std}; sub vcl_deliver { - set resp.http.x-foo = std.real2time(1140618699.00); + set resp.http.x-foo = std.real2time(1140618699.00, now); } } -start diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index 0ad385f..b082da3 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -128,7 +128,7 @@ Example $Function INT integer(STRING s, INT fallback) Description - Converts the string *s* to an integer. If conversion fails, + Converts the string *s* to an integer. If conversion fails, *fallback* will be returned. Example | if (std.integer(req.http.foo, 0) > 5) { @@ -139,7 +139,7 @@ $Function IP ip(STRING s, IP fallback) Description Converts the string *s* to the first IP number returned by - the system library function getaddrinfo(3). If conversion + the system library function getaddrinfo(3). If conversion fails, *fallback* will be returned. Example | if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { @@ -149,33 +149,44 @@ Example $Function REAL real(STRING s, REAL fallback) Description - Converts the string *s* to a real. If conversion fails, + Converts the string *s* to a real. If conversion fails, *fallback* will be returned. Example | if (std.real(req.http.foo, 0.0) > 5.5) { | ... | } -$Function TIME real2time(REAL r) +$Function INT real2integer(REAL r, INT fallback) Description - Converts the real *r* to a time. + Converts the real *r* to an integer. If conversion fails, + *fallback* will be returned. +Example + set req.http.integer = std.real2integer(1140618699.00, 0); + +$Function TIME real2time(REAL r, TIME fallback) + +Description + Converts the real *r* to a time. If conversion fails, + *fallback* will be returned. Example - set req.http.time = std.real2time(1140618699.00); + set req.http.time = std.real2time(1140618699.00, now); -$Function INT time2integer(TIME t) +$Function INT time2integer(TIME t, INT fallback) Description - Converts the time *t* to a integer. + Converts the time *t* to a integer. If conversion fails, + *fallback* will be returned. Example - set req.http.int = std.time2integer(now); + set req.http.int = std.time2integer(now, 0); -$Function REAL time2real(TIME t) +$Function REAL time2real(TIME t, REAL fallback) Description - Converts the time *t* to a real. + Converts the time *t* to a real. If conversion fails, + *fallback* will be returned. Example - set req.http.real = std.time2real(now); + set req.http.real = std.time2real(now, 1.0); $Function BOOL healthy(BACKEND be) @@ -241,7 +252,7 @@ Example $Function TIME time(STRING s, TIME fallback) Description - Converts the string *s* to a time. If conversion fails, + Converts the string *s* to a time. If conversion fails, *fallback* will be returned. Supported formats: diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 95bb003..131c3c1 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -187,27 +187,51 @@ vmod_real(VRT_CTX, VCL_STRING p, VCL_REAL d) return (r); } +VCL_INT __match_proto__(td_std_real2integer) +vmod_real2integer(VRT_CTX, VCL_REAL r, VCL_INT i) +{ + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + + if (!isfinite(r)) + return (i); + r = round(r); + if (r > LONG_MAX || r < LONG_MIN) + return(i); + return ((long)r); +} + VCL_TIME __match_proto__(td_std_real2time) -vmod_real2time(VRT_CTX, VCL_REAL r) +vmod_real2time(VRT_CTX, VCL_REAL r, VCL_TIME t) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + if (!isfinite(r)) + return (t); + return (r); } VCL_INT __match_proto__(td_std_time2integer) -vmod_time2integer(VRT_CTX, VCL_TIME t) +vmod_time2integer(VRT_CTX, VCL_TIME t, VCL_INT i) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); - return ((long)floor(t)); + if (!isfinite(t)) + return (i); + t = round(t); + if (t > LONG_MAX || t < LONG_MIN) + return(i); + return ((long)t); } VCL_REAL __match_proto__(td_std_time2real) -vmod_time2real(VRT_CTX, VCL_TIME t) +vmod_time2real(VRT_CTX, VCL_TIME t, VCL_REAL r) { CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + if (!isfinite(t)) + return (r); + return (t); } From lkarsten at varnish-software.com Thu Sep 10 12:37:29 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:29 +0200 Subject: [4.1] a0d628d Correct use of whitespace. Message-ID: commit a0d628d2a58192ab306e8e186bfea9241de67ef9 Author: Lasse Karstensen Date: Thu Sep 10 14:24:34 2015 +0200 Correct use of whitespace. diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index b082da3..0002426 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -109,7 +109,7 @@ $Function VOID collect(HEADER hdr) Description Collapses multiple *hdr* headers into one long header. - Care should be taken when collapsing headers. In particular + Care should be taken when collapsing headers. In particular collapsing Set-Cookie will lead to unexpected results on the browser side. Example diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 131c3c1..65df00c 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -142,7 +142,7 @@ vmod_ip(VRT_CTX, VCL_STRING s, VCL_IP d) p = WS_Alloc(ctx->ws, vsa_suckaddr_len); if (p == NULL) { VSLb(ctx->vsl, SLT_VCL_Error, - "vmod std.ip(): insufficient workspace"); + "vmod std.ip(): insufficient workspace"); return d; } r = NULL; From lkarsten at varnish-software.com Thu Sep 10 12:37:29 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 14:37:29 +0200 Subject: [4.1] d0bdfb1 Merge branch 'master' into 4.1 Message-ID: commit d0bdfb19e1095bf1bd52c04ad2e4f8ac4b3c7eb7 Merge: 72a0d5d a0d628d Author: Lasse Karstensen Date: Thu Sep 10 14:32:40 2015 +0200 Merge branch 'master' into 4.1 From martin at varnish-software.com Thu Sep 10 12:47:16 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Sep 2015 14:47:16 +0200 Subject: [master] 2ba2f46 Fix up accounting of body bytes in ESI subrequests Message-ID: commit 2ba2f46a6640027b781b1bff03c4f881f18b2b4e Author: Martin Blix Grydeland Date: Thu Sep 10 14:45:54 2015 +0200 Fix up accounting of body bytes in ESI subrequests diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 5649769..1580ec0 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -405,6 +405,18 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } } +/* + * Account body bytes on req + * Push bytes to preq + */ +static inline int +ved_bytes(struct req *req, struct req *preq, enum vdp_action act, + const void *ptr, ssize_t len) +{ + req->acct.resp_bodybytes += len; + return (VDP_bytes(preq, act, ptr, len)); +} + /*--------------------------------------------------------------------- * If a gzip'ed ESI object includes a ungzip'ed object, we need to make * it looked like a gzip'ed data stream. The official way to do so would @@ -431,9 +443,11 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, const uint8_t *p; uint16_t lx; struct ecx *ecx; + struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); + preq = ecx->preq; (void)priv; if (act == VDP_INIT) @@ -443,7 +457,7 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, return (0); } if (l == 0) - return (VDP_bytes(ecx->preq, act, pv, l)); + return (ved_bytes(req, ecx->preq, act, pv, l)); p = pv; @@ -460,23 +474,23 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, while (l > 0) { if (l >= 65535) { lx = 65535; - if (VDP_bytes(ecx->preq, VDP_NULL, buf1, sizeof buf1)) + if (ved_bytes(req, preq, VDP_NULL, buf1, sizeof buf1)) return (-1); } else { lx = (uint16_t)l; buf2[0] = 0; vle16enc(buf2 + 1, lx); vle16enc(buf2 + 3, ~lx); - if (VDP_bytes(ecx->preq, VDP_NULL, buf2, sizeof buf2)) + if (ved_bytes(req, preq, VDP_NULL, buf2, sizeof buf2)) return (-1); } - if (VDP_bytes(ecx->preq, VDP_NULL, p, lx)) + if (ved_bytes(req, preq, VDP_NULL, p, lx)) return (-1); l -= lx; p += lx; } /* buf2 is local, have to flush */ - return (VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0)); + return (ved_bytes(req, preq, VDP_FLUSH, NULL, 0)); } /*--------------------------------------------------------------------- @@ -515,10 +529,12 @@ ved_stripgzip(struct req *req, struct busyobj *bo) void *sp; ssize_t sl, ll, dl; struct ecx *ecx; + struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC); + preq = ecx->preq; if (bo != NULL) VBO_waitstate(bo, BOS_FINISHED); @@ -578,7 +594,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) if (dl > 0) { if (dl > sl) dl = sl; - if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl)) + if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; @@ -589,7 +605,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) /* Remove the "LAST" bit */ dbits[0] = *pp; dbits[0] &= ~(1U << (last & 7)); - if (VDP_bytes(ecx->preq, VDP_NULL, dbits, 1)) + if (ved_bytes(req, preq, VDP_NULL, dbits, 1)) break; ll++; sl--; @@ -601,7 +617,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) if (dl > 0) { if (dl > sl) dl = sl; - if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl)) + if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; @@ -663,7 +679,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) default: WRONG("compiler must be broken"); } - if (VDP_bytes(ecx->preq, VDP_NULL, dbits + 1, lpad)) + if (ved_bytes(req, preq, VDP_NULL, dbits + 1, lpad)) break; } if (sl > 0) { @@ -686,7 +702,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) } } while (ois == OIS_DATA || ois == OIS_STREAM); ObjIterEnd(req->objcore, &oi); - (void)VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0); + (void)ved_bytes(req, preq, VDP_FLUSH, NULL, 0); icrc = vle32dec(tailbuf); ilen = vle32dec(tailbuf + 4); @@ -711,8 +727,7 @@ ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv, return (0); } CAST_OBJ_NOTNULL(preq, *priv, REQ_MAGIC); - req->acct.resp_bodybytes += len; - return (VDP_bytes(preq, act, ptr, len)); + return (ved_bytes(req, preq, act, ptr, len)); } /*--------------------------------------------------------------------*/ From phk at FreeBSD.org Thu Sep 10 12:51:41 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 10 Sep 2015 14:51:41 +0200 Subject: [master] 443f181 Fixes to cope with new body determination code Message-ID: commit 443f181348853f3a8bc238dc94674b45d13dd5de Author: Poul-Henning Kamp Date: Thu Sep 10 12:51:05 2015 +0000 Fixes to cope with new body determination code diff --git a/bin/varnishtest/tests/r00325.vtc b/bin/varnishtest/tests/r00325.vtc index fabc001..b9c7a56 100644 --- a/bin/varnishtest/tests/r00325.vtc +++ b/bin/varnishtest/tests/r00325.vtc @@ -2,7 +2,7 @@ varnishtest "Check lack of response-string" server s1 { rxreq - send "HTTP/1.1 200 \r\n" + send "HTTP/1.0 200 \r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" @@ -20,7 +20,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200\r\n" + send "HTTP/1.0 200\r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index a01bab2..a7782d8 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -20,6 +20,7 @@ varnish v1 -vcl+backend { } -start client c1 { + non-fatal send "PUT /1 HTTP/1.1\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" @@ -35,7 +36,7 @@ client c1 { } -run client c1 { - + fatal send "PUT /2 HTTP/1.1\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" From martin at varnish-software.com Thu Sep 10 13:05:02 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Sep 2015 15:05:02 +0200 Subject: [master] deef173 Fix up r01729.vtc Message-ID: commit deef1737c9d5140b0dff7af0120bc8dbbd90526f Author: Martin Blix Grydeland Date: Thu Sep 10 15:03:47 2015 +0200 Fix up r01729.vtc Write failures in s1 are non-fatal diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index a7782d8..c6c4792 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -1,6 +1,7 @@ varnishtest "C-L/T-E:chunked conflict" server s1 { + non-fatal rxreq expect req.bodylen == 20 From martin at varnish-software.com Thu Sep 10 13:35:10 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Sep 2015 15:35:10 +0200 Subject: [master] 399aab7 Cast to integer to prevent negative values messing the statistics Message-ID: commit 399aab778dec87bae5212e1ef65c9f48bf692c23 Author: Martin Blix Grydeland Date: Thu Sep 10 15:31:14 2015 +0200 Cast to integer to prevent negative values messing the statistics Negative values can occur intermittently due to per worker caching of changes to counters. Fixes: #1778 diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c index 4637b61..3dd4230 100644 --- a/bin/varnishstat/varnishstat_curses.c +++ b/bin/varnishstat/varnishstat_curses.c @@ -384,14 +384,14 @@ sample_points(void) pt->t_cur = VTIM_mono(); if (pt->t_last) - pt->chg = ((intmax_t)pt->cur - (intmax_t)pt->last) / + pt->chg = ((int64_t)pt->cur - (int64_t)pt->last) / (pt->t_cur - pt->t_last); if (pt->semantics == 'g') { pt->avg = 0.; - update_ma(&pt->ma_10, pt->cur); - update_ma(&pt->ma_100, pt->cur); - update_ma(&pt->ma_1000, pt->cur); + update_ma(&pt->ma_10, (int64_t)pt->cur); + update_ma(&pt->ma_100, (int64_t)pt->cur); + update_ma(&pt->ma_1000, (int64_t)pt->cur); } else if (pt->semantics == 'c') { if (VSC_C_main != NULL && VSC_C_main->uptime) pt->avg = pt->cur / VSC_C_main->uptime; From martin at varnish-software.com Thu Sep 10 14:55:16 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Sep 2015 16:55:16 +0200 Subject: [master] 2a98068 Update varnishstat usage output Message-ID: commit 2a98068e6ed2e030b5fb6224f5ec2aa3944baa42 Author: Martin Blix Grydeland Date: Thu Sep 10 16:54:31 2015 +0200 Update varnishstat usage output Patch by: Arianna diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c index 2eda2bb..c7746d6 100644 --- a/bin/varnishstat/varnishstat.c +++ b/bin/varnishstat/varnishstat.c @@ -251,17 +251,21 @@ usage(void) { #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishstat " - "[-1lV] [-f field] " + "[-1lV] [-f field] [-t seconds|] " VSC_n_USAGE "\n"); fprintf(stderr, FMT, "-1", "Print the statistics to stdout."); fprintf(stderr, FMT, "-f field", "Field inclusion glob"); fprintf(stderr, FMT, "", - "If it starts with '^' it is used as an exclusion list"); + "If it starts with '^' it is used as an exclusion list."); fprintf(stderr, FMT, "-l", - "Lists the available fields to use with the -f option"); + "Lists the available fields to use with the -f option."); fprintf(stderr, FMT, "-n varnish_name", - "The varnishd instance to get logs from"); - fprintf(stderr, FMT, "-V", "Display the version number and exit"); + "The varnishd instance to get logs from."); + fprintf(stderr, FMT, "-N filename", + "Filename of a stale VSM instance."); + fprintf(stderr, FMT, "-t seconds|", + "Timeout before returning error on initial VSM connection."); + fprintf(stderr, FMT, "-V", "Display the version number and exit."); fprintf(stderr, FMT, "-x", "Print statistics to stdout as XML."); fprintf(stderr, FMT, "-j", diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index b85e8a8..5eef680 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -15,7 +15,7 @@ Varnish Cache statistics SYNOPSIS ======== -varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V] +varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|] [-V] .. TODO: autogenerate this synopsis like the others. From lkarsten at varnish-software.com Thu Sep 10 15:00:17 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Sep 2015 17:00:17 +0200 Subject: [master] d71e831 Increase libvarnishapi libtool revision number. Message-ID: commit d71e8311659b469968a147be2c85d2a0852797bd Author: Lasse Karstensen Date: Thu Sep 10 16:45:30 2015 +0200 Increase libvarnishapi libtool revision number. This number was last changed between Varnish 1.0 and Varnish 2.0. As far as I can read from the commits, we haven't actually removed any interfaces in any released Varnish versions, so a revision bump should be all that is needed. Another possibility is to stop using -version-info and just roll our own scheme with -release, but I don't want to go down that route just before 4.1.0. diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am index 68a89bd..c7fb0e4 100644 --- a/lib/libvarnishapi/Makefile.am +++ b/lib/libvarnishapi/Makefile.am @@ -9,7 +9,7 @@ AM_CPPFLAGS = \ lib_LTLIBRARIES = libvarnishapi.la -libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 +libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:4:0 libvarnishapi_la_SOURCES = \ vsm_api.h \ From fgsch at lodoss.net Thu Sep 10 16:19:59 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 10 Sep 2015 18:19:59 +0200 Subject: [master] b12a97b Send stderr to the right file Message-ID: commit b12a97b7b16bcc143f2081d59bb8fbd24c4ad541 Author: Federico G. Schwindt Date: Thu Sep 10 16:44:38 2015 +0100 Send stderr to the right file While here print signals and exit code in decimal. diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c index fffe9bf..88962b5 100644 --- a/bin/varnishtest/vtc_process.c +++ b/bin/varnishtest/vtc_process.c @@ -165,11 +165,11 @@ process_thread(void *priv) if (WIFEXITED(p->status) && WEXITSTATUS(p->status) == 0) return (NULL); #ifdef WCOREDUMP - vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x core %x", + vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d core %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status), WCOREDUMP(p->status)); #else - vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x", + vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status)); #endif @@ -202,7 +202,7 @@ process_start(struct process *p) if (p->pid == 0) { assert(dup2(p->fds[0], 0) == 0); assert(dup2(out_fd, 1) == 1); - assert(dup2(out_fd, 2) == 2); + assert(dup2(err_fd, 2) == 2); for (i = 3; i commit 6ad2dd4d6661c9b67efe47c0e5875b7cf2eba6f8 Author: Federico G. Schwindt Date: Thu Sep 10 17:48:08 2015 +0100 Ignore close() return value We might have exit'd earlier. diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c index 88962b5..c0a15c2 100644 --- a/bin/varnishtest/vtc_process.c +++ b/bin/varnishtest/vtc_process.c @@ -299,7 +299,7 @@ process_close(struct process *p) if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot close on a non-running process"); - AZ(close(p->fds[1])); + (void)close(p->fds[1]); p->fds[1] = -1; } From martin at varnish-software.com Fri Sep 11 07:19:23 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] 2ba2f46 Fix up accounting of body bytes in ESI subrequests Message-ID: commit 2ba2f46a6640027b781b1bff03c4f881f18b2b4e Author: Martin Blix Grydeland Date: Thu Sep 10 14:45:54 2015 +0200 Fix up accounting of body bytes in ESI subrequests diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 5649769..1580ec0 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -405,6 +405,18 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } } +/* + * Account body bytes on req + * Push bytes to preq + */ +static inline int +ved_bytes(struct req *req, struct req *preq, enum vdp_action act, + const void *ptr, ssize_t len) +{ + req->acct.resp_bodybytes += len; + return (VDP_bytes(preq, act, ptr, len)); +} + /*--------------------------------------------------------------------- * If a gzip'ed ESI object includes a ungzip'ed object, we need to make * it looked like a gzip'ed data stream. The official way to do so would @@ -431,9 +443,11 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, const uint8_t *p; uint16_t lx; struct ecx *ecx; + struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); + preq = ecx->preq; (void)priv; if (act == VDP_INIT) @@ -443,7 +457,7 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, return (0); } if (l == 0) - return (VDP_bytes(ecx->preq, act, pv, l)); + return (ved_bytes(req, ecx->preq, act, pv, l)); p = pv; @@ -460,23 +474,23 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, while (l > 0) { if (l >= 65535) { lx = 65535; - if (VDP_bytes(ecx->preq, VDP_NULL, buf1, sizeof buf1)) + if (ved_bytes(req, preq, VDP_NULL, buf1, sizeof buf1)) return (-1); } else { lx = (uint16_t)l; buf2[0] = 0; vle16enc(buf2 + 1, lx); vle16enc(buf2 + 3, ~lx); - if (VDP_bytes(ecx->preq, VDP_NULL, buf2, sizeof buf2)) + if (ved_bytes(req, preq, VDP_NULL, buf2, sizeof buf2)) return (-1); } - if (VDP_bytes(ecx->preq, VDP_NULL, p, lx)) + if (ved_bytes(req, preq, VDP_NULL, p, lx)) return (-1); l -= lx; p += lx; } /* buf2 is local, have to flush */ - return (VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0)); + return (ved_bytes(req, preq, VDP_FLUSH, NULL, 0)); } /*--------------------------------------------------------------------- @@ -515,10 +529,12 @@ ved_stripgzip(struct req *req, struct busyobj *bo) void *sp; ssize_t sl, ll, dl; struct ecx *ecx; + struct req *preq; CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(ecx, req->transport_priv, ECX_MAGIC); + preq = ecx->preq; if (bo != NULL) VBO_waitstate(bo, BOS_FINISHED); @@ -578,7 +594,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) if (dl > 0) { if (dl > sl) dl = sl; - if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl)) + if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; @@ -589,7 +605,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) /* Remove the "LAST" bit */ dbits[0] = *pp; dbits[0] &= ~(1U << (last & 7)); - if (VDP_bytes(ecx->preq, VDP_NULL, dbits, 1)) + if (ved_bytes(req, preq, VDP_NULL, dbits, 1)) break; ll++; sl--; @@ -601,7 +617,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) if (dl > 0) { if (dl > sl) dl = sl; - if (VDP_bytes(ecx->preq, VDP_NULL, pp, dl)) + if (ved_bytes(req, preq, VDP_NULL, pp, dl)) break; ll += dl; sl -= dl; @@ -663,7 +679,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) default: WRONG("compiler must be broken"); } - if (VDP_bytes(ecx->preq, VDP_NULL, dbits + 1, lpad)) + if (ved_bytes(req, preq, VDP_NULL, dbits + 1, lpad)) break; } if (sl > 0) { @@ -686,7 +702,7 @@ ved_stripgzip(struct req *req, struct busyobj *bo) } } while (ois == OIS_DATA || ois == OIS_STREAM); ObjIterEnd(req->objcore, &oi); - (void)VDP_bytes(ecx->preq, VDP_FLUSH, NULL, 0); + (void)ved_bytes(req, preq, VDP_FLUSH, NULL, 0); icrc = vle32dec(tailbuf); ilen = vle32dec(tailbuf + 4); @@ -711,8 +727,7 @@ ved_vdp_bytes(struct req *req, enum vdp_action act, void **priv, return (0); } CAST_OBJ_NOTNULL(preq, *priv, REQ_MAGIC); - req->acct.resp_bodybytes += len; - return (VDP_bytes(preq, act, ptr, len)); + return (ved_bytes(req, preq, act, ptr, len)); } /*--------------------------------------------------------------------*/ From phk at FreeBSD.org Fri Sep 11 07:19:23 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] 443f181 Fixes to cope with new body determination code Message-ID: commit 443f181348853f3a8bc238dc94674b45d13dd5de Author: Poul-Henning Kamp Date: Thu Sep 10 12:51:05 2015 +0000 Fixes to cope with new body determination code diff --git a/bin/varnishtest/tests/r00325.vtc b/bin/varnishtest/tests/r00325.vtc index fabc001..b9c7a56 100644 --- a/bin/varnishtest/tests/r00325.vtc +++ b/bin/varnishtest/tests/r00325.vtc @@ -2,7 +2,7 @@ varnishtest "Check lack of response-string" server s1 { rxreq - send "HTTP/1.1 200 \r\n" + send "HTTP/1.0 200 \r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" @@ -20,7 +20,7 @@ client c1 { server s1 { rxreq - send "HTTP/1.1 200\r\n" + send "HTTP/1.0 200\r\n" send "Connection: close\r\n" send "\r\n" send "\r\n" diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index a01bab2..a7782d8 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -20,6 +20,7 @@ varnish v1 -vcl+backend { } -start client c1 { + non-fatal send "PUT /1 HTTP/1.1\r\n" send "Content-Length: 31\r\n" send "Transfer-Encoding: chunked\r\n" @@ -35,7 +36,7 @@ client c1 { } -run client c1 { - + fatal send "PUT /2 HTTP/1.1\r\n" send "Transfer-Encoding: chunked\r\n" send "\r\n" From martin at varnish-software.com Fri Sep 11 07:19:23 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] deef173 Fix up r01729.vtc Message-ID: commit deef1737c9d5140b0dff7af0120bc8dbbd90526f Author: Martin Blix Grydeland Date: Thu Sep 10 15:03:47 2015 +0200 Fix up r01729.vtc Write failures in s1 are non-fatal diff --git a/bin/varnishtest/tests/r01729.vtc b/bin/varnishtest/tests/r01729.vtc index a7782d8..c6c4792 100644 --- a/bin/varnishtest/tests/r01729.vtc +++ b/bin/varnishtest/tests/r01729.vtc @@ -1,6 +1,7 @@ varnishtest "C-L/T-E:chunked conflict" server s1 { + non-fatal rxreq expect req.bodylen == 20 From martin at varnish-software.com Fri Sep 11 07:19:23 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] 399aab7 Cast to integer to prevent negative values messing the statistics Message-ID: commit 399aab778dec87bae5212e1ef65c9f48bf692c23 Author: Martin Blix Grydeland Date: Thu Sep 10 15:31:14 2015 +0200 Cast to integer to prevent negative values messing the statistics Negative values can occur intermittently due to per worker caching of changes to counters. Fixes: #1778 diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c index 4637b61..3dd4230 100644 --- a/bin/varnishstat/varnishstat_curses.c +++ b/bin/varnishstat/varnishstat_curses.c @@ -384,14 +384,14 @@ sample_points(void) pt->t_cur = VTIM_mono(); if (pt->t_last) - pt->chg = ((intmax_t)pt->cur - (intmax_t)pt->last) / + pt->chg = ((int64_t)pt->cur - (int64_t)pt->last) / (pt->t_cur - pt->t_last); if (pt->semantics == 'g') { pt->avg = 0.; - update_ma(&pt->ma_10, pt->cur); - update_ma(&pt->ma_100, pt->cur); - update_ma(&pt->ma_1000, pt->cur); + update_ma(&pt->ma_10, (int64_t)pt->cur); + update_ma(&pt->ma_100, (int64_t)pt->cur); + update_ma(&pt->ma_1000, (int64_t)pt->cur); } else if (pt->semantics == 'c') { if (VSC_C_main != NULL && VSC_C_main->uptime) pt->avg = pt->cur / VSC_C_main->uptime; From martin at varnish-software.com Fri Sep 11 07:19:23 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] 2a98068 Update varnishstat usage output Message-ID: commit 2a98068e6ed2e030b5fb6224f5ec2aa3944baa42 Author: Martin Blix Grydeland Date: Thu Sep 10 16:54:31 2015 +0200 Update varnishstat usage output Patch by: Arianna diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c index 2eda2bb..c7746d6 100644 --- a/bin/varnishstat/varnishstat.c +++ b/bin/varnishstat/varnishstat.c @@ -251,17 +251,21 @@ usage(void) { #define FMT " %-28s # %s\n" fprintf(stderr, "usage: varnishstat " - "[-1lV] [-f field] " + "[-1lV] [-f field] [-t seconds|] " VSC_n_USAGE "\n"); fprintf(stderr, FMT, "-1", "Print the statistics to stdout."); fprintf(stderr, FMT, "-f field", "Field inclusion glob"); fprintf(stderr, FMT, "", - "If it starts with '^' it is used as an exclusion list"); + "If it starts with '^' it is used as an exclusion list."); fprintf(stderr, FMT, "-l", - "Lists the available fields to use with the -f option"); + "Lists the available fields to use with the -f option."); fprintf(stderr, FMT, "-n varnish_name", - "The varnishd instance to get logs from"); - fprintf(stderr, FMT, "-V", "Display the version number and exit"); + "The varnishd instance to get logs from."); + fprintf(stderr, FMT, "-N filename", + "Filename of a stale VSM instance."); + fprintf(stderr, FMT, "-t seconds|", + "Timeout before returning error on initial VSM connection."); + fprintf(stderr, FMT, "-V", "Display the version number and exit."); fprintf(stderr, FMT, "-x", "Print statistics to stdout as XML."); fprintf(stderr, FMT, "-j", diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index b85e8a8..5eef680 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -15,7 +15,7 @@ Varnish Cache statistics SYNOPSIS ======== -varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-V] +varnishstat [-1] [-x] [-j] [-f field] [-l] [-n varnish_name] [-N filename] [-t seconds|] [-V] .. TODO: autogenerate this synopsis like the others. From lkarsten at varnish-software.com Fri Sep 11 07:19:23 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] d71e831 Increase libvarnishapi libtool revision number. Message-ID: commit d71e8311659b469968a147be2c85d2a0852797bd Author: Lasse Karstensen Date: Thu Sep 10 16:45:30 2015 +0200 Increase libvarnishapi libtool revision number. This number was last changed between Varnish 1.0 and Varnish 2.0. As far as I can read from the commits, we haven't actually removed any interfaces in any released Varnish versions, so a revision bump should be all that is needed. Another possibility is to stop using -version-info and just roll our own scheme with -release, but I don't want to go down that route just before 4.1.0. diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am index 68a89bd..c7fb0e4 100644 --- a/lib/libvarnishapi/Makefile.am +++ b/lib/libvarnishapi/Makefile.am @@ -9,7 +9,7 @@ AM_CPPFLAGS = \ lib_LTLIBRARIES = libvarnishapi.la -libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:0:0 +libvarnishapi_la_LDFLAGS = $(AM_LDFLAGS) -version-info 1:4:0 libvarnishapi_la_SOURCES = \ vsm_api.h \ From fgsch at lodoss.net Fri Sep 11 07:19:23 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] b12a97b Send stderr to the right file Message-ID: commit b12a97b7b16bcc143f2081d59bb8fbd24c4ad541 Author: Federico G. Schwindt Date: Thu Sep 10 16:44:38 2015 +0100 Send stderr to the right file While here print signals and exit code in decimal. diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c index fffe9bf..88962b5 100644 --- a/bin/varnishtest/vtc_process.c +++ b/bin/varnishtest/vtc_process.c @@ -165,11 +165,11 @@ process_thread(void *priv) if (WIFEXITED(p->status) && WEXITSTATUS(p->status) == 0) return (NULL); #ifdef WCOREDUMP - vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x core %x", + vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d core %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status), WCOREDUMP(p->status)); #else - vtc_log(p->vl, 2, "Bad exit code: %04x sig %x exit %x", + vtc_log(p->vl, 2, "Bad exit code: %04x sig %d exit %d", p->status, WTERMSIG(p->status), WEXITSTATUS(p->status)); #endif @@ -202,7 +202,7 @@ process_start(struct process *p) if (p->pid == 0) { assert(dup2(p->fds[0], 0) == 0); assert(dup2(out_fd, 1) == 1); - assert(dup2(out_fd, 2) == 2); + assert(dup2(err_fd, 2) == 2); for (i = 3; i commit 6ad2dd4d6661c9b67efe47c0e5875b7cf2eba6f8 Author: Federico G. Schwindt Date: Thu Sep 10 17:48:08 2015 +0100 Ignore close() return value We might have exit'd earlier. diff --git a/bin/varnishtest/vtc_process.c b/bin/varnishtest/vtc_process.c index 88962b5..c0a15c2 100644 --- a/bin/varnishtest/vtc_process.c +++ b/bin/varnishtest/vtc_process.c @@ -299,7 +299,7 @@ process_close(struct process *p) if (!p->running || !p->pid) vtc_log(p->vl, 0, "Cannot close on a non-running process"); - AZ(close(p->fds[1])); + (void)close(p->fds[1]); p->fds[1] = -1; } From lkarsten at varnish-software.com Fri Sep 11 07:19:23 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 09:19:23 +0200 Subject: [4.1] 0776128 Merge branch 'master' into 4.1 Message-ID: commit 0776128def92a061da5eb44476e2cda133a44dce Merge: d0bdfb1 6ad2dd4 Author: Lasse Karstensen Date: Fri Sep 11 09:19:13 2015 +0200 Merge branch 'master' into 4.1 From lkarsten at varnish-software.com Fri Sep 11 08:38:18 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 10:38:18 +0200 Subject: [master] d428b35 Move deprication notice. Message-ID: commit d428b3535698ec35943de7506e43b7b09d3e9c6d Author: Lasse Karstensen Date: Fri Sep 11 09:51:15 2015 +0200 Move deprication notice. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 1da50fe..63c7343 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -117,6 +117,11 @@ these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created. +Protocol support +================ + +Support for HTTP/0.9 on the client side has been retired. + Surrogate keys ============== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index bcdf8c5..2921d10 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -49,12 +49,6 @@ Additionally, the ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities must now be run in a context with `varnish` group membership. -Protocol support -================ - -Support for HTTP/0.9 on the client side has been retired. - - Changes to parameters ===================== From lkarsten at varnish-software.com Fri Sep 11 08:38:18 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 10:38:18 +0200 Subject: [master] 7a5d2cb Add notice about casting/converting data types. Message-ID: commit 7a5d2cb378040df1e949e920ce56b94bf1ff6262 Author: Lasse Karstensen Date: Fri Sep 11 10:37:26 2015 +0200 Add notice about casting/converting data types. diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index b6d7702..6e55cdf 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -400,6 +400,10 @@ regsuball(str, regex, sub) .. regsub* is in vcc_expr.c +For converting or casting VCL values between data types use the functions +available in the std VMOD. + + EXAMPLES ======== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index 2921d10..e23c96d 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -7,7 +7,12 @@ Upgrading to Varnish 4.1 (unreleased) Changes to VCL ============== -Not documented yet. +Data type conversion functions now take a fallback +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Data type conversion functions in the std vmod now takes an additional +argument *fallback*, which is returned if the conversion does not succeed. + Version statement is kept ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -32,11 +37,11 @@ preamble. On normal HTTP listeners the behaviour is unchanged. Management interface ==================== -The management interface enabled with ``-M`` used to support the telnet +The management interface enabled with ``-M`` previously supported the telnet protocol. -Support for telnet control sequences have been retired. Replacements are netcat -or (preferred) ``varnishadm``. +Support for telnet control sequences have been retired. Replacement clients +like netcat or (preferred) ``varnishadm`` should be used instead. Runtime users and groups @@ -65,4 +70,3 @@ The following parameters have been retired: * `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. - From lkarsten at varnish-software.com Fri Sep 11 08:38:57 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 10:38:57 +0200 Subject: [4.1] fd0935d Move deprication notice. Message-ID: commit fd0935d9efe8077fc8da62eebc80fcc874425227 Author: Lasse Karstensen Date: Fri Sep 11 09:51:15 2015 +0200 Move deprication notice. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 1da50fe..63c7343 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -117,6 +117,11 @@ these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created. +Protocol support +================ + +Support for HTTP/0.9 on the client side has been retired. + Surrogate keys ============== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index bcdf8c5..2921d10 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -49,12 +49,6 @@ Additionally, the ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities must now be run in a context with `varnish` group membership. -Protocol support -================ - -Support for HTTP/0.9 on the client side has been retired. - - Changes to parameters ===================== From lkarsten at varnish-software.com Fri Sep 11 08:38:57 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 10:38:57 +0200 Subject: [4.1] 3415e80 Add notice about casting/converting data types. Message-ID: commit 3415e805bedf1cc4cc67599371cbb24623212597 Author: Lasse Karstensen Date: Fri Sep 11 10:37:26 2015 +0200 Add notice about casting/converting data types. diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index b6d7702..6e55cdf 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -400,6 +400,10 @@ regsuball(str, regex, sub) .. regsub* is in vcc_expr.c +For converting or casting VCL values between data types use the functions +available in the std VMOD. + + EXAMPLES ======== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index 2921d10..e23c96d 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -7,7 +7,12 @@ Upgrading to Varnish 4.1 (unreleased) Changes to VCL ============== -Not documented yet. +Data type conversion functions now take a fallback +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Data type conversion functions in the std vmod now takes an additional +argument *fallback*, which is returned if the conversion does not succeed. + Version statement is kept ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -32,11 +37,11 @@ preamble. On normal HTTP listeners the behaviour is unchanged. Management interface ==================== -The management interface enabled with ``-M`` used to support the telnet +The management interface enabled with ``-M`` previously supported the telnet protocol. -Support for telnet control sequences have been retired. Replacements are netcat -or (preferred) ``varnishadm``. +Support for telnet control sequences have been retired. Replacement clients +like netcat or (preferred) ``varnishadm`` should be used instead. Runtime users and groups @@ -65,4 +70,3 @@ The following parameters have been retired: * `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. - From lkarsten at varnish-software.com Fri Sep 11 09:00:42 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 11:00:42 +0200 Subject: [master] ef8a972 Update copyright. Message-ID: commit ef8a972bed0cba571f0086c7c6129fcadc667229 Author: Lasse Karstensen Date: Fri Sep 11 10:58:08 2015 +0200 Update copyright. Updating copyright on all files with git commits so far this year. diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c index 954a8be..1f02da9 100644 --- a/bin/varnishadm/varnishadm.c +++ b/bin/varnishadm/varnishadm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Cecilie Fritzvold diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl index e4c2a6f..6430cd7 100644 --- a/bin/varnishd/builtin.vcl +++ b/bin/varnishd/builtin.vcl @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index fd596f7..f63c8b4 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 5dc4abe..00193ec 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index c887868..0e84bae 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h index 42f9c91..016bcb0 100644 --- a/bin/varnishd/cache/cache_filter.h +++ b/bin/varnishd/cache/cache_filter.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index 8079e2b..7b08f3e 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 03a4f77..3580204 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 9925ea8..41c6c9e 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 9b2580e..4011e95 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index e41654d..585a63e 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c index ae49087..e733686 100644 --- a/bin/varnishd/cache/cache_shmlog.c +++ b/bin/varnishd/cache/cache_shmlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c index 8424223..a7bd7a3 100644 --- a/bin/varnishd/cache/cache_vary.c +++ b/bin/varnishd/cache/cache_vary.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 814d4af..642e754 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c index 22b45de..c499312 100644 --- a/bin/varnishd/cache/cache_vrt_priv.c +++ b/bin/varnishd/cache/cache_vrt_priv.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c index c1ea167..f8be46f 100644 --- a/bin/varnishd/cache/cache_vrt_re.c +++ b/bin/varnishd/cache/cache_vrt_re.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h index 47a68cb..f8d7a08 100644 --- a/bin/varnishd/hash/hash_slinger.h +++ b/bin/varnishd/hash/hash_slinger.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 21fc961..fdd176a 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index c63716d..fe99ebd 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index 8c80f58..658aca4 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 69c90d8..1d2a7a3 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index e6318c1..876b6d3 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index fa9dabf..12baf83 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index c94e0c8..77a601c 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2014 Varnish Software AS + * Copyright (c) 2007-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Sm?rgav diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c index 310eccc..aec72e9 100644 --- a/bin/varnishhist/varnishhist.c +++ b/bin/varnishhist/varnishhist.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishhist/varnishhist_options.h b/bin/varnishhist/varnishhist_options.h index a04a7e0..5241539 100644 --- a/bin/varnishhist/varnishhist_options.h +++ b/bin/varnishhist/varnishhist_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c index 68a8f33..3b5061f 100644 --- a/bin/varnishlog/varnishlog.c +++ b/bin/varnishlog/varnishlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishlog/varnishlog_options.h b/bin/varnishlog/varnishlog_options.h index 82d9c0d..187ac57 100644 --- a/bin/varnishlog/varnishlog_options.h +++ b/bin/varnishlog/varnishlog_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 9283beb..77e6354 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Anders Berg diff --git a/bin/varnishncsa/varnishncsa_options.c b/bin/varnishncsa/varnishncsa_options.c index 5bd9277..44e3dfe 100644 --- a/bin/varnishncsa/varnishncsa_options.c +++ b/bin/varnishncsa/varnishncsa_options.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index b74c688..520feb7 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c index 05ee65b..1c00ed0 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3c4c733..3ab9009 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index f3529a0..b2fc39a 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/configure.ac b/configure.ac index 48af690..77b61d4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2014 Varnish Software AS]) +Copyright (c) 2006-2015 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index 4098afd..9a2d0de 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -321,4 +321,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2011-2014 Varnish Software AS +* Copyright (c) 2011-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishadm.rst b/doc/sphinx/reference/varnishadm.rst index f671d8f..41e879a 100644 --- a/doc/sphinx/reference/varnishadm.rst +++ b/doc/sphinx/reference/varnishadm.rst @@ -90,4 +90,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst index 6af9746..88043d3 100644 --- a/doc/sphinx/reference/varnishhist.rst +++ b/doc/sphinx/reference/varnishhist.rst @@ -54,4 +54,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst index e3ae098..d94c333 100644 --- a/doc/sphinx/reference/varnishlog.rst +++ b/doc/sphinx/reference/varnishlog.rst @@ -62,4 +62,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index d98f6e2..6475fcf 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -156,4 +156,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 14c4ee4..5aa1928 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -141,4 +141,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtop.rst b/doc/sphinx/reference/varnishtop.rst index 2729966..b9f2b07 100644 --- a/doc/sphinx/reference/varnishtop.rst +++ b/doc/sphinx/reference/varnishtop.rst @@ -71,4 +71,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 6e55cdf..cd942e6 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -432,4 +432,4 @@ This document is licensed under the same license as Varnish itself. See LICENSE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index 870d718..7b5c721 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2014 Varnish Software AS +# Copyright (c) 2012-2015 Varnish Software AS # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/include/tbl/acct_fields_req.h b/include/tbl/acct_fields_req.h index fece3dc..44ce5b8 100644 --- a/include/tbl/acct_fields_req.h +++ b/include/tbl/acct_fields_req.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2008 Verdens Gang AS - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/bo_flags.h b/include/tbl/bo_flags.h index dac83b2..fedde3f 100644 --- a/include/tbl/bo_flags.h +++ b/include/tbl/bo_flags.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/req_body.h b/include/tbl/req_body.h index be0cd91..e9e32b7 100644 --- a/include/tbl/req_body.h +++ b/include/tbl/req_body.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/steps.h b/include/tbl/steps.h index 2c805d4..4756d44 100644 --- a/include/tbl/steps.h +++ b/include/tbl/steps.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_all.h b/include/tbl/vsc_all.h index 0ef0b08..8b681de 100644 --- a/include/tbl/vsc_all.h +++ b/include/tbl/vsc_all.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index d592016..bf9e198 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h index 1247deb..609586e 100644 --- a/include/vapi/vsc.h +++ b/include/vapi/vsc.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc_int.h b/include/vapi/vsc_int.h index 376a755..44a2d83 100644 --- a/include/vapi/vsc_int.h +++ b/include/vapi/vsc_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index dd2f6af..599c654 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h index 15ed9af..206c045 100644 --- a/include/vapi/vsl_int.h +++ b/include/vapi/vsl_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h index c67e140..4aebe1f 100644 --- a/include/vapi/vsm.h +++ b/include/vapi/vsm.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm_int.h b/include/vapi/vsm_int.h index 4b84c44..deed9f7 100644 --- a/include/vapi/vsm_int.h +++ b/include/vapi/vsm_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vdef.h b/include/vdef.h index f6592b3..a015b05 100644 --- a/include/vdef.h +++ b/include/vdef.h @@ -1,7 +1,7 @@ /*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2012 Fastly Inc - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsl_priv.h b/include/vsl_priv.h index 0c780dc..6296a5b 100644 --- a/include/vsl_priv.h +++ b/include/vsl_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsm_priv.h b/include/vsm_priv.h index e6893cc..4d0d401 100644 --- a/include/vsm_priv.h +++ b/include/vsm_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vut.h b/include/vut.h index c455662..241aa94 100644 --- a/include/vut.h +++ b/include/vut.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vut_options.h b/include/vut_options.h index 42298c4..a5b11ef 100644 --- a/include/vut_options.h +++ b/include/vut_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/generate.py b/lib/libvarnishapi/generate.py index 28aa8ae..00205cd 100755 --- a/lib/libvarnishapi/generate.py +++ b/lib/libvarnishapi/generate.py @@ -1,7 +1,7 @@ #!/usr/bin/env python #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2014 Varnish Software AS +# Copyright (c) 2006-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map index 216eded..653342f 100644 --- a/lib/libvarnishapi/libvarnishapi.map +++ b/lib/libvarnishapi/libvarnishapi.map @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c index 7ea599d..c86852d 100644 --- a/lib/libvarnishapi/vsc.c +++ b/lib/libvarnishapi/vsc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 8bd6033..0197e11 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl2rst.c b/lib/libvarnishapi/vsl2rst.c index f443a91..b9f7413 100644 --- a/lib/libvarnishapi/vsl2rst.c +++ b/lib/libvarnishapi/vsl2rst.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h index 584bc8c..c77ba28 100644 --- a/lib/libvarnishapi/vsl_api.h +++ b/lib/libvarnishapi/vsl_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c index e6b2b89..cc14e94 100644 --- a/lib/libvarnishapi/vsl_arg.c +++ b/lib/libvarnishapi/vsl_arg.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c index 28e44fe..e908bd7 100644 --- a/lib/libvarnishapi/vsl_cursor.c +++ b/lib/libvarnishapi/vsl_cursor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 3245e48..bbcd7cc 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c index 989ee0a..1ad6811 100644 --- a/lib/libvarnishapi/vsl_query.c +++ b/lib/libvarnishapi/vsl_query.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c index c802518..8e1aa7f 100644 --- a/lib/libvarnishapi/vsm.c +++ b/lib/libvarnishapi/vsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h index 7df8c88..8ef537b 100644 --- a/lib/libvarnishapi/vsm_api.h +++ b/lib/libvarnishapi/vsm_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c index 47f4200..5dad106 100644 --- a/lib/libvarnishapi/vxp.c +++ b/lib/libvarnishapi/vxp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp.h b/lib/libvarnishapi/vxp.h index 0589775..afed0d0 100644 --- a/lib/libvarnishapi/vxp.h +++ b/lib/libvarnishapi/vxp.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_lexer.c b/lib/libvarnishapi/vxp_lexer.c index 73846a8..ee616a9 100644 --- a/lib/libvarnishapi/vxp_lexer.c +++ b/lib/libvarnishapi/vxp_lexer.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index ce4c2eb..7ec8865 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_test.c b/lib/libvarnishapi/vxp_test.c index d00d35f..55e5820 100644 --- a/lib/libvarnishapi/vxp_test.c +++ b/lib/libvarnishapi/vxp_test.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c index 72ba126..40d001b 100644 --- a/lib/libvarnishtools/vut.c +++ b/lib/libvarnishtools/vut.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index 4a026b0..41eac6b 100644 --- a/lib/libvcc/vcc_action.c +++ b/lib/libvcc/vcc_action.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index 14aedf3..8a413c7 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c index 36f813a..4bd7821 100644 --- a/lib/libvcc/vcc_compile.c +++ b/lib/libvcc/vcc_compile.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h index 893369e..4c155a1 100644 --- a/lib/libvcc/vcc_compile.h +++ b/lib/libvcc/vcc_compile.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c index 510a03f..accabd6 100644 --- a/lib/libvcc/vcc_parse.c +++ b/lib/libvcc/vcc_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c index b78d2f4..3882e5a 100644 --- a/lib/libvcc/vcc_storage.c +++ b/lib/libvcc/vcc_storage.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index c5ea59e..049c177 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index e7a7f4f..e8bab4f 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 85a9ac2..0d55316 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #- -# Copyright (c) 2010-2014 Varnish Software AS +# Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_debug/vmod_debug_obj.c b/lib/libvmod_debug/vmod_debug_obj.c index 19a966c..0b9c248 100644 --- a/lib/libvmod_debug/vmod_debug_obj.c +++ b/lib/libvmod_debug/vmod_debug_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/fall_back.c b/lib/libvmod_directors/fall_back.c index e73b1cf..a47aa08 100644 --- a/lib/libvmod_directors/fall_back.c +++ b/lib/libvmod_directors/fall_back.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/round_robin.c b/lib/libvmod_directors/round_robin.c index b2acf49..3690893 100644 --- a/lib/libvmod_directors/round_robin.c +++ b/lib/libvmod_directors/round_robin.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc index cfcf2e3..bb81751 100644 --- a/lib/libvmod_directors/vmod.vcc +++ b/lib/libvmod_directors/vmod.vcc @@ -1,5 +1,5 @@ #- -# Copyright (c) 2013-2014 Varnish Software AS +# Copyright (c) 2013-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c index e8478e8..c4690b4 100644 --- a/lib/libvmod_std/vmod_std.c +++ b/lib/libvmod_std/vmod_std.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 65df00c..1506ec9 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp From lkarsten at varnish-software.com Fri Sep 11 09:02:12 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 11:02:12 +0200 Subject: [4.1] 65993d1 Update list of changes for 4.1.0-beta1. Message-ID: commit 65993d12e0ddb0d99ebde5aaa0c8abde9a6fe8af Author: Lasse Karstensen Date: Fri Sep 11 10:52:10 2015 +0200 Update list of changes for 4.1.0-beta1. diff --git a/doc/changes.rst b/doc/changes.rst index 3f7950f..4761f05 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,20 +1,29 @@ ====================================== -Varnish Cache 4.1.0-beta1 (unreleased) +Varnish Cache 4.1.0-beta1 (2015-09-11) ====================================== -- Redhat packaging files are now separate from the normal tree. +Changes since 4.1.0-tp1: +- Redhat packaging files are now separate from the normal tree. - Client workspace overflow should now result in a 500 response instead of panic. - - [varnishstat] -w option has been retired. +- libvarnishapi release number is increased. +- Body bytes sent on ESI subrequests with gzip are now counted correctly. +- [vmod-std] Data type conversion functions now take additional fallback argument. Bugs fixed ---------- - 1777_ - Disable speculative Range handling on streaming transactions. +- 1778_ - [varnishstat] Cast to integer to prevent negative values messing the statistics +- 1781_ - Propagate gzip CRC upwards from nested ESI includes. +- 1783_ - Align code with RFC7230 section 3.3.3 which allows POST without a body. .. _1777: https://www.varnish-cache.org/trac/ticket/1777 +.. _1778: https://www.varnish-cache.org/trac/ticket/1778 +.. _1781: https://www.varnish-cache.org/trac/ticket/1781 +.. _1783: https://www.varnish-cache.org/trac/ticket/1783 ==================================== From lkarsten at varnish-software.com Fri Sep 11 09:02:12 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 11 Sep 2015 11:02:12 +0200 Subject: [4.1] 1628f0b Update copyright. Message-ID: commit 1628f0b93e4ba725f2f26ca82a6e794229517475 Author: Lasse Karstensen Date: Fri Sep 11 10:58:08 2015 +0200 Update copyright. Updating copyright on all files with git commits so far this year. diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c index 954a8be..1f02da9 100644 --- a/bin/varnishadm/varnishadm.c +++ b/bin/varnishadm/varnishadm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Cecilie Fritzvold diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl index e4c2a6f..6430cd7 100644 --- a/bin/varnishd/builtin.vcl +++ b/bin/varnishd/builtin.vcl @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index fd596f7..f63c8b4 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 5dc4abe..00193ec 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index c887868..0e84bae 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h index 42f9c91..016bcb0 100644 --- a/bin/varnishd/cache/cache_filter.h +++ b/bin/varnishd/cache/cache_filter.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index 8079e2b..7b08f3e 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 03a4f77..3580204 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 9925ea8..41c6c9e 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 9b2580e..4011e95 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index e41654d..585a63e 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c index ae49087..e733686 100644 --- a/bin/varnishd/cache/cache_shmlog.c +++ b/bin/varnishd/cache/cache_shmlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c index 8424223..a7bd7a3 100644 --- a/bin/varnishd/cache/cache_vary.c +++ b/bin/varnishd/cache/cache_vary.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 814d4af..642e754 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c index 22b45de..c499312 100644 --- a/bin/varnishd/cache/cache_vrt_priv.c +++ b/bin/varnishd/cache/cache_vrt_priv.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c index c1ea167..f8be46f 100644 --- a/bin/varnishd/cache/cache_vrt_re.c +++ b/bin/varnishd/cache/cache_vrt_re.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h index 47a68cb..f8d7a08 100644 --- a/bin/varnishd/hash/hash_slinger.h +++ b/bin/varnishd/hash/hash_slinger.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 21fc961..fdd176a 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index c63716d..fe99ebd 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index 8c80f58..658aca4 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 69c90d8..1d2a7a3 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index e6318c1..876b6d3 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index fa9dabf..12baf83 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index c94e0c8..77a601c 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2014 Varnish Software AS + * Copyright (c) 2007-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Sm?rgav diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c index 310eccc..aec72e9 100644 --- a/bin/varnishhist/varnishhist.c +++ b/bin/varnishhist/varnishhist.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishhist/varnishhist_options.h b/bin/varnishhist/varnishhist_options.h index a04a7e0..5241539 100644 --- a/bin/varnishhist/varnishhist_options.h +++ b/bin/varnishhist/varnishhist_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c index 68a8f33..3b5061f 100644 --- a/bin/varnishlog/varnishlog.c +++ b/bin/varnishlog/varnishlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishlog/varnishlog_options.h b/bin/varnishlog/varnishlog_options.h index 82d9c0d..187ac57 100644 --- a/bin/varnishlog/varnishlog_options.h +++ b/bin/varnishlog/varnishlog_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 9283beb..77e6354 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Anders Berg diff --git a/bin/varnishncsa/varnishncsa_options.c b/bin/varnishncsa/varnishncsa_options.c index 5bd9277..44e3dfe 100644 --- a/bin/varnishncsa/varnishncsa_options.c +++ b/bin/varnishncsa/varnishncsa_options.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index b74c688..520feb7 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c index 05ee65b..1c00ed0 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3c4c733..3ab9009 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index f3529a0..b2fc39a 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/configure.ac b/configure.ac index 1963a97..c2f416d 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2014 Varnish Software AS]) +Copyright (c) 2006-2015 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [4.1.0-beta1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index 4098afd..9a2d0de 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -321,4 +321,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2011-2014 Varnish Software AS +* Copyright (c) 2011-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishadm.rst b/doc/sphinx/reference/varnishadm.rst index f671d8f..41e879a 100644 --- a/doc/sphinx/reference/varnishadm.rst +++ b/doc/sphinx/reference/varnishadm.rst @@ -90,4 +90,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst index 6af9746..88043d3 100644 --- a/doc/sphinx/reference/varnishhist.rst +++ b/doc/sphinx/reference/varnishhist.rst @@ -54,4 +54,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst index e3ae098..d94c333 100644 --- a/doc/sphinx/reference/varnishlog.rst +++ b/doc/sphinx/reference/varnishlog.rst @@ -62,4 +62,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index d98f6e2..6475fcf 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -156,4 +156,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 14c4ee4..5aa1928 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -141,4 +141,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtop.rst b/doc/sphinx/reference/varnishtop.rst index 2729966..b9f2b07 100644 --- a/doc/sphinx/reference/varnishtop.rst +++ b/doc/sphinx/reference/varnishtop.rst @@ -71,4 +71,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 6e55cdf..cd942e6 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -432,4 +432,4 @@ This document is licensed under the same license as Varnish itself. See LICENSE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index 870d718..7b5c721 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2014 Varnish Software AS +# Copyright (c) 2012-2015 Varnish Software AS # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/include/tbl/acct_fields_req.h b/include/tbl/acct_fields_req.h index fece3dc..44ce5b8 100644 --- a/include/tbl/acct_fields_req.h +++ b/include/tbl/acct_fields_req.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2008 Verdens Gang AS - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/bo_flags.h b/include/tbl/bo_flags.h index dac83b2..fedde3f 100644 --- a/include/tbl/bo_flags.h +++ b/include/tbl/bo_flags.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/req_body.h b/include/tbl/req_body.h index be0cd91..e9e32b7 100644 --- a/include/tbl/req_body.h +++ b/include/tbl/req_body.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/steps.h b/include/tbl/steps.h index 2c805d4..4756d44 100644 --- a/include/tbl/steps.h +++ b/include/tbl/steps.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_all.h b/include/tbl/vsc_all.h index 0ef0b08..8b681de 100644 --- a/include/tbl/vsc_all.h +++ b/include/tbl/vsc_all.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index d592016..bf9e198 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h index 1247deb..609586e 100644 --- a/include/vapi/vsc.h +++ b/include/vapi/vsc.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc_int.h b/include/vapi/vsc_int.h index 376a755..44a2d83 100644 --- a/include/vapi/vsc_int.h +++ b/include/vapi/vsc_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index dd2f6af..599c654 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h index 15ed9af..206c045 100644 --- a/include/vapi/vsl_int.h +++ b/include/vapi/vsl_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h index c67e140..4aebe1f 100644 --- a/include/vapi/vsm.h +++ b/include/vapi/vsm.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm_int.h b/include/vapi/vsm_int.h index 4b84c44..deed9f7 100644 --- a/include/vapi/vsm_int.h +++ b/include/vapi/vsm_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vdef.h b/include/vdef.h index f6592b3..a015b05 100644 --- a/include/vdef.h +++ b/include/vdef.h @@ -1,7 +1,7 @@ /*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2012 Fastly Inc - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsl_priv.h b/include/vsl_priv.h index 0c780dc..6296a5b 100644 --- a/include/vsl_priv.h +++ b/include/vsl_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsm_priv.h b/include/vsm_priv.h index e6893cc..4d0d401 100644 --- a/include/vsm_priv.h +++ b/include/vsm_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vut.h b/include/vut.h index c455662..241aa94 100644 --- a/include/vut.h +++ b/include/vut.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vut_options.h b/include/vut_options.h index 42298c4..a5b11ef 100644 --- a/include/vut_options.h +++ b/include/vut_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/generate.py b/lib/libvarnishapi/generate.py index 28aa8ae..00205cd 100755 --- a/lib/libvarnishapi/generate.py +++ b/lib/libvarnishapi/generate.py @@ -1,7 +1,7 @@ #!/usr/bin/env python #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2014 Varnish Software AS +# Copyright (c) 2006-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map index 216eded..653342f 100644 --- a/lib/libvarnishapi/libvarnishapi.map +++ b/lib/libvarnishapi/libvarnishapi.map @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c index 7ea599d..c86852d 100644 --- a/lib/libvarnishapi/vsc.c +++ b/lib/libvarnishapi/vsc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 8bd6033..0197e11 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl2rst.c b/lib/libvarnishapi/vsl2rst.c index f443a91..b9f7413 100644 --- a/lib/libvarnishapi/vsl2rst.c +++ b/lib/libvarnishapi/vsl2rst.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h index 584bc8c..c77ba28 100644 --- a/lib/libvarnishapi/vsl_api.h +++ b/lib/libvarnishapi/vsl_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c index e6b2b89..cc14e94 100644 --- a/lib/libvarnishapi/vsl_arg.c +++ b/lib/libvarnishapi/vsl_arg.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c index 28e44fe..e908bd7 100644 --- a/lib/libvarnishapi/vsl_cursor.c +++ b/lib/libvarnishapi/vsl_cursor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 3245e48..bbcd7cc 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c index 989ee0a..1ad6811 100644 --- a/lib/libvarnishapi/vsl_query.c +++ b/lib/libvarnishapi/vsl_query.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c index c802518..8e1aa7f 100644 --- a/lib/libvarnishapi/vsm.c +++ b/lib/libvarnishapi/vsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h index 7df8c88..8ef537b 100644 --- a/lib/libvarnishapi/vsm_api.h +++ b/lib/libvarnishapi/vsm_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c index 47f4200..5dad106 100644 --- a/lib/libvarnishapi/vxp.c +++ b/lib/libvarnishapi/vxp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp.h b/lib/libvarnishapi/vxp.h index 0589775..afed0d0 100644 --- a/lib/libvarnishapi/vxp.h +++ b/lib/libvarnishapi/vxp.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_lexer.c b/lib/libvarnishapi/vxp_lexer.c index 73846a8..ee616a9 100644 --- a/lib/libvarnishapi/vxp_lexer.c +++ b/lib/libvarnishapi/vxp_lexer.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index ce4c2eb..7ec8865 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_test.c b/lib/libvarnishapi/vxp_test.c index d00d35f..55e5820 100644 --- a/lib/libvarnishapi/vxp_test.c +++ b/lib/libvarnishapi/vxp_test.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c index 72ba126..40d001b 100644 --- a/lib/libvarnishtools/vut.c +++ b/lib/libvarnishtools/vut.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index 4a026b0..41eac6b 100644 --- a/lib/libvcc/vcc_action.c +++ b/lib/libvcc/vcc_action.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index 14aedf3..8a413c7 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c index 36f813a..4bd7821 100644 --- a/lib/libvcc/vcc_compile.c +++ b/lib/libvcc/vcc_compile.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h index 893369e..4c155a1 100644 --- a/lib/libvcc/vcc_compile.h +++ b/lib/libvcc/vcc_compile.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c index 510a03f..accabd6 100644 --- a/lib/libvcc/vcc_parse.c +++ b/lib/libvcc/vcc_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c index b78d2f4..3882e5a 100644 --- a/lib/libvcc/vcc_storage.c +++ b/lib/libvcc/vcc_storage.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index c5ea59e..049c177 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index e7a7f4f..e8bab4f 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 85a9ac2..0d55316 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #- -# Copyright (c) 2010-2014 Varnish Software AS +# Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_debug/vmod_debug_obj.c b/lib/libvmod_debug/vmod_debug_obj.c index 19a966c..0b9c248 100644 --- a/lib/libvmod_debug/vmod_debug_obj.c +++ b/lib/libvmod_debug/vmod_debug_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/fall_back.c b/lib/libvmod_directors/fall_back.c index e73b1cf..a47aa08 100644 --- a/lib/libvmod_directors/fall_back.c +++ b/lib/libvmod_directors/fall_back.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/round_robin.c b/lib/libvmod_directors/round_robin.c index b2acf49..3690893 100644 --- a/lib/libvmod_directors/round_robin.c +++ b/lib/libvmod_directors/round_robin.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc index cfcf2e3..bb81751 100644 --- a/lib/libvmod_directors/vmod.vcc +++ b/lib/libvmod_directors/vmod.vcc @@ -1,5 +1,5 @@ #- -# Copyright (c) 2013-2014 Varnish Software AS +# Copyright (c) 2013-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c index e8478e8..c4690b4 100644 --- a/lib/libvmod_std/vmod_std.c +++ b/lib/libvmod_std/vmod_std.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 65df00c..1506ec9 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp From dridi.boukelmoune at gmail.com Fri Sep 11 12:53:34 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 11 Sep 2015 14:53:34 +0200 Subject: [master] 32dc0fb Typo Message-ID: commit 32dc0fba72120719038b5f0dc2907eecdb0c0b18 Author: Dridi Boukelmoune Date: Fri Sep 11 14:53:08 2015 +0200 Typo diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index bf9e198..56a9604 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -247,7 +247,7 @@ SLTM(Fetch_Body, 0, "Body fetched from backend", "\n" ) -SLTM(VCL_acl, 0, "VSL ACL check results", +SLTM(VCL_acl, 0, "VCL ACL check results", "Logs VCL ACL evaluation results.\n\n" ) From fgsch at lodoss.net Sat Sep 12 11:45:26 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Sat, 12 Sep 2015 13:45:26 +0200 Subject: [4.1] b783655 Typo Message-ID: commit b783655aa01392ddfac3902e045116ee38681290 Author: Dridi Boukelmoune Date: Fri Sep 11 14:53:08 2015 +0200 Typo diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index bf9e198..56a9604 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -247,7 +247,7 @@ SLTM(Fetch_Body, 0, "Body fetched from backend", "\n" ) -SLTM(VCL_acl, 0, "VSL ACL check results", +SLTM(VCL_acl, 0, "VCL ACL check results", "Logs VCL ACL evaluation results.\n\n" ) From lkarsten at varnish-software.com Mon Sep 14 11:54:17 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 14 Sep 2015 13:54:17 +0200 Subject: [4.0] f28427f Remove whitespace and clean up description. Message-ID: commit f28427fe321573ed2fb502730b0414683fba0c38 Author: Lasse Karstensen Date: Mon Sep 14 13:53:09 2015 +0200 Remove whitespace and clean up description. diff --git a/redhat/varnish.service b/redhat/varnish.service index a4f3355..ceb1dd7 100644 --- a/redhat/varnish.service +++ b/redhat/varnish.service @@ -1,11 +1,9 @@ [Unit] -Description=Varnish a high-perfomance HTTP accelerator +Description=Varnish Cache, a high-performance HTTP accelerator After=syslog.target network.target [Service] - -# -# If you want to make changes to this file, please copy it to +# If you want to make changes to this file, please copy it to # /etc/systemd/system/varnish.service and make your changes there. # This will override the file kept at /lib/systemd/system/varnish.service # @@ -19,7 +17,7 @@ LimitNOFILE=131072 # Default log size is 82MB + header LimitMEMLOCK=82000 -# Maximum size of the corefile. +# Maximum size of the corefile. LimitCORE=infinity EnvironmentFile=/etc/varnish/varnish.params @@ -44,4 +42,3 @@ ExecReload=/usr/sbin/varnish_reload_vcl [Install] WantedBy=multi-user.target - From lkarsten at varnish-software.com Mon Sep 14 11:54:17 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 14 Sep 2015 13:54:17 +0200 Subject: [4.0] f8cdd8f Add DAEMON_OPTS to ExecStartPre. Message-ID: commit f8cdd8fcab29bc53cfc72964482ecafaaa85f94f Author: Lasse Karstensen Date: Mon Sep 14 13:53:26 2015 +0200 Add DAEMON_OPTS to ExecStartPre. Fixes: #1787 diff --git a/redhat/varnish.service b/redhat/varnish.service index ceb1dd7..ed2b572 100644 --- a/redhat/varnish.service +++ b/redhat/varnish.service @@ -25,7 +25,7 @@ EnvironmentFile=/etc/varnish/varnish.params Type=forking PIDFile=/var/run/varnish.pid PrivateTmp=true -ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF +ExecStartPre=/usr/sbin/varnishd -C -f $VARNISH_VCL_CONF $DAEMON_OPTS ExecStart=/usr/sbin/varnishd \ -P /var/run/varnish.pid \ -f $VARNISH_VCL_CONF \ From lkarsten at varnish-software.com Mon Sep 14 12:21:26 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 14 Sep 2015 14:21:26 +0200 Subject: [4.1] a1c98ae Improve description. Message-ID: commit a1c98ae382078b0910462dc5576e547027f024bf Author: Lasse Karstensen Date: Mon Sep 14 14:21:20 2015 +0200 Improve description. diff --git a/varnish.service b/varnish.service index 717c9fc..afc16f0 100644 --- a/varnish.service +++ b/varnish.service @@ -1,5 +1,5 @@ [Unit] -Description=Varnish Cache HTTP accelerator +Description=Varnish Cache, a high-performance HTTP accelerator [Service] Type=forking From phk at FreeBSD.org Tue Sep 15 13:02:15 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 15 Sep 2015 15:02:15 +0200 Subject: [master] e9f7443 Make esi-delivery responsible for its own header-mungings. Message-ID: commit e9f7443473327832876d0e8c751d7e56468c6e24 Author: Poul-Henning Kamp Date: Tue Sep 15 08:30:46 2015 +0000 Make esi-delivery responsible for its own header-mungings. diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 1580ec0..c5d3a44 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -237,6 +237,9 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, AN(ecx); ecx->preq = req; *priv = ecx; + RFC2616_Weaken_Etag(req->resp); + if (req->resp_len != 0) + req->resp_len = -1; return (0); } CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 2763f7b..92cb781 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -79,8 +79,6 @@ cnt_vdp(struct req *req, struct busyobj *bo) if (!req->disable_esi && req->resp_len != 0 && wantbody && ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) { req->res_mode |= RES_ESI; - RFC2616_Weaken_Etag(req->resp); - req->resp_len = -1; VDP_push(req, VDP_ESI, NULL, 0); } From phk at FreeBSD.org Tue Sep 15 13:02:15 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 15 Sep 2015 15:02:15 +0200 Subject: [master] 0b64ce8 Varnish can close before s1 completes and that is OK. Message-ID: commit 0b64ce894d44ee7b8cd47f5caf8e0a4132556735 Author: Poul-Henning Kamp Date: Tue Sep 15 08:47:56 2015 +0000 Varnish can close before s1 completes and that is OK. diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index d601501..548b281 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -28,6 +28,7 @@ varnish v1 -expect n_object == 0 varnish v1 -expect n_objectcore == 0 server s1 -wait { + non-fatal rxreq send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 From phk at FreeBSD.org Tue Sep 15 13:02:15 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 15 Sep 2015 15:02:15 +0200 Subject: [master] 11ae787 Reset bodylen when we receive a new http message. Message-ID: commit 11ae78743af3b6ccd07665700606c5bfc401176e Author: Poul-Henning Kamp Date: Tue Sep 15 12:49:39 2015 +0000 Reset bodylen when we receive a new http message. diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index ec1350a..64ecef5 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -490,7 +490,7 @@ http_swallow_body(struct http *hp, char * const *hh, int body) (void)http_rxchar(hp, l, 0); vtc_dump(hp->vl, 4, "body", hp->body, l); hp->bodyl = l; - sprintf(hp->bodylen, "%d", l); + bprintf(hp->bodylen, "%d", l); return; } if (body) { @@ -517,6 +517,7 @@ http_rxhdr(struct http *hp) CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); hp->prxbuf = 0; hp->body = NULL; + bprintf(hp->bodylen, "%s", ""); while (1) { (void)http_rxchar(hp, 1, 0); p = hp->rxbuf + hp->prxbuf - 1; From phk at FreeBSD.org Tue Sep 15 13:02:15 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 15 Sep 2015 15:02:15 +0200 Subject: [master] 29fb693 Misc. nit-pickery related to Content-Length Message-ID: commit 29fb693a47d9e7332a11f864aa132047225b35ea Author: Poul-Henning Kamp Date: Tue Sep 15 12:51:37 2015 +0000 Misc. nit-pickery related to Content-Length diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index 548b281..1174cd5 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -30,7 +30,7 @@ varnish v1 -expect n_objectcore == 0 server s1 -wait { non-fatal rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 @@ -41,6 +41,7 @@ client c1 { txreq rxresp expect resp.status == 200 + expect resp.bodylen == 10 } -run varnish v1 -expect n_object == 1 diff --git a/bin/varnishtest/tests/c00008.vtc b/bin/varnishtest/tests/c00008.vtc index a654962..690b362 100644 --- a/bin/varnishtest/tests/c00008.vtc +++ b/bin/varnishtest/tests/c00008.vtc @@ -15,25 +15,32 @@ client c1 { rxresp expect resp.status == 200 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "6" expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:00 GMT" rxresp expect resp.status == 200 + expect resp.http.content-length == "6" expect resp.http.etag == {"foo"} + expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "" + expect resp.bodylen == "" txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:02 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "" + expect resp.bodylen == "" } client c1 -run diff --git a/bin/varnishtest/tests/e00013.vtc b/bin/varnishtest/tests/e00013.vtc index d6db08c..bf3ca8d 100644 --- a/bin/varnishtest/tests/e00013.vtc +++ b/bin/varnishtest/tests/e00013.vtc @@ -3,8 +3,9 @@ varnishtest "All white-space object, in multiple storage segments" server s1 { rxreq expect req.url == "/foo" - txresp -nolen -hdr "Connection: close" - send { } + txresp -nolen -hdr "Transfer-Encoding: chunked" + chunked { } + chunkedlen 0 } -start varnish v1 -vcl+backend { diff --git a/bin/varnishtest/tests/r00730.vtc b/bin/varnishtest/tests/r00730.vtc index 67b9598..e28c8c9 100644 --- a/bin/varnishtest/tests/r00730.vtc +++ b/bin/varnishtest/tests/r00730.vtc @@ -1,4 +1,4 @@ -varnishtest "Check that HEAD returns Content-Length: if backend provides" +varnishtest "Check that HEAD returns Content-Length if backend provides it" server s1 { rxreq @@ -8,6 +8,11 @@ server s1 { } -start varnish v1 -vcl+backend { + sub vcl_recv { + if (req.url == "/2") { + return (pass); + } + } sub vcl_backend_response { set beresp.do_stream = false; } @@ -19,18 +24,8 @@ client c1 { expect resp.http.content-length == 5 } -run - -varnish v1 -vcl+backend { - sub vcl_recv { - return (pass); - } - sub vcl_backend_response { - set beresp.do_stream = false; - } -} - client c1 { - txreq -req HEAD + txreq -req HEAD -url /2 rxresp -no_obj expect resp.http.content-length == 6 } -run diff --git a/bin/varnishtest/tests/r01404.vtc b/bin/varnishtest/tests/r01404.vtc index 1c04139..b9d453b 100644 --- a/bin/varnishtest/tests/r01404.vtc +++ b/bin/varnishtest/tests/r01404.vtc @@ -5,11 +5,7 @@ server s1 { txresp -hdr {ETag: "foo"} -body "11111\n" } -start -varnish v1 -vcl+backend { - sub vcl_backend_response { - set beresp.do_stream = true; - } -} -start +varnish v1 -vcl+backend { } -start client c1 { txreq -hdr {If-None-Match: "foo"} From phk at FreeBSD.org Tue Sep 15 13:02:15 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 15 Sep 2015 15:02:15 +0200 Subject: [master] 4954ed3 Try to push our code into compliance with RFC7230 section 3.3.3 Message-ID: commit 4954ed3b6183bdf712324506fe7bc6074b20c0fe Author: Poul-Henning Kamp Date: Tue Sep 15 13:01:55 2015 +0000 Try to push our code into compliance with RFC7230 section 3.3.3 diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index c5d3a44..d79cde2 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -238,6 +238,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->preq = req; *priv = ecx; RFC2616_Weaken_Etag(req->resp); + req->res_mode |= RES_ESI; if (req->resp_len != 0) req->resp_len = -1; return (0); diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index 7b08f3e..aa516bf 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -299,6 +299,8 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv, (void)VGZ_Destroy(&vg); return (-1); } + + req->res_mode |= RES_GUNZIP; VGZ_Obuf(vg, vg->m_buf, vg->m_sz); *priv = vg; diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h index 8fa4a9a..7d69cfa 100644 --- a/bin/varnishd/cache/cache_priv.h +++ b/bin/varnishd/cache/cache_priv.h @@ -36,7 +36,7 @@ * or may not, be talking a "real" HTTP protocol itself. */ -typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); +typedef void vtr_deliver_f (struct req *, struct busyobj *, int sendbody); struct transport { unsigned magic; diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 4011e95..6c053fc 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -188,7 +188,6 @@ VRG_dorange(struct req *req, const char *r) err = vrg_dorange(req, r); if (err != NULL) { VSLb(req->vsl, SLT_Debug, "RANGE_FAIL %s", err); - http_Unset(req->resp, H_Content_Length); if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Range: bytes */%jd", diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 92cb781..abd6685 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -52,54 +52,60 @@ cnt_vdp(struct req *req, struct busyobj *bo) { const char *r; uint16_t status; - int wantbody; + int sendbody; + intmax_t resp_len; CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); + + resp_len = http_GetContentLength(req->resp); + if (bo != NULL) + req->resp_len = resp_len; + else + req->resp_len = ObjGetLen(req->wrk, req->objcore); + req->res_mode = 0; - wantbody = 1; + + /* RFC 7230, 3.3.3 */ status = http_GetStatus(req->resp); if (!strcmp(req->http0->hd[HTTP_HDR_METHOD].b, "HEAD")) { - wantbody = 0; - } else if (status < 200 || status == 204) { + if (req->objcore->flags & OC_F_PASS) + sendbody = -1; + else + sendbody = 0; + } else if (status < 200 || status == 204 || status == 304) { req->resp_len = 0; - http_Unset(req->resp, H_Content_Length); - wantbody = 0; - } else if (status == 304) { - http_Unset(req->resp, H_Content_Length); - wantbody = 0; - } else if (bo != NULL) - req->resp_len = http_GetContentLength(req->resp); - else - req->resp_len = ObjGetLen(req->wrk, req->objcore); + sendbody = 0; + } else + sendbody = 1; - /* - * Determine ESI status first. Not dependent on wantbody, because - * we want ESI to supress C-L in HEAD too. - */ - if (!req->disable_esi && req->resp_len != 0 && wantbody && - ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) { - req->res_mode |= RES_ESI; + if (!req->disable_esi && req->resp_len != 0 && + ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) VDP_push(req, VDP_ESI, NULL, 0); - } if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && - !RFC2616_Req_Gzip(req->http)) { - req->res_mode |= RES_GUNZIP; + !RFC2616_Req_Gzip(req->http)) VDP_push(req, VDP_gunzip, NULL, 1); - } - /* - * Range comes after the others and pushes on bottom because - * it can (maybe) generate a correct C-L header. - */ if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { http_SetHeader(req->resp, "Accept-Ranges: bytes"); - if (wantbody && http_GetHdr(req->http, H_Range, &r)) + if (sendbody && http_GetHdr(req->http, H_Range, &r)) VRG_dorange(req, r); } - req->transport->deliver(req, bo, wantbody); + if (sendbody < 0) { + /* Don't touch pass+HEAD C-L */ + sendbody = 0; + } else if (resp_len >= 0 && resp_len == req->resp_len) { + /* Reuse C-L header */ + } else { + http_Unset(req->resp, H_Content_Length); + if (req->resp_len >= 0 && sendbody) + http_PrintfHeader(req->resp, + "Content-Length: %jd", req->resp_len); + } + + req->transport->deliver(req, bo, sendbody); } /*-------------------------------------------------------------------- @@ -254,10 +260,12 @@ cnt_synth(struct worker *wrk, struct req *req) VCL_synth_method(req->vcl, wrk, req, NULL, synth_body); - http_Unset(h, H_Content_Length); - AZ(VSB_finish(synth_body)); + http_Unset(h, H_Content_Length); + http_PrintfHeader(req->resp, "Content-Length: %zd", + VSB_len(synth_body)); + /* Discard any lingering request body before delivery */ (void)VRB_Ignore(req); diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index fdd176a..997d28b 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -79,7 +79,7 @@ v1d_error(struct req *req, const char *msg) */ void __match_proto__(vtr_deliver_f) -V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) +V1D_Deliver(struct req *req, struct busyobj *bo, int sendbody) { enum objiter_status ois; @@ -87,19 +87,10 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); - if (wantbody) { - http_Unset(req->resp, H_Content_Length); - if (req->resp_len >= 0) - http_PrintfHeader(req->resp, - "Content-Length: %jd", req->resp_len); - } - - if (req->resp_len == 0) - wantbody = 0; - else if (http_GetHdr(req->resp, H_Content_Length, NULL)) - req->res_mode |= RES_LEN; - else if (wantbody) { - if (req->http->protover == 11) { + if (sendbody) { + if (http_GetHdr(req->resp, H_Content_Length, NULL)) + req->res_mode |= RES_LEN; + else if (req->http->protover == 11) { req->res_mode |= RES_CHUNKED; http_SetHeader(req->resp, "Transfer-Encoding: chunked"); } else { @@ -118,7 +109,8 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) } else if (!http_GetHdr(req->resp, H_Connection, NULL)) http_SetHeader(req->resp, "Connection: keep-alive"); - VDP_push(req, v1d_bytes, NULL, 1); + if (sendbody && req->resp_len != 0) + VDP_push(req, v1d_bytes, NULL, 1); V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); @@ -132,7 +124,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) (void)V1L_Flush(req->wrk); ois = OIS_DONE; - if (wantbody) { + if (sendbody && req->resp_len != 0) { if (req->res_mode & RES_CHUNKED) V1L_Chunked(req->wrk); ois = VDP_DeliverObj(req); diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c index 8fa7e9e..8d08278 100644 --- a/bin/varnishd/http1/cache_http1_proto.c +++ b/bin/varnishd/http1/cache_http1_proto.c @@ -272,7 +272,7 @@ http1_splitline(struct http *hp, struct http_conn *htc, const int *hf) /*--------------------------------------------------------------------*/ static enum body_status -http1_body_status(struct http *hp, struct http_conn *htc) +http1_body_status(const struct http *hp, struct http_conn *htc) { ssize_t cl; const char *b; From martin at varnish-software.com Tue Sep 15 13:37:50 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Tue, 15 Sep 2015 15:37:50 +0200 Subject: [master] 9f38e1a fallocate will for some filesystems (e.g. xfs) not take the already allocated blocks of the file into account. This will cause fallocate to report ENOSPC when called on an existing fully allocated file unless the filesystem has enough free space to accomodate the complete new file size. Because of this we enable fallocate only on filesystems that are known to work as we expect. Message-ID: commit 9f38e1a8909baeb55f6d4e570948d3f904146303 Author: Martin Blix Grydeland Date: Tue Sep 15 15:09:26 2015 +0200 fallocate will for some filesystems (e.g. xfs) not take the already allocated blocks of the file into account. This will cause fallocate to report ENOSPC when called on an existing fully allocated file unless the filesystem has enough free space to accomodate the complete new file size. Because of this we enable fallocate only on filesystems that are known to work as we expect. Fixes: #1792 diff --git a/lib/libvarnish/vfil.c b/lib/libvarnish/vfil.c index 1a48231..19928ff 100644 --- a/lib/libvarnish/vfil.c +++ b/lib/libvarnish/vfil.c @@ -51,6 +51,9 @@ #ifdef HAVE_SYS_VFS_H # include #endif +#if defined(__linux__) && defined(HAVE_FALLOCATE) +# include +#endif #include "vas.h" #include "vdef.h" @@ -182,11 +185,24 @@ VFIL_allocate(int fd, off_t size, int insist) errno = ENOSPC; return (-1); } -#ifdef HAVE_FALLOCATE - if (!fallocate(fd, 0, 0, size)) - return (0); - if (errno == ENOSPC) - return (-1); +#if defined(__linux__) && defined(HAVE_FALLOCATE) + { + /* fallocate will for some filesystems (e.g. xfs) not take + the already allocated blocks of the file into + account. This will cause fallocate to report ENOSPC + when called on an existing fully allocated file unless + the filesystem has enough free space to accomodate the + complete new file size. Because of this we enable + fallocate only on filesystems that are known to work as + we expect. */ + struct statfs stfs; + if (!fstatfs(fd, &stfs) && stfs.f_type == EXT4_SUPER_MAGIC) { + if (!fallocate(fd, 0, 0, size)) + return (0); + if (errno == ENOSPC) + return (-1); + } + } #endif if (!insist) return (0); From phk at FreeBSD.org Wed Sep 16 08:59:35 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 16 Sep 2015 10:59:35 +0200 Subject: [master] 7c593da Cover also the case where backend sends nothing with chunked encoding Message-ID: commit 7c593da13ba58096bfb472f6b0b0c7e0718cda35 Author: Poul-Henning Kamp Date: Wed Sep 16 08:59:16 2015 +0000 Cover also the case where backend sends nothing with chunked encoding diff --git a/bin/varnishtest/tests/r01783.vtc b/bin/varnishtest/tests/r01783.vtc index c44b77f..f938a62 100644 --- a/bin/varnishtest/tests/r01783.vtc +++ b/bin/varnishtest/tests/r01783.vtc @@ -4,7 +4,8 @@ server s1 { rxreq txresp -hdr "foo: 1" rxreq - txresp -hdr "foo: 2" + txresp -nolen -hdr "foo: 2" -hdr "Transfer-Encoding: chunked" + chunkedlen 0 } -start varnish v1 -vcl+backend {} -start From phk at FreeBSD.org Wed Sep 16 21:31:58 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 16 Sep 2015 23:31:58 +0200 Subject: [master] c709e11 Polish the stale_oc management a little bit. Message-ID: commit c709e110d4e1c70052caae366b8777e87490a8e0 Author: Poul-Henning Kamp Date: Wed Sep 16 20:40:41 2015 +0000 Polish the stale_oc management a little bit. diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 00193ec..78e2512 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -185,6 +185,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo) return; AZ(bo->htc); + AZ(bo->stale_oc); VRTPRIV_dynamic_kill(bo->privs, (uintptr_t)bo); assert(VTAILQ_EMPTY(&bo->privs->privs)); diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 539fee1..a69862f 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -186,8 +186,7 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) } else AZ(bo->stale_oc); - if (bo->stale_oc != NULL && - ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { + if (bo->stale_oc != NULL) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, @@ -394,8 +393,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) AZ(bo->was_304); if (http_IsStatus(bo->beresp, 304)) { - if (bo->stale_oc != NULL && - ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { + if (bo->stale_oc != NULL) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { /* * If we changed the gzip status of the object @@ -906,6 +904,13 @@ vbf_fetch_thread(struct worker *wrk, void *priv) bo->wrk = wrk; wrk->vsl = bo->vsl; + if (bo->stale_oc != NULL) { + CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); + /* We don't want the oc/stevedore ops in fetching thread */ + if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) + (void)HSH_DerefObjCore(wrk, &bo->stale_oc); + } + while (stp != F_STP_DONE) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); assert(bo->refcount >= 1); @@ -937,7 +942,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv) if (bo->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); - wrk->vsl = NULL; VBO_DerefBusyObj(wrk, &bo); THR_SetBusyobj(NULL); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index abd6685..b7afe84 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -60,7 +60,7 @@ cnt_vdp(struct req *req, struct busyobj *bo) resp_len = http_GetContentLength(req->resp); if (bo != NULL) req->resp_len = resp_len; - else + else req->resp_len = ObjGetLen(req->wrk, req->objcore); req->res_mode = 0; From phk at FreeBSD.org Wed Sep 16 21:31:58 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 16 Sep 2015 23:31:58 +0200 Subject: [master] 75b1392 Make sure any halfbaked object is always deallocated when we hit stp_error and make a new object. Message-ID: commit 75b1392b8f67cf3bf522e85d0af7f2e9848748d0 Author: Poul-Henning Kamp Date: Wed Sep 16 21:31:29 2015 +0000 Make sure any halfbaked object is always deallocated when we hit stp_error and make a new object. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index a69862f..262d791 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -658,17 +658,15 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) vbf_fetch_body_helper(bo); } - if (bo->vfc->failed && !bo->do_stream) { - assert(bo->state < BOS_STREAM); - ObjFreeObj(bo->wrk, bo->fetch_objcore); - // XXX: doclose = ? - VDI_Finish(bo->wrk, bo); - return (F_STP_ERROR); - } - if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); - return (F_STP_FAIL); + if (!bo->do_stream) { + assert(bo->state < BOS_STREAM); + // XXX: doclose = ? + return (F_STP_ERROR); + } else { + return (F_STP_FAIL); + } } if (bo->do_stream) @@ -775,8 +773,12 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); assert(bo->director_state == DIR_S_NULL); + if(bo->fetch_objcore->stobj->stevedore != NULL) + ObjFreeObj(bo->wrk, bo->fetch_objcore); + now = W_TIM_real(wrk); VSLb_ts_busyobj(bo, "Error", now); @@ -792,10 +794,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) http_TimeHeader(bo->beresp, "Date: ", now); http_SetHeader(bo->beresp, "Server: Varnish"); + EXP_Clr(&bo->fetch_objcore->exp); bo->fetch_objcore->exp.t_origin = bo->t_prev; - bo->fetch_objcore->exp.ttl = 0; - bo->fetch_objcore->exp.grace = 0; - bo->fetch_objcore->exp.keep = 0; VCL_backend_error_method(bo->vcl, wrk, NULL, bo, synth_body); diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 41c6c9e..57e06b8 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -52,6 +52,7 @@ obj_getmethods(const struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(oc->stobj->stevedore); CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC); AN(oc->stobj->stevedore->methods); return (oc->stobj->stevedore->methods); @@ -443,6 +444,7 @@ ObjFreeObj(struct worker *wrk, struct objcore *oc) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(m->freeobj); m->freeobj(wrk, oc); + AZ(oc->stobj->stevedore); } /*==================================================================== diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 8119aad..3a5698d 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -508,6 +508,7 @@ smp_oc_freeobj(struct worker *wrk, struct objcore *oc) } Lck_Unlock(&sg->sc->mtx); + memset(oc->stobj, 0, sizeof oc->stobj); } /*-------------------------------------------------------------------- From phk at FreeBSD.org Mon Sep 21 10:19:52 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 21 Sep 2015 12:19:52 +0200 Subject: [master] 2e22c1c I broke discarding old objects when they have been replaced in c709e110d4e1c70052caae366b8777e87490a8e0. Message-ID: commit 2e22c1c3817ffc106db1903941661f5873f612a9 Author: Poul-Henning Kamp Date: Mon Sep 21 10:19:01 2015 +0000 I broke discarding old objects when they have been replaced in c709e110d4e1c70052caae366b8777e87490a8e0. Spotted by: Martin Test-case by: Martin diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 262d791..8ee198b 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -186,7 +186,8 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) } else AZ(bo->stale_oc); - if (bo->stale_oc != NULL) { + if (bo->stale_oc != NULL && + ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, @@ -393,7 +394,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) AZ(bo->was_304); if (http_IsStatus(bo->beresp, 304)) { - if (bo->stale_oc != NULL) { + if (bo->stale_oc != NULL && + ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { /* * If we changed the gzip status of the object @@ -904,12 +906,14 @@ vbf_fetch_thread(struct worker *wrk, void *priv) bo->wrk = wrk; wrk->vsl = bo->vsl; +#if 0 if (bo->stale_oc != NULL) { CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); /* We don't want the oc/stevedore ops in fetching thread */ if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); } +#endif while (stp != F_STP_DONE) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); diff --git a/bin/varnishtest/tests/c00072.vtc b/bin/varnishtest/tests/c00072.vtc new file mode 100644 index 0000000..19453a0 --- /dev/null +++ b/bin/varnishtest/tests/c00072.vtc @@ -0,0 +1,50 @@ +varnishtest "purge stale on refresh with and without IMS" + +server s1 { + rxreq + txresp -hdr "foo: bar" + rxreq + txresp -hdr "foo: bar" -hdr {ETag: "asdf"} + + rxreq + txresp -hdr "foo: baz" + rxreq + expect req.http.if-none-match == {"asdf"} + txresp -status 304 -nolen -hdr "foo: baz" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.ttl = 0.1s; + set beresp.grace = 0s; + set beresp.keep = 60s; + } +} -start + +client c1 { + txreq -url /no-ims + rxresp + expect resp.http.foo == "bar" + txreq -url /ims + rxresp + expect resp.http.foo == "bar" +} -run + +# Wait for ttl to expire on both objects +delay 0.2 +varnish v1 -expect n_object == 2 + +client c1 { + txreq -url /no-ims + rxresp + expect resp.http.foo == "baz" + txreq -url /ims + rxresp + expect resp.http.foo == "baz" +} -run + +# Make sure expiry is done +delay 1 + +# Only one of each of /no-ims and /ims should be left +varnish v1 -expect n_object == 2 From phk at FreeBSD.org Mon Sep 21 10:34:32 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 21 Sep 2015 12:34:32 +0200 Subject: [master] 2c20289 Assert polishing Message-ID: commit 2c20289d60bf2d3db4d82951181b86dccef9e3dd Author: Poul-Henning Kamp Date: Mon Sep 21 10:34:11 2015 +0000 Assert polishing diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 57e06b8..7413329 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -52,7 +52,6 @@ obj_getmethods(const struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); - AN(oc->stobj->stevedore); CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC); AN(oc->stobj->stevedore->methods); return (oc->stobj->stevedore->methods); @@ -61,10 +60,11 @@ obj_getmethods(const struct objcore *oc) static struct object * obj_getobj(struct worker *wrk, struct objcore *oc) { - const struct storeobj_methods *m = obj_getmethods(oc); + const struct storeobj_methods *m; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + m = obj_getmethods(oc); AN(m->getobj); return (m->getobj(wrk, oc)); } diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 3a5698d..6d5c771 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -396,11 +396,12 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc) uint64_t l; int bad; - /* Some calls are direct, but they should match anyway */ - assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj); - CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(oc->stobj->stevedore); + + /* Some calls are direct, but they should match anyway */ + assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); so = smp_find_so(sg, oc->stobj->priv2); From phk at FreeBSD.org Mon Sep 21 11:27:13 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 21 Sep 2015 13:27:13 +0200 Subject: [master] c440f0e Adopt libz/libvgz fix from FreeBSD: Message-ID: commit c440f0e69325429a58fa648d07232f637573e4f6 Author: Poul-Henning Kamp Date: Mon Sep 21 11:26:20 2015 +0000 Adopt libz/libvgz fix from FreeBSD: r287541 | dim | 2015-09-07 20:55:14 +0000 (Mon, 07 Sep 2015) | 7 lines In libz's inflateMark(), avoid left-shifting a negative integer, which is undefined. Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D3344 MFC after: 3 days diff --git a/lib/libvgz/inflate.c b/lib/libvgz/inflate.c index e3e9fce..5c1a641 100644 --- a/lib/libvgz/inflate.c +++ b/lib/libvgz/inflate.c @@ -1510,7 +1510,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + if (strm == Z_NULL || strm->state == Z_NULL) return -(1L << 16); state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : From fgsch at lodoss.net Mon Sep 21 12:17:21 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 21 Sep 2015 14:17:21 +0200 Subject: [master] 2a582e5 Allow to change varnishtest's buffer size Message-ID: commit 2a582e59fc69a22fc17c5c23036b252cde55607b Author: Federico G. Schwindt Date: Mon Sep 21 12:56:58 2015 +0100 Allow to change varnishtest's buffer size From Carlos Abalde (carlos-dot-abalde-at-gmail-dot-com) with comments from Dridi and phk. diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index cfdea02..60b6fcb 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -46,6 +46,7 @@ #include "vev.h" #include "vfil.h" +#include "vnum.h" #include "vqueue.h" #include "vrnd.h" #include "vsa.h" @@ -80,6 +81,7 @@ struct vtc_job { int iflg = 0; unsigned vtc_maxdur = 60; +unsigned vtc_bufsiz = 512 * 1024; static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head); static struct vev_base *vb; @@ -124,6 +126,7 @@ usage(void) { fprintf(stderr, "usage: varnishtest [options] file ...\n"); #define FMT " %-28s # %s\n" + fprintf(stderr, FMT, "-b size", "Set internal buffer size (default: 512K)"); fprintf(stderr, FMT, "-D name=val", "Define macro"); fprintf(stderr, FMT, "-i", "Find varnishd in build tree"); fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel"); @@ -234,7 +237,7 @@ start_test(void) ALLOC_OBJ(jp, JOB_MAGIC); AN(jp); - jp->bufsiz = 512*1024; /* XXX */ + jp->bufsiz = vtc_bufsiz; jp->buf = mmap(NULL, jp->bufsiz, PROT_READ|PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); @@ -432,6 +435,7 @@ main(int argc, char * const *argv) int ntest = 1; /* Run tests this many times */ struct vtc_tst *tp; char *p; + uintmax_t bufsiz; /* Default names of programs */ #define VTC_PROG(l) extmacro_def(#l, #l); @@ -453,8 +457,21 @@ main(int argc, char * const *argv) setbuf(stdout, NULL); setbuf(stderr, NULL); - while ((ch = getopt(argc, argv, "D:ij:klLn:qt:vW")) != -1) { + while ((ch = getopt(argc, argv, "b:D:ij:klLn:qt:vW")) != -1) { switch (ch) { + case 'b': + if (VNUM_2bytes(optarg, &bufsiz, 0)) { + fprintf(stderr, "Cannot parse b opt '%s'\n", + optarg); + exit(2); + } + if (bufsiz > UINT_MAX) { + fprintf(stderr, "Invalid b opt '%s'\n", + optarg); + exit(2); + } + vtc_bufsiz = (unsigned)bufsiz; + break; case 'D': if (!parse_D_opt(optarg)) { fprintf(stderr, "Cannot parse D opt '%s'\n", diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 5aa1928..00828ff 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -15,7 +15,7 @@ Test program for Varnish SYNOPSIS ======== -varnishtest [-iklLqv] [-n iter] [-D name=val] [-j jobs] [-t duration] file [file ...] +varnishtest [-iklLqv] [-n iter] [-b size] [-D name=val] [-j jobs] [-t duration] file [file ...] DESCRIPTION =========== @@ -30,6 +30,8 @@ simulate a transaction to provoke a specific behavior. The following options are available: +-b size Set internal buffer size (default: 512K) + -D name=val Define macro for use in scripts -i Find varnishd in build tree From fgsch at lodoss.net Mon Sep 21 12:17:21 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 21 Sep 2015 14:17:21 +0200 Subject: [master] a2e1557 Update params and minor style changes Message-ID: commit a2e15572b2c8349f263b3c653eae2682932a848e Author: Federico G. Schwindt Date: Mon Sep 21 13:08:33 2015 +0100 Update params and minor style changes diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index 60b6fcb..9c9f255 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -126,17 +126,19 @@ usage(void) { fprintf(stderr, "usage: varnishtest [options] file ...\n"); #define FMT " %-28s # %s\n" - fprintf(stderr, FMT, "-b size", "Set internal buffer size (default: 512K)"); + fprintf(stderr, FMT, "-b size", + "Set internal buffer size (default: 512K)"); fprintf(stderr, FMT, "-D name=val", "Define macro"); fprintf(stderr, FMT, "-i", "Find varnishd in build tree"); fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel"); fprintf(stderr, FMT, "-k", "Continue on test failure"); - fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails"); fprintf(stderr, FMT, "-L", "Always leave temporary vtc.*"); + fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails"); fprintf(stderr, FMT, "-n iterations", "Run tests this many times"); fprintf(stderr, FMT, "-q", "Quiet mode: report only failures"); fprintf(stderr, FMT, "-t duration", "Time tests out after this long"); fprintf(stderr, FMT, "-v", "Verbose mode: always report test log"); + fprintf(stderr, FMT, "-W", "Enable the witness facility for locking"); fprintf(stderr, "\n"); exit(1); } @@ -457,17 +459,17 @@ main(int argc, char * const *argv) setbuf(stdout, NULL); setbuf(stderr, NULL); - while ((ch = getopt(argc, argv, "b:D:ij:klLn:qt:vW")) != -1) { + while ((ch = getopt(argc, argv, "b:D:hij:kLln:qt:vW")) != -1) { switch (ch) { case 'b': if (VNUM_2bytes(optarg, &bufsiz, 0)) { fprintf(stderr, "Cannot parse b opt '%s'\n", - optarg); + optarg); exit(2); } if (bufsiz > UINT_MAX) { fprintf(stderr, "Invalid b opt '%s'\n", - optarg); + optarg); exit(2); } vtc_bufsiz = (unsigned)bufsiz; @@ -475,7 +477,7 @@ main(int argc, char * const *argv) case 'D': if (!parse_D_opt(optarg)) { fprintf(stderr, "Cannot parse D opt '%s'\n", - optarg); + optarg); exit(2); } break; @@ -485,12 +487,12 @@ main(int argc, char * const *argv) case 'j': npar = strtoul(optarg, NULL, 0); break; - case 'l': - leave_temp = 1; - break; case 'L': leave_temp = 2; break; + case 'l': + leave_temp = 1; + break; case 'k': vtc_continue = !vtc_continue; break; diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 00828ff..5bfca7b 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -15,7 +15,7 @@ Test program for Varnish SYNOPSIS ======== -varnishtest [-iklLqv] [-n iter] [-b size] [-D name=val] [-j jobs] [-t duration] file [file ...] +varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...] DESCRIPTION =========== @@ -34,16 +34,18 @@ The following options are available: -D name=val Define macro for use in scripts +-h Show help + -i Find varnishd in build tree -j jobs Run this many tests in parallel -k Continue on test failure --l Leave temporary vtc.* if test fails - -L Always leave temporary vtc.* +-l Leave temporary vtc.* if test fails + -n iterations Run tests this many times -q Quiet mode: report only failures @@ -54,8 +56,6 @@ The following options are available: -W Enable the witness facility for locking --h Show help - file File to use as a script From phk at FreeBSD.org Mon Sep 21 12:24:27 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 21 Sep 2015 14:24:27 +0200 Subject: [master] 6c14014 Fixes to get the "Makefile.phk" to work again fram Kacper. Message-ID: commit 6c14014dc1b70914e3832f0503536dd1b2d1550d Author: Poul-Henning Kamp Date: Mon Sep 21 12:21:50 2015 +0000 Fixes to get the "Makefile.phk" to work again fram Kacper. Minor fixes for FreeBSD by: phk diff --git a/Makefile.inc.phk b/Makefile.inc.phk index 216dcad..c864efa 100644 --- a/Makefile.inc.phk +++ b/Makefile.inc.phk @@ -196,6 +196,8 @@ vcc_if.c vcc_if.h: vmod.vcc $(TOPDIR)/lib/libvcc/vmodtool.py $(VMODNAME).so: $(VMOD_OBJ) $(CC) $(VMOD_LDFLAGS) -o $(VMODNAME).so $^ + mkdir -p .libs + (cd .libs && ln -sf ../$(VMODNAME).so) .PHONY: vmod_install vmod_install: $(VMODNAME).so diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk index 9922d9f..e849a28 100644 --- a/bin/varnishd/Makefile.phk +++ b/bin/varnishd/Makefile.phk @@ -1,13 +1,14 @@ -VPATH += cache common mgt waiter storage hash +VPATH += cache common mgt waiter storage hash http1 proxy PROG_SRC += cache/cache_acceptor.c PROG_SRC += cache/cache_backend.c PROG_SRC += cache/cache_backend_cfg.c -PROG_SRC += cache/cache_backend_poll.c +PROG_SRC += cache/cache_backend_tcp.c +PROG_SRC += cache/cache_backend_probe.c PROG_SRC += cache/cache_ban.c PROG_SRC += cache/cache_busyobj.c PROG_SRC += cache/cache_cli.c -PROG_SRC += cache/cache_dir.c +PROG_SRC += cache/cache_director.c PROG_SRC += cache/cache_esi_deliver.c PROG_SRC += cache/cache_esi_fetch.c PROG_SRC += cache/cache_esi_parse.c @@ -17,18 +18,23 @@ PROG_SRC += cache/cache_fetch_proc.c PROG_SRC += cache/cache_gzip.c PROG_SRC += cache/cache_hash.c PROG_SRC += cache/cache_http.c -PROG_SRC += cache/cache_http1_deliver.c -PROG_SRC += cache/cache_http1_fetch.c -PROG_SRC += cache/cache_http1_fsm.c -PROG_SRC += cache/cache_http1_proto.c +PROG_SRC += http1/cache_http1_deliver.c +PROG_SRC += http1/cache_http1_fetch.c +PROG_SRC += http1/cache_http1_fsm.c +PROG_SRC += http1/cache_http1_proto.c +PROG_SRC += http1/cache_http1_pipe.c +PROG_SRC += http1/cache_http1_line.c +PROG_SRC += http1/cache_http1_vfp.c PROG_SRC += cache/cache_lck.c PROG_SRC += cache/cache_main.c PROG_SRC += cache/cache_mempool.c PROG_SRC += cache/cache_obj.c PROG_SRC += cache/cache_panic.c -PROG_SRC += cache/cache_pipe.c PROG_SRC += cache/cache_pool.c +PROG_SRC += cache/cache_range.c +PROG_SRC += cache/cache_req.c PROG_SRC += cache/cache_req_fsm.c +PROG_SRC += cache/cache_req_body.c PROG_SRC += cache/cache_rfc2616.c PROG_SRC += cache/cache_session.c PROG_SRC += cache/cache_shmlog.c @@ -38,16 +44,19 @@ PROG_SRC += cache/cache_vrt.c PROG_SRC += cache/cache_vrt_re.c PROG_SRC += cache/cache_vrt_var.c PROG_SRC += cache/cache_vrt_vmod.c +PROG_SRC += cache/cache_vrt_priv.c PROG_SRC += cache/cache_wrk.c -PROG_SRC += cache/cache_wrw.c PROG_SRC += cache/cache_ws.c +PROG_SRC += cache/cache_deliver_proc.c + +PROG_SRC += proxy/cache_proxy_proto.c PROG_SRC += common/common_vsc.c PROG_SRC += common/common_vsm.c PROG_SRC += hash/hash_classic.c PROG_SRC += hash/hash_critbit.c -PROG_SRC += hash/hash_mgt.c +PROG_SRC += hash/mgt_hash.c PROG_SRC += hash/hash_simple_list.c PROG_SRC += mgt/mgt_child.c @@ -59,18 +68,21 @@ PROG_SRC += mgt/mgt_param_tbl.c PROG_SRC += mgt/mgt_param_tcp.c PROG_SRC += mgt/mgt_param_tweak.c PROG_SRC += mgt/mgt_pool.c -PROG_SRC += mgt/mgt_sandbox.c -PROG_SRC += mgt/mgt_sandbox_solaris.c +PROG_SRC += mgt/mgt_jail.c +PROG_SRC += mgt/mgt_jail_unix.c +PROG_SRC += mgt/mgt_jail_solaris.c PROG_SRC += mgt/mgt_shmem.c PROG_SRC += mgt/mgt_vcc.c +PROG_SRC += mgt/mgt_vcl.c +PROG_SRC += mgt/mgt_acceptor.c PROG_SRC += storage/stevedore.c -PROG_SRC += storage/stevedore_mgt.c +PROG_SRC += storage/mgt_stevedore.c PROG_SRC += storage/stevedore_utils.c PROG_SRC += storage/storage_file.c PROG_SRC += storage/storage_malloc.c PROG_SRC += storage/storage_persistent.c -PROG_SRC += storage/storage_persistent_mgt.c +PROG_SRC += storage/mgt_storage_persistent.c PROG_SRC += storage/storage_persistent_silo.c PROG_SRC += storage/storage_persistent_subr.c PROG_SRC += storage/storage_umem.c @@ -98,6 +110,8 @@ MADE_FILES += builtin_vcl.h TODO_INSTALL += install_etc +CFLAGS += -DVARNISHD_IS_NOT_A_VMOD + TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk diff --git a/bin/varnishhist/Makefile.phk b/bin/varnishhist/Makefile.phk index 145414d..77e8c31 100644 --- a/bin/varnishhist/Makefile.phk +++ b/bin/varnishhist/Makefile.phk @@ -1,7 +1,10 @@ PROG_SRC = varnishhist.c +PROG_SRC += varnishhist_options.c -LD_ADD += ${LIB_VARNISH} +LD_ADD += ${LIB_VARNISHTOOLS} LD_ADD += ${LIB_VARNISHAPI} +LD_ADD += ${LIB_VARNISH} +LD_ADD += -lpthread -lncurses -lm ${LIB_PCRE} TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk diff --git a/bin/varnishtest/Makefile.phk b/bin/varnishtest/Makefile.phk index 748977e..438bfed 100644 --- a/bin/varnishtest/Makefile.phk +++ b/bin/varnishtest/Makefile.phk @@ -7,6 +7,7 @@ PROG_SRC += vtc_main.c PROG_SRC += vtc_sema.c PROG_SRC += vtc_server.c PROG_SRC += vtc_varnish.c +PROG_SRC += vtc_process.c LD_ADD += ${LIB_VARNISHAPI} LD_ADD += ${LIB_VARNISH} @@ -26,4 +27,4 @@ include $(TOPDIR)/Makefile.inc.phk .PHONY: all_tests all_tests: - ./varnishtest -i -j 4 tests/*.vtc + ./varnishtest -i -j 24 tests/*.vtc diff --git a/bin/varnishtop/Makefile.phk b/bin/varnishtop/Makefile.phk index 3c5684c..7f8d760 100644 --- a/bin/varnishtop/Makefile.phk +++ b/bin/varnishtop/Makefile.phk @@ -5,7 +5,7 @@ LD_ADD += ${LIB_VARNISHTOOLS} LD_ADD += ${LIB_VARNISHAPI} LD_ADD += ${LIB_VARNISH} LD_ADD += ${LIB_PCRE} -LD_ADD += -lm +LD_ADD += -lm -lpthread -lncurses TODO_ALL += build_man diff --git a/config.phk b/config.phk index 16c3571..760ea22 100644 --- a/config.phk +++ b/config.phk @@ -63,7 +63,9 @@ if true ; then ncursesw/curses.h \ priv.h \ pthread_np.h \ + edit/readline/readline.h \ readline/history.h \ + editline/readline.h \ readline/readline.h \ sys/endian.h \ sys/filio.h \ @@ -88,7 +90,10 @@ if true ; then echo "#define PACKAGE_VERSION \"${ADM_VERSION}\"" >> ${CONFIG_H}_ echo ' + #define VARNISH_VCL_DIR "/etc/varnish" #define VARNISH_STATE_DIR "/tmp/phk/" + #define VARNISH_VMOD_DIR "/usr/lib/varnish/vmods" + #define VCS_Branch "master" ' >> ${CONFIG_H}_ if [ ! -f ${CONFIG_H} ] ; then mv ${CONFIG_H}_ ${CONFIG_H} @@ -107,8 +112,10 @@ VMAV=include/vmod_abi.h if [ -d ./.git ] ; then V=`git show -s --pretty=format:%h` + B=`git rev-parse --abbrev-ref HEAD` else V="NOGIT" + B="NOGIT" fi ( echo "/* $V */" @@ -119,6 +126,7 @@ echo " * make(1) updates this when necessary" echo " *" echo " */" echo "#define VCS_Version \"$V\"" +echo "#define VCS_Branch \"$B\"" ) > ${VCSF}_ if [ ! -f ${VCSF} ] ; then mv ${VCSF}_ ${VCSF} diff --git a/doc/sphinx/Makefile.phk b/doc/sphinx/Makefile.phk index 7e43fef..8ed14ae 100644 --- a/doc/sphinx/Makefile.phk +++ b/doc/sphinx/Makefile.phk @@ -156,7 +156,6 @@ EXTRA_DIST = \ users-guide/intro.rst \ users-guide/operation-logging.rst \ users-guide/operation-statistics.rst \ - users-guide/params.rst \ users-guide/performance.rst \ users-guide/purging.rst \ users-guide/report.rst \ @@ -179,7 +178,19 @@ EXTRA_DIST = \ users-guide/vcl-saint-and-grace.rst \ users-guide/vcl-syntax.rst \ users-guide/vcl-variables.rst \ - users-guide/vcl.rst + users-guide/vcl.rst \ + include/params.rst \ + include/varnishncsa_options.rst \ + include/varnishncsa_synopsis.rst \ + include/varnishlog_options.rst \ + include/varnishlog_synopsis.rst \ + include/varnishtop_options.rst \ + include/varnishtop_synopsis.rst \ + include/varnishhist_options.rst \ + include/varnishhist_synopsis.rst \ + reference/vmod_std.generated.rst \ + reference/vmod_directors.generated.rst + dist-hook: $(MAKE) html @@ -188,6 +199,41 @@ dist-hook: distclean-local: rm -rf $(BUILDDIR) -# XXX: doesn't work... -#reference/params.rst: $(top_builddir)/bin/varnishd/varnishd -# $(top_builddir)/bin/varnishd/varnishd -x dumprstparam > reference/params.rst +# XXX: here be dragons +include/params.rst: ../../bin/varnishd/varnishd + ../../bin/varnishd/varnishd -x dumprstparam > $@ + + +# only sphinx needs the opt2rst stuff anyway +%_opt2rst: ../../bin/%/%_options.h %_options.c + +include/varnishncsa_options.rst: varnishncsa_opt2rst + ../../bin/varnishncsa/varnishncsa_opt2rst options > $@ + +include/varnishncsa_synopsis.rst: varnishncsa_opt2rst + ../../bin/varnishncsa/varnishncsa_opt2rst synopsis > $@ + +include/varnishlog_options.rst: varnishlog_opt2rst + ../../bin/varnishlog/varnishlog_opt2rst options > $@ + +include/varnishlog_synopsis.rst: varnishlog_opt2rst + ../../bin/varnishlog/varnishlog_opt2rst synopsis > $@ + +include/varnishtop_options.rst: varnishtop_opt2rst + ../../bin/varnishtop/varnishtop_opt2rst options > $@ + +include/varnishtop_synopsis.rst: varnishtop_opt2rst + ../../bin/varnishtop/varnishtop_opt2rst synopsis > $@ + +include/varnishhist_options.rst: varnishhist_opt2rst + ./varnishhist_opt2rst options > $@ + +include/varnishhist_synopsis.rst: varnishhist_opt2rst + ./varnishhist_opt2rst synopsis > $@ + +reference/vmod_std.generated.rst: reference ../../lib/libvmod_std/vmod_std.rst + cp ../../lib/libvmod_std/vmod_std.rst $@ + +reference/vmod_directors.generated.rst: reference ../../lib/libvmod_directors/vmod_directors.rst + cp ../../lib/libvmod_directors/vmod_directors.rst $@ + diff --git a/lib/libvmod_debug/Makefile.phk b/lib/libvmod_debug/Makefile.phk index a692640..35135cb 100644 --- a/lib/libvmod_debug/Makefile.phk +++ b/lib/libvmod_debug/Makefile.phk @@ -1,6 +1,7 @@ VMOD_SRC += vmod_debug.c VMOD_SRC += vmod_debug_obj.c +VMOD_SRC += vmod_debug_dyn.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk From martin at varnish-software.com Wed Sep 23 08:43:15 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 23 Sep 2015 10:43:15 +0200 Subject: [master] fda295b Only add size of struct object when using default storeobj_methods Message-ID: commit fda295b73341a762db28ed1d6441a0616efcbd88 Author: Martin Blix Grydeland Date: Tue Sep 22 15:53:38 2015 +0200 Only add size of struct object when using default storeobj_methods This is to not leak the size of struct object to stevedores that might have their own cache_obj.c implementation. diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index 77a601c..0929ba8 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -219,12 +219,14 @@ STV_MkObject(const struct stevedore *stv, struct objcore *oc, void *ptr) int stv_default_allocobj(const struct stevedore *stv, struct objcore *oc, - unsigned ltot) + unsigned wsl) { struct object *o; struct storage *st; + unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + ltot = sizeof(struct object) + PRNDUP(wsl); st = stv->alloc(stv, ltot); if (st == NULL) return (0); @@ -250,24 +252,20 @@ STV_NewObject(struct objcore *oc, struct worker *wrk, const char *hint, unsigned wsl) { struct stevedore *stv, *stv0; - unsigned ltot; int i, j; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); assert(wsl > 0); - wsl = PRNDUP(wsl); - - ltot = sizeof(struct object) + wsl; stv = stv0 = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); if (j == 0 && hint == NULL) { do { stv = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); } while (j == 0 && stv != stv0); } if (j == 0) { @@ -275,7 +273,7 @@ STV_NewObject(struct objcore *oc, struct worker *wrk, for (i = 0; j == 0 && i < cache_param->nuke_limit; i++) { if (EXP_NukeOne(wrk, stv->lru) == -1) break; - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); } } diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c index 160cc35..2679675 100644 --- a/bin/varnishd/storage/storage_persistent.c +++ b/bin/varnishd/storage/storage_persistent.c @@ -502,7 +502,7 @@ smp_allocx(const struct stevedore *st, size_t min_size, size_t max_size, */ static int -smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) +smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl) { struct object *o; struct storage *st; @@ -510,6 +510,7 @@ smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) struct smp_seg *sg; struct smp_object *so; unsigned objidx; + unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC); @@ -518,6 +519,7 @@ smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) if ((oc->exp.ttl + oc->exp.grace + oc->exp.keep) <= 0.) return (0); + ltot = sizeof(struct object) + PRNDUP(wsl); ltot = IRNUP(sc, ltot); st = smp_allocx(stv, ltot, ltot, &so, &objidx, &sg); From dridi.boukelmoune at gmail.com Thu Sep 24 06:43:12 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 24 Sep 2015 08:43:12 +0200 Subject: [master] 4f6de9e Partial rewrite of the docs on writing a director Message-ID: commit 4f6de9ecd0bd2fa25dba66497964b1d8388f98bf Author: Dridi Boukelmoune Date: Thu Sep 24 08:02:06 2015 +0200 Partial rewrite of the docs on writing a director Better ordering of the topics, and hopefully better wording overall. diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 9f1381c..23c73ee 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -54,59 +54,49 @@ A director can be summed up as: - a set of operations - the associated state -What's the difference between a *cluster* director and a *backend* director? +The difference between a *cluster* director and a *backend* director is mainly The functions they will implement. -Creating a Director -=================== - -Custom Backends ---------------- - -If you want to implement a custom backend, have a look at how Varnish -implements native backends. It is the canonical implementation, and though it -provides other services like connection pooling or statistics, it is -essentially a director which state is a ``struct backend``. Varnish native -backends currently speak HTTP/1 over TCP, and as such, you need to make your -own custom backend if you want Varnish to do otherwise such as connect over -UDP or UNIX-domain sockets or speak a different protocol. +Cluster Directors +================= -You may also consider making your custom backend compliant with regards to the -VCL state (see :ref:`ref-vmod-event-functions`). +As in :ref:`vmod_directors(3)`, you can write directors that will group +backends sharing the same role, and pick them according to a strategy. If you +need more than the built-in strategies (round-robin, hash, ...), even though +they can be stacked, it is always possible to write your own. -A "backend" director must not implement the ``resolve`` function. More on that -below (:ref:`ref-writing-a-director-cluster`). +In this case you simply need to implement the ``resolve`` function for the +director. Directors are walked until a leaf director is found. A leaf director +doesn't have a ``resolve`` function and is used to actually make the backend +request, just like the backends you declare in VCL. Dynamic Backends ----------------- - -.. TODO document the VRT_BACKEND_FIELDS dance +================ If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your VCL. You can then leverage your provisioning system. -You don't really deal with ``struct backend``, all you need is available -through the runtime API. Consider the following snippet:: +Consider the following snippet:: backend default { .host = "localhost"; } -The VCL compiler will turn this declaration into a ``struct vrt_backend``. When -the VCL is loaded, Varnish will call ``VRT_new_backend`` in order to create the -director. Dynamic backends are built just like static backends, one *struct* at -a time. You can get rid of the ``struct vrt_backend`` as soon as you have the -``struct director``. +The VCL compiler turns this declaration into a ``struct vrt_backend``. When the +VCL is loaded, Varnish calls ``VRT_new_backend`` in order to create the +director. Varnish doesn't expose its data structure for actual backends, only +the director abstraction and dynamic backends are built just like static +backends, one *struct* at a time. You can get rid of the ``struct vrt_backend`` +as soon as you have the ``struct director``. -Unlike a custom backend, a dynamic backend can't exceed its VCL's lifespan, -because native backends are *owned* by VCLs. Though a dynamic backend can't -outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The -VCL will delete the remaining backends once discarded, you don't need to take -care of it. +A (dynamic) backend can't exceed its VCL's lifespan, because native backends +are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be +deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining +backends once discarded, you don't need to take care of it. Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure @@ -124,20 +114,6 @@ subscribe to VCL events and watch for VCL state (see .. _ref-writing-a-director-cluster: -Cluster Directors ------------------ - -As in :ref:`vmod_directors(3)`, you can write directors that will group -backends sharing the same role, and pick them according to a strategy. If you -need more than the built-in strategies (round-robin, hash, ...), even though -they can be stacked, it is always possible to write your own. - -In this case you simply need to implement the ``resolve`` function for the -director. Directors are walked until a leaf director is found. A leaf director -doesn't have a ``resolve`` function and is used to actually make the backend -request. - - Health Probes ============= @@ -157,3 +133,39 @@ probe and disable the feature on a cold VCL (see Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` directly built from VCL (see :ref:`ref-vmod-vcl-c-types`). + +What's the difference ? + + +Custom Backends +=============== + +If you want to implement a custom backend, have a look at how Varnish +implements native backends. It is the canonical implementation, and though it +provides other services like connection pooling or statistics, it is +essentially a director which state is a ``struct backend``. Varnish native +backends currently speak HTTP/1 over TCP, and as such, you need to make your +own custom backend if you want Varnish to do otherwise such as connect over +UDP or UNIX-domain sockets or speak a different protocol. + +If you want to leverage probes declarations in VCL, which have the advantage of +being reusable since they are only specifications, you can. However, you need +to implement the whole probing infrastructure from scratch. + +You may also consider making your custom backend compliant with regards to the +VCL state (see :ref:`ref-vmod-event-functions`). + + +Data structure considerations +----------------------------- + +When you are creating a custom backend, you may want to provide the semantics +of the native backends. In this case, instead of repeating the redundant fields +between data structures, you can use the macros ``VRT_BACKEND_FIELDS`` and +``VRT_BACKEND_PROBE_FIELDS`` to declare them all at once. This is the little +dance Varnish uses to copy data between the ``struct vrt_backend`` and its +internal data structure for example. + +The copy can be automated with the macros ``VRT_BACKEND_HANDLE`` and +``VRT_BACKEND_PROBE_HANDLE``. You can look at how they can be used in the +Varnish code base. From dridi.boukelmoune at gmail.com Thu Sep 24 06:43:12 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 24 Sep 2015 08:43:12 +0200 Subject: [master] 200e3dd Removing the TODO on VMOD objects documentation Message-ID: commit 200e3dd6c3cc5175ec792033265fcbf6d36c6ff0 Author: Dridi Boukelmoune Date: Thu Sep 24 08:06:35 2015 +0200 Removing the TODO on VMOD objects documentation Until I get a burst of inspiration, let's not release a blatant TODO in the docs. diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index b3ccefa..697fc6a 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -382,12 +382,7 @@ first with a ``VCL_EVENT_WARM`` event, and then a ``VCL_EVENT_USE`` event. Unless a user decides that a given VCL should always be warm, an inactive VMOD will eventually become cold and should manage resources accordingly. -.. _ref-vmod-objects: - -VMOD Objects -============ - -TODO +.. TODO vmod objects When to lock, and when not to lock ================================== From dridi.boukelmoune at gmail.com Thu Sep 24 06:52:01 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 24 Sep 2015 08:52:01 +0200 Subject: [master] 6f0f632 Remove a missing docs ref from last Message-ID: commit 6f0f632c874743fbc56e2bc4cab4bdc849230564 Author: Dridi Boukelmoune Date: Thu Sep 24 08:49:18 2015 +0200 Remove a missing docs ref from last diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 23c73ee..8ad919b 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -98,7 +98,9 @@ are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining backends once discarded, you don't need to take care of it. -Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic +.. XXX Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic + +Consider using an object to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for *cluster* directors that may reference native From phk at FreeBSD.org Mon Sep 28 06:54:46 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 08:54:46 +0200 Subject: [master] 66beb68 Fix a race in persistent startup which seldomly triggered p00005 Message-ID: commit 66beb68288394bdb2d95c9640933121a3a0cfef5 Author: Poul-Henning Kamp Date: Mon Sep 28 06:54:22 2015 +0000 Fix a race in persistent startup which seldomly triggered p00005 diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 6d5c771..45c8a66 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -166,8 +166,8 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc, oc->ban = BAN_RefBan(oc, so->ban, sc->tailban); HSH_Insert(wrk, so->hash, oc); oc->exp = so->exp; - EXP_Inject(wrk, oc, sg->lru); sg->nobj++; + EXP_Inject(wrk, oc, sg->lru); } Pool_Sumstat(wrk); sg->flags |= SMP_SEG_LOADED; From phk at FreeBSD.org Mon Sep 28 07:19:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 09:19:24 +0200 Subject: [master] 52b16a9 Ignore strange protocols in resolver results Message-ID: commit 52b16a94ec5383ecfeb9e4998812ba0eee9161c0 Author: Poul-Henning Kamp Date: Mon Sep 28 07:19:08 2015 +0000 Ignore strange protocols in resolver results diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index 049c177..6b56959 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -177,8 +177,6 @@ rs_callback(void *priv, const struct suckaddr *vsa) else if (VSA_Compare(vsa, rss->vsa6)) rss->wrong++; rss->retval++; - } else { - WRONG("Wrong protocol"); } return (0); } From phk at FreeBSD.org Mon Sep 28 07:32:46 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 09:32:46 +0200 Subject: [master] b854e42 '***' is a better resolver-barfer than /// under circumstances not fully understood. Message-ID: commit b854e4272bfec199130ad05dff223d9decd15528 Author: Poul-Henning Kamp Date: Mon Sep 28 07:32:21 2015 +0000 '***' is a better resolver-barfer than /// under circumstances not fully understood. diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc index f2efcce..1013b86 100644 --- a/bin/varnishtest/tests/c00003.vtc +++ b/bin/varnishtest/tests/c00003.vtc @@ -5,10 +5,10 @@ varnishtest "Check that we fail to start if any listen address does not work" # All bad listen addresses err_shell "could not be resolved to an IP address" { - ${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 + ${varnishd} -F -a "${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } # old style address list err_shell "Unknown protocol" { - ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 + ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } From phk at FreeBSD.org Mon Sep 28 09:27:53 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 11:27:53 +0200 Subject: [master] f3c5905 Add a small delay to stabilize this testcase. Message-ID: commit f3c5905e73ff3d1fcb62f021e399956ee8871e9f Author: Poul-Henning Kamp Date: Mon Sep 28 09:27:28 2015 +0000 Add a small delay to stabilize this testcase. diff --git a/bin/varnishtest/tests/g00005.vtc b/bin/varnishtest/tests/g00005.vtc index 158a264..bc47a5d 100644 --- a/bin/varnishtest/tests/g00005.vtc +++ b/bin/varnishtest/tests/g00005.vtc @@ -21,6 +21,10 @@ client c1 { gunzip expect resp.bodylen == "10" + # This delay attempts to ensure that the busyobj + # is completed before we attempt the range request + delay .2 + txreq -hdr "Range: bytes=3-5" rxresp expect resp.http.content-encoding == "" From lkarsten at varnish-software.com Mon Sep 28 11:31:06 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] d428b35 Move deprication notice. Message-ID: commit d428b3535698ec35943de7506e43b7b09d3e9c6d Author: Lasse Karstensen Date: Fri Sep 11 09:51:15 2015 +0200 Move deprication notice. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 1da50fe..63c7343 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -117,6 +117,11 @@ these extra backend connections, the request would fail, perhaps multiple times, before a working backend connection was found/created. +Protocol support +================ + +Support for HTTP/0.9 on the client side has been retired. + Surrogate keys ============== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index bcdf8c5..2921d10 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -49,12 +49,6 @@ Additionally, the ``varnishlog``, ``varnishncsa`` and other Varnish shared log utilities must now be run in a context with `varnish` group membership. -Protocol support -================ - -Support for HTTP/0.9 on the client side has been retired. - - Changes to parameters ===================== From lkarsten at varnish-software.com Mon Sep 28 11:31:06 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 7a5d2cb Add notice about casting/converting data types. Message-ID: commit 7a5d2cb378040df1e949e920ce56b94bf1ff6262 Author: Lasse Karstensen Date: Fri Sep 11 10:37:26 2015 +0200 Add notice about casting/converting data types. diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index b6d7702..6e55cdf 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -400,6 +400,10 @@ regsuball(str, regex, sub) .. regsub* is in vcc_expr.c +For converting or casting VCL values between data types use the functions +available in the std VMOD. + + EXAMPLES ======== diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index 2921d10..e23c96d 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -7,7 +7,12 @@ Upgrading to Varnish 4.1 (unreleased) Changes to VCL ============== -Not documented yet. +Data type conversion functions now take a fallback +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Data type conversion functions in the std vmod now takes an additional +argument *fallback*, which is returned if the conversion does not succeed. + Version statement is kept ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -32,11 +37,11 @@ preamble. On normal HTTP listeners the behaviour is unchanged. Management interface ==================== -The management interface enabled with ``-M`` used to support the telnet +The management interface enabled with ``-M`` previously supported the telnet protocol. -Support for telnet control sequences have been retired. Replacements are netcat -or (preferred) ``varnishadm``. +Support for telnet control sequences have been retired. Replacement clients +like netcat or (preferred) ``varnishadm`` should be used instead. Runtime users and groups @@ -65,4 +70,3 @@ The following parameters have been retired: * `user` (security revamp) Minor changes of default values on `workspace_session` and `vsl_mask`. - From lkarsten at varnish-software.com Mon Sep 28 11:31:06 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] ef8a972 Update copyright. Message-ID: commit ef8a972bed0cba571f0086c7c6129fcadc667229 Author: Lasse Karstensen Date: Fri Sep 11 10:58:08 2015 +0200 Update copyright. Updating copyright on all files with git commits so far this year. diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c index 954a8be..1f02da9 100644 --- a/bin/varnishadm/varnishadm.c +++ b/bin/varnishadm/varnishadm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Cecilie Fritzvold diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl index e4c2a6f..6430cd7 100644 --- a/bin/varnishd/builtin.vcl +++ b/bin/varnishd/builtin.vcl @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index fd596f7..f63c8b4 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 5dc4abe..00193ec 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index c887868..0e84bae 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h index 42f9c91..016bcb0 100644 --- a/bin/varnishd/cache/cache_filter.h +++ b/bin/varnishd/cache/cache_filter.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index 8079e2b..7b08f3e 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 03a4f77..3580204 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 9925ea8..41c6c9e 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 9b2580e..4011e95 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index e41654d..585a63e 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_shmlog.c b/bin/varnishd/cache/cache_shmlog.c index ae49087..e733686 100644 --- a/bin/varnishd/cache/cache_shmlog.c +++ b/bin/varnishd/cache/cache_shmlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c index 8424223..a7bd7a3 100644 --- a/bin/varnishd/cache/cache_vary.c +++ b/bin/varnishd/cache/cache_vary.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 814d4af..642e754 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_priv.c b/bin/varnishd/cache/cache_vrt_priv.c index 22b45de..c499312 100644 --- a/bin/varnishd/cache/cache_vrt_priv.c +++ b/bin/varnishd/cache/cache_vrt_priv.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_re.c b/bin/varnishd/cache/cache_vrt_re.c index c1ea167..f8be46f 100644 --- a/bin/varnishd/cache/cache_vrt_re.c +++ b/bin/varnishd/cache/cache_vrt_re.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h index 47a68cb..f8d7a08 100644 --- a/bin/varnishd/hash/hash_slinger.h +++ b/bin/varnishd/hash/hash_slinger.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 21fc961..fdd176a 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index c63716d..fe99ebd 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_acceptor.c b/bin/varnishd/mgt/mgt_acceptor.c index 8c80f58..658aca4 100644 --- a/bin/varnishd/mgt/mgt_acceptor.c +++ b/bin/varnishd/mgt/mgt_acceptor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 69c90d8..1d2a7a3 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index e6318c1..876b6d3 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index fa9dabf..12baf83 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index c94e0c8..77a601c 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2014 Varnish Software AS + * Copyright (c) 2007-2015 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Sm?rgav diff --git a/bin/varnishhist/varnishhist.c b/bin/varnishhist/varnishhist.c index 310eccc..aec72e9 100644 --- a/bin/varnishhist/varnishhist.c +++ b/bin/varnishhist/varnishhist.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishhist/varnishhist_options.h b/bin/varnishhist/varnishhist_options.h index a04a7e0..5241539 100644 --- a/bin/varnishhist/varnishhist_options.h +++ b/bin/varnishhist/varnishhist_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c index 68a8f33..3b5061f 100644 --- a/bin/varnishlog/varnishlog.c +++ b/bin/varnishlog/varnishlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishlog/varnishlog_options.h b/bin/varnishlog/varnishlog_options.h index 82d9c0d..187ac57 100644 --- a/bin/varnishlog/varnishlog_options.h +++ b/bin/varnishlog/varnishlog_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 9283beb..77e6354 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Anders Berg diff --git a/bin/varnishncsa/varnishncsa_options.c b/bin/varnishncsa/varnishncsa_options.c index 5bd9277..44e3dfe 100644 --- a/bin/varnishncsa/varnishncsa_options.c +++ b/bin/varnishncsa/varnishncsa_options.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index b74c688..520feb7 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c index 05ee65b..1c00ed0 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3c4c733..3ab9009 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index f3529a0..b2fc39a 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/configure.ac b/configure.ac index 48af690..77b61d4 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2014 Varnish Software AS]) +Copyright (c) 2006-2015 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index 4098afd..9a2d0de 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -321,4 +321,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2011-2014 Varnish Software AS +* Copyright (c) 2011-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishadm.rst b/doc/sphinx/reference/varnishadm.rst index f671d8f..41e879a 100644 --- a/doc/sphinx/reference/varnishadm.rst +++ b/doc/sphinx/reference/varnishadm.rst @@ -90,4 +90,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst index 6af9746..88043d3 100644 --- a/doc/sphinx/reference/varnishhist.rst +++ b/doc/sphinx/reference/varnishhist.rst @@ -54,4 +54,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst index e3ae098..d94c333 100644 --- a/doc/sphinx/reference/varnishlog.rst +++ b/doc/sphinx/reference/varnishlog.rst @@ -62,4 +62,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index d98f6e2..6475fcf 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -156,4 +156,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 14c4ee4..5aa1928 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -141,4 +141,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2014 Varnish Software AS +* Copyright (c) 2007-2015 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtop.rst b/doc/sphinx/reference/varnishtop.rst index 2729966..b9f2b07 100644 --- a/doc/sphinx/reference/varnishtop.rst +++ b/doc/sphinx/reference/varnishtop.rst @@ -71,4 +71,4 @@ This document is licensed under the same licence as Varnish itself. See LICENCE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 6e55cdf..cd942e6 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -432,4 +432,4 @@ This document is licensed under the same license as Varnish itself. See LICENSE for details. * Copyright (c) 2006 Verdens Gang AS -* Copyright (c) 2006-2014 Varnish Software AS +* Copyright (c) 2006-2015 Varnish Software AS diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index 870d718..7b5c721 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2014 Varnish Software AS +# Copyright (c) 2012-2015 Varnish Software AS # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions diff --git a/include/tbl/acct_fields_req.h b/include/tbl/acct_fields_req.h index fece3dc..44ce5b8 100644 --- a/include/tbl/acct_fields_req.h +++ b/include/tbl/acct_fields_req.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2008 Verdens Gang AS - * Copyright (c) 2008-2014 Varnish Software AS + * Copyright (c) 2008-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/bo_flags.h b/include/tbl/bo_flags.h index dac83b2..fedde3f 100644 --- a/include/tbl/bo_flags.h +++ b/include/tbl/bo_flags.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/req_body.h b/include/tbl/req_body.h index be0cd91..e9e32b7 100644 --- a/include/tbl/req_body.h +++ b/include/tbl/req_body.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/steps.h b/include/tbl/steps.h index 2c805d4..4756d44 100644 --- a/include/tbl/steps.h +++ b/include/tbl/steps.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_all.h b/include/tbl/vsc_all.h index 0ef0b08..8b681de 100644 --- a/include/tbl/vsc_all.h +++ b/include/tbl/vsc_all.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index d592016..bf9e198 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h index 1247deb..609586e 100644 --- a/include/vapi/vsc.h +++ b/include/vapi/vsc.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsc_int.h b/include/vapi/vsc_int.h index 376a755..44a2d83 100644 --- a/include/vapi/vsc_int.h +++ b/include/vapi/vsc_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index dd2f6af..599c654 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl_int.h b/include/vapi/vsl_int.h index 15ed9af..206c045 100644 --- a/include/vapi/vsl_int.h +++ b/include/vapi/vsl_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h index c67e140..4aebe1f 100644 --- a/include/vapi/vsm.h +++ b/include/vapi/vsm.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm_int.h b/include/vapi/vsm_int.h index 4b84c44..deed9f7 100644 --- a/include/vapi/vsm_int.h +++ b/include/vapi/vsm_int.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vdef.h b/include/vdef.h index f6592b3..a015b05 100644 --- a/include/vdef.h +++ b/include/vdef.h @@ -1,7 +1,7 @@ /*- * Copyright (c) 2006 Verdens Gang AS * Copyright (c) 2012 Fastly Inc - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsl_priv.h b/include/vsl_priv.h index 0c780dc..6296a5b 100644 --- a/include/vsl_priv.h +++ b/include/vsl_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vsm_priv.h b/include/vsm_priv.h index e6893cc..4d0d401 100644 --- a/include/vsm_priv.h +++ b/include/vsm_priv.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vut.h b/include/vut.h index c455662..241aa94 100644 --- a/include/vut.h +++ b/include/vut.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vut_options.h b/include/vut_options.h index 42298c4..a5b11ef 100644 --- a/include/vut_options.h +++ b/include/vut_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/generate.py b/lib/libvarnishapi/generate.py index 28aa8ae..00205cd 100755 --- a/lib/libvarnishapi/generate.py +++ b/lib/libvarnishapi/generate.py @@ -1,7 +1,7 @@ #!/usr/bin/env python #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2014 Varnish Software AS +# Copyright (c) 2006-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map index 216eded..653342f 100644 --- a/lib/libvarnishapi/libvarnishapi.map +++ b/lib/libvarnishapi/libvarnishapi.map @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c index 7ea599d..c86852d 100644 --- a/lib/libvarnishapi/vsc.c +++ b/lib/libvarnishapi/vsc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 8bd6033..0197e11 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl2rst.c b/lib/libvarnishapi/vsl2rst.c index f443a91..b9f7413 100644 --- a/lib/libvarnishapi/vsl2rst.c +++ b/lib/libvarnishapi/vsl2rst.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2014 Varnish Software AS + * Copyright (c) 2011-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_api.h b/lib/libvarnishapi/vsl_api.h index 584bc8c..c77ba28 100644 --- a/lib/libvarnishapi/vsl_api.h +++ b/lib/libvarnishapi/vsl_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c index e6b2b89..cc14e94 100644 --- a/lib/libvarnishapi/vsl_arg.c +++ b/lib/libvarnishapi/vsl_arg.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_cursor.c b/lib/libvarnishapi/vsl_cursor.c index 28e44fe..e908bd7 100644 --- a/lib/libvarnishapi/vsl_cursor.c +++ b/lib/libvarnishapi/vsl_cursor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 3245e48..bbcd7cc 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c index 989ee0a..1ad6811 100644 --- a/lib/libvarnishapi/vsl_query.c +++ b/lib/libvarnishapi/vsl_query.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c index c802518..8e1aa7f 100644 --- a/lib/libvarnishapi/vsm.c +++ b/lib/libvarnishapi/vsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h index 7df8c88..8ef537b 100644 --- a/lib/libvarnishapi/vsm_api.h +++ b/lib/libvarnishapi/vsm_api.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c index 47f4200..5dad106 100644 --- a/lib/libvarnishapi/vxp.c +++ b/lib/libvarnishapi/vxp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp.h b/lib/libvarnishapi/vxp.h index 0589775..afed0d0 100644 --- a/lib/libvarnishapi/vxp.h +++ b/lib/libvarnishapi/vxp.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_lexer.c b/lib/libvarnishapi/vxp_lexer.c index 73846a8..ee616a9 100644 --- a/lib/libvarnishapi/vxp_lexer.c +++ b/lib/libvarnishapi/vxp_lexer.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index ce4c2eb..7ec8865 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp_test.c b/lib/libvarnishapi/vxp_test.c index d00d35f..55e5820 100644 --- a/lib/libvarnishapi/vxp_test.c +++ b/lib/libvarnishapi/vxp_test.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014 Varnish Software AS + * Copyright (c) 2014-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c index 72ba126..40d001b 100644 --- a/lib/libvarnishtools/vut.c +++ b/lib/libvarnishtools/vut.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index 4a026b0..41eac6b 100644 --- a/lib/libvcc/vcc_action.c +++ b/lib/libvcc/vcc_action.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_backend.c b/lib/libvcc/vcc_backend.c index 14aedf3..8a413c7 100644 --- a/lib/libvcc/vcc_backend.c +++ b/lib/libvcc/vcc_backend.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.c b/lib/libvcc/vcc_compile.c index 36f813a..4bd7821 100644 --- a/lib/libvcc/vcc_compile.c +++ b/lib/libvcc/vcc_compile.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_compile.h b/lib/libvcc/vcc_compile.h index 893369e..4c155a1 100644 --- a/lib/libvcc/vcc_compile.h +++ b/lib/libvcc/vcc_compile.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_parse.c b/lib/libvcc/vcc_parse.c index 510a03f..accabd6 100644 --- a/lib/libvcc/vcc_parse.c +++ b/lib/libvcc/vcc_parse.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_storage.c b/lib/libvcc/vcc_storage.c index b78d2f4..3882e5a 100644 --- a/lib/libvcc/vcc_storage.c +++ b/lib/libvcc/vcc_storage.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index c5ea59e..049c177 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 Varnish Software AS + * Copyright (c) 2006-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_vmod.c b/lib/libvcc/vcc_vmod.c index e7a7f4f..e8bab4f 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 85a9ac2..0d55316 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #- -# Copyright (c) 2010-2014 Varnish Software AS +# Copyright (c) 2010-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_debug/vmod_debug_obj.c b/lib/libvmod_debug/vmod_debug_obj.c index 19a966c..0b9c248 100644 --- a/lib/libvmod_debug/vmod_debug_obj.c +++ b/lib/libvmod_debug/vmod_debug_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/fall_back.c b/lib/libvmod_directors/fall_back.c index e73b1cf..a47aa08 100644 --- a/lib/libvmod_directors/fall_back.c +++ b/lib/libvmod_directors/fall_back.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/round_robin.c b/lib/libvmod_directors/round_robin.c index b2acf49..3690893 100644 --- a/lib/libvmod_directors/round_robin.c +++ b/lib/libvmod_directors/round_robin.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2014 Varnish Software AS + * Copyright (c) 2013-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_directors/vmod.vcc b/lib/libvmod_directors/vmod.vcc index cfcf2e3..bb81751 100644 --- a/lib/libvmod_directors/vmod.vcc +++ b/lib/libvmod_directors/vmod.vcc @@ -1,5 +1,5 @@ #- -# Copyright (c) 2013-2014 Varnish Software AS +# Copyright (c) 2013-2015 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std.c b/lib/libvmod_std/vmod_std.c index e8478e8..c4690b4 100644 --- a/lib/libvmod_std/vmod_std.c +++ b/lib/libvmod_std/vmod_std.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod_std_conversions.c b/lib/libvmod_std/vmod_std_conversions.c index 65df00c..1506ec9 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2014 Varnish Software AS + * Copyright (c) 2010-2015 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp From dridi.boukelmoune at gmail.com Mon Sep 28 11:31:06 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 32dc0fb Typo Message-ID: commit 32dc0fba72120719038b5f0dc2907eecdb0c0b18 Author: Dridi Boukelmoune Date: Fri Sep 11 14:53:08 2015 +0200 Typo diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index bf9e198..56a9604 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -247,7 +247,7 @@ SLTM(Fetch_Body, 0, "Body fetched from backend", "\n" ) -SLTM(VCL_acl, 0, "VSL ACL check results", +SLTM(VCL_acl, 0, "VCL ACL check results", "Logs VCL ACL evaluation results.\n\n" ) From phk at FreeBSD.org Mon Sep 28 11:31:06 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] e9f7443 Make esi-delivery responsible for its own header-mungings. Message-ID: commit e9f7443473327832876d0e8c751d7e56468c6e24 Author: Poul-Henning Kamp Date: Tue Sep 15 08:30:46 2015 +0000 Make esi-delivery responsible for its own header-mungings. diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 1580ec0..c5d3a44 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -237,6 +237,9 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, AN(ecx); ecx->preq = req; *priv = ecx; + RFC2616_Weaken_Etag(req->resp); + if (req->resp_len != 0) + req->resp_len = -1; return (0); } CAST_OBJ_NOTNULL(ecx, *priv, ECX_MAGIC); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 2763f7b..92cb781 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -79,8 +79,6 @@ cnt_vdp(struct req *req, struct busyobj *bo) if (!req->disable_esi && req->resp_len != 0 && wantbody && ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) { req->res_mode |= RES_ESI; - RFC2616_Weaken_Etag(req->resp); - req->resp_len = -1; VDP_push(req, VDP_ESI, NULL, 0); } From phk at FreeBSD.org Mon Sep 28 11:31:06 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 0b64ce8 Varnish can close before s1 completes and that is OK. Message-ID: commit 0b64ce894d44ee7b8cd47f5caf8e0a4132556735 Author: Poul-Henning Kamp Date: Tue Sep 15 08:47:56 2015 +0000 Varnish can close before s1 completes and that is OK. diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index d601501..548b281 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -28,6 +28,7 @@ varnish v1 -expect n_object == 0 varnish v1 -expect n_objectcore == 0 server s1 -wait { + non-fatal rxreq send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 From phk at FreeBSD.org Mon Sep 28 11:31:06 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 11ae787 Reset bodylen when we receive a new http message. Message-ID: commit 11ae78743af3b6ccd07665700606c5bfc401176e Author: Poul-Henning Kamp Date: Tue Sep 15 12:49:39 2015 +0000 Reset bodylen when we receive a new http message. diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index ec1350a..64ecef5 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -490,7 +490,7 @@ http_swallow_body(struct http *hp, char * const *hh, int body) (void)http_rxchar(hp, l, 0); vtc_dump(hp->vl, 4, "body", hp->body, l); hp->bodyl = l; - sprintf(hp->bodylen, "%d", l); + bprintf(hp->bodylen, "%d", l); return; } if (body) { @@ -517,6 +517,7 @@ http_rxhdr(struct http *hp) CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); hp->prxbuf = 0; hp->body = NULL; + bprintf(hp->bodylen, "%s", ""); while (1) { (void)http_rxchar(hp, 1, 0); p = hp->rxbuf + hp->prxbuf - 1; From phk at FreeBSD.org Mon Sep 28 11:31:06 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 29fb693 Misc. nit-pickery related to Content-Length Message-ID: commit 29fb693a47d9e7332a11f864aa132047225b35ea Author: Poul-Henning Kamp Date: Tue Sep 15 12:51:37 2015 +0000 Misc. nit-pickery related to Content-Length diff --git a/bin/varnishtest/tests/b00020.vtc b/bin/varnishtest/tests/b00020.vtc index 548b281..1174cd5 100644 --- a/bin/varnishtest/tests/b00020.vtc +++ b/bin/varnishtest/tests/b00020.vtc @@ -30,7 +30,7 @@ varnish v1 -expect n_objectcore == 0 server s1 -wait { non-fatal rxreq - send "HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n" + send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay 0.5 send "Baba\n" delay 0.5 @@ -41,6 +41,7 @@ client c1 { txreq rxresp expect resp.status == 200 + expect resp.bodylen == 10 } -run varnish v1 -expect n_object == 1 diff --git a/bin/varnishtest/tests/c00008.vtc b/bin/varnishtest/tests/c00008.vtc index a654962..690b362 100644 --- a/bin/varnishtest/tests/c00008.vtc +++ b/bin/varnishtest/tests/c00008.vtc @@ -15,25 +15,32 @@ client c1 { rxresp expect resp.status == 200 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "6" expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:00 GMT" rxresp expect resp.status == 200 + expect resp.http.content-length == "6" expect resp.http.etag == {"foo"} + expect resp.bodylen == 6 txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:01 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "" + expect resp.bodylen == "" txreq -url "/foo" \ -hdr "If-Modified-Since: Thu, 26 Jun 2008 12:00:02 GMT" rxresp -no_obj expect resp.status == 304 expect resp.http.etag == {"foo"} + expect resp.http.content-length == "" + expect resp.bodylen == "" } client c1 -run diff --git a/bin/varnishtest/tests/e00013.vtc b/bin/varnishtest/tests/e00013.vtc index d6db08c..bf3ca8d 100644 --- a/bin/varnishtest/tests/e00013.vtc +++ b/bin/varnishtest/tests/e00013.vtc @@ -3,8 +3,9 @@ varnishtest "All white-space object, in multiple storage segments" server s1 { rxreq expect req.url == "/foo" - txresp -nolen -hdr "Connection: close" - send { } + txresp -nolen -hdr "Transfer-Encoding: chunked" + chunked { } + chunkedlen 0 } -start varnish v1 -vcl+backend { diff --git a/bin/varnishtest/tests/r00730.vtc b/bin/varnishtest/tests/r00730.vtc index 67b9598..e28c8c9 100644 --- a/bin/varnishtest/tests/r00730.vtc +++ b/bin/varnishtest/tests/r00730.vtc @@ -1,4 +1,4 @@ -varnishtest "Check that HEAD returns Content-Length: if backend provides" +varnishtest "Check that HEAD returns Content-Length if backend provides it" server s1 { rxreq @@ -8,6 +8,11 @@ server s1 { } -start varnish v1 -vcl+backend { + sub vcl_recv { + if (req.url == "/2") { + return (pass); + } + } sub vcl_backend_response { set beresp.do_stream = false; } @@ -19,18 +24,8 @@ client c1 { expect resp.http.content-length == 5 } -run - -varnish v1 -vcl+backend { - sub vcl_recv { - return (pass); - } - sub vcl_backend_response { - set beresp.do_stream = false; - } -} - client c1 { - txreq -req HEAD + txreq -req HEAD -url /2 rxresp -no_obj expect resp.http.content-length == 6 } -run diff --git a/bin/varnishtest/tests/r01404.vtc b/bin/varnishtest/tests/r01404.vtc index 1c04139..b9d453b 100644 --- a/bin/varnishtest/tests/r01404.vtc +++ b/bin/varnishtest/tests/r01404.vtc @@ -5,11 +5,7 @@ server s1 { txresp -hdr {ETag: "foo"} -body "11111\n" } -start -varnish v1 -vcl+backend { - sub vcl_backend_response { - set beresp.do_stream = true; - } -} -start +varnish v1 -vcl+backend { } -start client c1 { txreq -hdr {If-None-Match: "foo"} From phk at FreeBSD.org Mon Sep 28 11:31:06 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:06 +0200 Subject: [4.1] 4954ed3 Try to push our code into compliance with RFC7230 section 3.3.3 Message-ID: commit 4954ed3b6183bdf712324506fe7bc6074b20c0fe Author: Poul-Henning Kamp Date: Tue Sep 15 13:01:55 2015 +0000 Try to push our code into compliance with RFC7230 section 3.3.3 diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index c5d3a44..d79cde2 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -238,6 +238,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->preq = req; *priv = ecx; RFC2616_Weaken_Etag(req->resp); + req->res_mode |= RES_ESI; if (req->resp_len != 0) req->resp_len = -1; return (0); diff --git a/bin/varnishd/cache/cache_gzip.c b/bin/varnishd/cache/cache_gzip.c index 7b08f3e..aa516bf 100644 --- a/bin/varnishd/cache/cache_gzip.c +++ b/bin/varnishd/cache/cache_gzip.c @@ -299,6 +299,8 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv, (void)VGZ_Destroy(&vg); return (-1); } + + req->res_mode |= RES_GUNZIP; VGZ_Obuf(vg, vg->m_buf, vg->m_sz); *priv = vg; diff --git a/bin/varnishd/cache/cache_priv.h b/bin/varnishd/cache/cache_priv.h index 8fa4a9a..7d69cfa 100644 --- a/bin/varnishd/cache/cache_priv.h +++ b/bin/varnishd/cache/cache_priv.h @@ -36,7 +36,7 @@ * or may not, be talking a "real" HTTP protocol itself. */ -typedef void vtr_deliver_f (struct req *, struct busyobj *, int wantbody); +typedef void vtr_deliver_f (struct req *, struct busyobj *, int sendbody); struct transport { unsigned magic; diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 4011e95..6c053fc 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -188,7 +188,6 @@ VRG_dorange(struct req *req, const char *r) err = vrg_dorange(req, r); if (err != NULL) { VSLb(req->vsl, SLT_Debug, "RANGE_FAIL %s", err); - http_Unset(req->resp, H_Content_Length); if (req->resp_len >= 0) http_PrintfHeader(req->resp, "Content-Range: bytes */%jd", diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 92cb781..abd6685 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -52,54 +52,60 @@ cnt_vdp(struct req *req, struct busyobj *bo) { const char *r; uint16_t status; - int wantbody; + int sendbody; + intmax_t resp_len; CHECK_OBJ_NOTNULL(req->transport, TRANSPORT_MAGIC); + + resp_len = http_GetContentLength(req->resp); + if (bo != NULL) + req->resp_len = resp_len; + else + req->resp_len = ObjGetLen(req->wrk, req->objcore); + req->res_mode = 0; - wantbody = 1; + + /* RFC 7230, 3.3.3 */ status = http_GetStatus(req->resp); if (!strcmp(req->http0->hd[HTTP_HDR_METHOD].b, "HEAD")) { - wantbody = 0; - } else if (status < 200 || status == 204) { + if (req->objcore->flags & OC_F_PASS) + sendbody = -1; + else + sendbody = 0; + } else if (status < 200 || status == 204 || status == 304) { req->resp_len = 0; - http_Unset(req->resp, H_Content_Length); - wantbody = 0; - } else if (status == 304) { - http_Unset(req->resp, H_Content_Length); - wantbody = 0; - } else if (bo != NULL) - req->resp_len = http_GetContentLength(req->resp); - else - req->resp_len = ObjGetLen(req->wrk, req->objcore); + sendbody = 0; + } else + sendbody = 1; - /* - * Determine ESI status first. Not dependent on wantbody, because - * we want ESI to supress C-L in HEAD too. - */ - if (!req->disable_esi && req->resp_len != 0 && wantbody && - ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) { - req->res_mode |= RES_ESI; + if (!req->disable_esi && req->resp_len != 0 && + ObjGetattr(req->wrk, req->objcore, OA_ESIDATA, NULL) != NULL) VDP_push(req, VDP_ESI, NULL, 0); - } if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && - !RFC2616_Req_Gzip(req->http)) { - req->res_mode |= RES_GUNZIP; + !RFC2616_Req_Gzip(req->http)) VDP_push(req, VDP_gunzip, NULL, 1); - } - /* - * Range comes after the others and pushes on bottom because - * it can (maybe) generate a correct C-L header. - */ if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { http_SetHeader(req->resp, "Accept-Ranges: bytes"); - if (wantbody && http_GetHdr(req->http, H_Range, &r)) + if (sendbody && http_GetHdr(req->http, H_Range, &r)) VRG_dorange(req, r); } - req->transport->deliver(req, bo, wantbody); + if (sendbody < 0) { + /* Don't touch pass+HEAD C-L */ + sendbody = 0; + } else if (resp_len >= 0 && resp_len == req->resp_len) { + /* Reuse C-L header */ + } else { + http_Unset(req->resp, H_Content_Length); + if (req->resp_len >= 0 && sendbody) + http_PrintfHeader(req->resp, + "Content-Length: %jd", req->resp_len); + } + + req->transport->deliver(req, bo, sendbody); } /*-------------------------------------------------------------------- @@ -254,10 +260,12 @@ cnt_synth(struct worker *wrk, struct req *req) VCL_synth_method(req->vcl, wrk, req, NULL, synth_body); - http_Unset(h, H_Content_Length); - AZ(VSB_finish(synth_body)); + http_Unset(h, H_Content_Length); + http_PrintfHeader(req->resp, "Content-Length: %zd", + VSB_len(synth_body)); + /* Discard any lingering request body before delivery */ (void)VRB_Ignore(req); diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index fdd176a..997d28b 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -79,7 +79,7 @@ v1d_error(struct req *req, const char *msg) */ void __match_proto__(vtr_deliver_f) -V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) +V1D_Deliver(struct req *req, struct busyobj *bo, int sendbody) { enum objiter_status ois; @@ -87,19 +87,10 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) CHECK_OBJ_ORNULL(bo, BUSYOBJ_MAGIC); CHECK_OBJ_NOTNULL(req->objcore, OBJCORE_MAGIC); - if (wantbody) { - http_Unset(req->resp, H_Content_Length); - if (req->resp_len >= 0) - http_PrintfHeader(req->resp, - "Content-Length: %jd", req->resp_len); - } - - if (req->resp_len == 0) - wantbody = 0; - else if (http_GetHdr(req->resp, H_Content_Length, NULL)) - req->res_mode |= RES_LEN; - else if (wantbody) { - if (req->http->protover == 11) { + if (sendbody) { + if (http_GetHdr(req->resp, H_Content_Length, NULL)) + req->res_mode |= RES_LEN; + else if (req->http->protover == 11) { req->res_mode |= RES_CHUNKED; http_SetHeader(req->resp, "Transfer-Encoding: chunked"); } else { @@ -118,7 +109,8 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) } else if (!http_GetHdr(req->resp, H_Connection, NULL)) http_SetHeader(req->resp, "Connection: keep-alive"); - VDP_push(req, v1d_bytes, NULL, 1); + if (sendbody && req->resp_len != 0) + VDP_push(req, v1d_bytes, NULL, 1); V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); @@ -132,7 +124,7 @@ V1D_Deliver(struct req *req, struct busyobj *bo, int wantbody) (void)V1L_Flush(req->wrk); ois = OIS_DONE; - if (wantbody) { + if (sendbody && req->resp_len != 0) { if (req->res_mode & RES_CHUNKED) V1L_Chunked(req->wrk); ois = VDP_DeliverObj(req); diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c index 8fa7e9e..8d08278 100644 --- a/bin/varnishd/http1/cache_http1_proto.c +++ b/bin/varnishd/http1/cache_http1_proto.c @@ -272,7 +272,7 @@ http1_splitline(struct http *hp, struct http_conn *htc, const int *hf) /*--------------------------------------------------------------------*/ static enum body_status -http1_body_status(struct http *hp, struct http_conn *htc) +http1_body_status(const struct http *hp, struct http_conn *htc) { ssize_t cl; const char *b; From martin at varnish-software.com Mon Sep 28 11:31:07 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 9f38e1a fallocate will for some filesystems (e.g. xfs) not take the already allocated blocks of the file into account. This will cause fallocate to report ENOSPC when called on an existing fully allocated file unless the filesystem has enough free space to accomodate the complete new file size. Because of this we enable fallocate only on filesystems that are known to work as we expect. Message-ID: commit 9f38e1a8909baeb55f6d4e570948d3f904146303 Author: Martin Blix Grydeland Date: Tue Sep 15 15:09:26 2015 +0200 fallocate will for some filesystems (e.g. xfs) not take the already allocated blocks of the file into account. This will cause fallocate to report ENOSPC when called on an existing fully allocated file unless the filesystem has enough free space to accomodate the complete new file size. Because of this we enable fallocate only on filesystems that are known to work as we expect. Fixes: #1792 diff --git a/lib/libvarnish/vfil.c b/lib/libvarnish/vfil.c index 1a48231..19928ff 100644 --- a/lib/libvarnish/vfil.c +++ b/lib/libvarnish/vfil.c @@ -51,6 +51,9 @@ #ifdef HAVE_SYS_VFS_H # include #endif +#if defined(__linux__) && defined(HAVE_FALLOCATE) +# include +#endif #include "vas.h" #include "vdef.h" @@ -182,11 +185,24 @@ VFIL_allocate(int fd, off_t size, int insist) errno = ENOSPC; return (-1); } -#ifdef HAVE_FALLOCATE - if (!fallocate(fd, 0, 0, size)) - return (0); - if (errno == ENOSPC) - return (-1); +#if defined(__linux__) && defined(HAVE_FALLOCATE) + { + /* fallocate will for some filesystems (e.g. xfs) not take + the already allocated blocks of the file into + account. This will cause fallocate to report ENOSPC + when called on an existing fully allocated file unless + the filesystem has enough free space to accomodate the + complete new file size. Because of this we enable + fallocate only on filesystems that are known to work as + we expect. */ + struct statfs stfs; + if (!fstatfs(fd, &stfs) && stfs.f_type == EXT4_SUPER_MAGIC) { + if (!fallocate(fd, 0, 0, size)) + return (0); + if (errno == ENOSPC) + return (-1); + } + } #endif if (!insist) return (0); From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 7c593da Cover also the case where backend sends nothing with chunked encoding Message-ID: commit 7c593da13ba58096bfb472f6b0b0c7e0718cda35 Author: Poul-Henning Kamp Date: Wed Sep 16 08:59:16 2015 +0000 Cover also the case where backend sends nothing with chunked encoding diff --git a/bin/varnishtest/tests/r01783.vtc b/bin/varnishtest/tests/r01783.vtc index c44b77f..f938a62 100644 --- a/bin/varnishtest/tests/r01783.vtc +++ b/bin/varnishtest/tests/r01783.vtc @@ -4,7 +4,8 @@ server s1 { rxreq txresp -hdr "foo: 1" rxreq - txresp -hdr "foo: 2" + txresp -nolen -hdr "foo: 2" -hdr "Transfer-Encoding: chunked" + chunkedlen 0 } -start varnish v1 -vcl+backend {} -start From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] c709e11 Polish the stale_oc management a little bit. Message-ID: commit c709e110d4e1c70052caae366b8777e87490a8e0 Author: Poul-Henning Kamp Date: Wed Sep 16 20:40:41 2015 +0000 Polish the stale_oc management a little bit. diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 00193ec..78e2512 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -185,6 +185,7 @@ VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo) return; AZ(bo->htc); + AZ(bo->stale_oc); VRTPRIV_dynamic_kill(bo->privs, (uintptr_t)bo); assert(VTAILQ_EMPTY(&bo->privs->privs)); diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 539fee1..a69862f 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -186,8 +186,7 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) } else AZ(bo->stale_oc); - if (bo->stale_oc != NULL && - ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { + if (bo->stale_oc != NULL) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, @@ -394,8 +393,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) AZ(bo->was_304); if (http_IsStatus(bo->beresp, 304)) { - if (bo->stale_oc != NULL && - ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { + if (bo->stale_oc != NULL) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { /* * If we changed the gzip status of the object @@ -906,6 +904,13 @@ vbf_fetch_thread(struct worker *wrk, void *priv) bo->wrk = wrk; wrk->vsl = bo->vsl; + if (bo->stale_oc != NULL) { + CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); + /* We don't want the oc/stevedore ops in fetching thread */ + if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) + (void)HSH_DerefObjCore(wrk, &bo->stale_oc); + } + while (stp != F_STP_DONE) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); assert(bo->refcount >= 1); @@ -937,7 +942,6 @@ vbf_fetch_thread(struct worker *wrk, void *priv) if (bo->stale_oc != NULL) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); - wrk->vsl = NULL; VBO_DerefBusyObj(wrk, &bo); THR_SetBusyobj(NULL); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index abd6685..b7afe84 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -60,7 +60,7 @@ cnt_vdp(struct req *req, struct busyobj *bo) resp_len = http_GetContentLength(req->resp); if (bo != NULL) req->resp_len = resp_len; - else + else req->resp_len = ObjGetLen(req->wrk, req->objcore); req->res_mode = 0; From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 75b1392 Make sure any halfbaked object is always deallocated when we hit stp_error and make a new object. Message-ID: commit 75b1392b8f67cf3bf522e85d0af7f2e9848748d0 Author: Poul-Henning Kamp Date: Wed Sep 16 21:31:29 2015 +0000 Make sure any halfbaked object is always deallocated when we hit stp_error and make a new object. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index a69862f..262d791 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -658,17 +658,15 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) vbf_fetch_body_helper(bo); } - if (bo->vfc->failed && !bo->do_stream) { - assert(bo->state < BOS_STREAM); - ObjFreeObj(bo->wrk, bo->fetch_objcore); - // XXX: doclose = ? - VDI_Finish(bo->wrk, bo); - return (F_STP_ERROR); - } - if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); - return (F_STP_FAIL); + if (!bo->do_stream) { + assert(bo->state < BOS_STREAM); + // XXX: doclose = ? + return (F_STP_ERROR); + } else { + return (F_STP_FAIL); + } } if (bo->do_stream) @@ -775,8 +773,12 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + CHECK_OBJ_NOTNULL(bo->fetch_objcore, OBJCORE_MAGIC); assert(bo->director_state == DIR_S_NULL); + if(bo->fetch_objcore->stobj->stevedore != NULL) + ObjFreeObj(bo->wrk, bo->fetch_objcore); + now = W_TIM_real(wrk); VSLb_ts_busyobj(bo, "Error", now); @@ -792,10 +794,8 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo) http_TimeHeader(bo->beresp, "Date: ", now); http_SetHeader(bo->beresp, "Server: Varnish"); + EXP_Clr(&bo->fetch_objcore->exp); bo->fetch_objcore->exp.t_origin = bo->t_prev; - bo->fetch_objcore->exp.ttl = 0; - bo->fetch_objcore->exp.grace = 0; - bo->fetch_objcore->exp.keep = 0; VCL_backend_error_method(bo->vcl, wrk, NULL, bo, synth_body); diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 41c6c9e..57e06b8 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -52,6 +52,7 @@ obj_getmethods(const struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(oc->stobj->stevedore); CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC); AN(oc->stobj->stevedore->methods); return (oc->stobj->stevedore->methods); @@ -443,6 +444,7 @@ ObjFreeObj(struct worker *wrk, struct objcore *oc) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); AN(m->freeobj); m->freeobj(wrk, oc); + AZ(oc->stobj->stevedore); } /*==================================================================== diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 8119aad..3a5698d 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -508,6 +508,7 @@ smp_oc_freeobj(struct worker *wrk, struct objcore *oc) } Lck_Unlock(&sg->sc->mtx); + memset(oc->stobj, 0, sizeof oc->stobj); } /*-------------------------------------------------------------------- From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 2e22c1c I broke discarding old objects when they have been replaced in c709e110d4e1c70052caae366b8777e87490a8e0. Message-ID: commit 2e22c1c3817ffc106db1903941661f5873f612a9 Author: Poul-Henning Kamp Date: Mon Sep 21 10:19:01 2015 +0000 I broke discarding old objects when they have been replaced in c709e110d4e1c70052caae366b8777e87490a8e0. Spotted by: Martin Test-case by: Martin diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 262d791..8ee198b 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -186,7 +186,8 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) } else AZ(bo->stale_oc); - if (bo->stale_oc != NULL) { + if (bo->stale_oc != NULL && + ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, @@ -393,7 +394,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) AZ(bo->was_304); if (http_IsStatus(bo->beresp, 304)) { - if (bo->stale_oc != NULL) { + if (bo->stale_oc != NULL && + ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { if (ObjCheckFlag(bo->wrk, bo->stale_oc, OF_CHGGZIP)) { /* * If we changed the gzip status of the object @@ -904,12 +906,14 @@ vbf_fetch_thread(struct worker *wrk, void *priv) bo->wrk = wrk; wrk->vsl = bo->vsl; +#if 0 if (bo->stale_oc != NULL) { CHECK_OBJ_NOTNULL(bo->stale_oc, OBJCORE_MAGIC); /* We don't want the oc/stevedore ops in fetching thread */ if (!ObjCheckFlag(wrk, bo->stale_oc, OF_IMSCAND)) (void)HSH_DerefObjCore(wrk, &bo->stale_oc); } +#endif while (stp != F_STP_DONE) { CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); diff --git a/bin/varnishtest/tests/c00072.vtc b/bin/varnishtest/tests/c00072.vtc new file mode 100644 index 0000000..19453a0 --- /dev/null +++ b/bin/varnishtest/tests/c00072.vtc @@ -0,0 +1,50 @@ +varnishtest "purge stale on refresh with and without IMS" + +server s1 { + rxreq + txresp -hdr "foo: bar" + rxreq + txresp -hdr "foo: bar" -hdr {ETag: "asdf"} + + rxreq + txresp -hdr "foo: baz" + rxreq + expect req.http.if-none-match == {"asdf"} + txresp -status 304 -nolen -hdr "foo: baz" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.ttl = 0.1s; + set beresp.grace = 0s; + set beresp.keep = 60s; + } +} -start + +client c1 { + txreq -url /no-ims + rxresp + expect resp.http.foo == "bar" + txreq -url /ims + rxresp + expect resp.http.foo == "bar" +} -run + +# Wait for ttl to expire on both objects +delay 0.2 +varnish v1 -expect n_object == 2 + +client c1 { + txreq -url /no-ims + rxresp + expect resp.http.foo == "baz" + txreq -url /ims + rxresp + expect resp.http.foo == "baz" +} -run + +# Make sure expiry is done +delay 1 + +# Only one of each of /no-ims and /ims should be left +varnish v1 -expect n_object == 2 From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 2c20289 Assert polishing Message-ID: commit 2c20289d60bf2d3db4d82951181b86dccef9e3dd Author: Poul-Henning Kamp Date: Mon Sep 21 10:34:11 2015 +0000 Assert polishing diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 57e06b8..7413329 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -52,7 +52,6 @@ obj_getmethods(const struct objcore *oc) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); - AN(oc->stobj->stevedore); CHECK_OBJ_NOTNULL(oc->stobj->stevedore, STEVEDORE_MAGIC); AN(oc->stobj->stevedore->methods); return (oc->stobj->stevedore->methods); @@ -61,10 +60,11 @@ obj_getmethods(const struct objcore *oc) static struct object * obj_getobj(struct worker *wrk, struct objcore *oc) { - const struct storeobj_methods *m = obj_getmethods(oc); + const struct storeobj_methods *m; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + m = obj_getmethods(oc); AN(m->getobj); return (m->getobj(wrk, oc)); } diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 3a5698d..6d5c771 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -396,11 +396,12 @@ smp_oc_getobj(struct worker *wrk, struct objcore *oc) uint64_t l; int bad; - /* Some calls are direct, but they should match anyway */ - assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj); - CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + AN(oc->stobj->stevedore); + + /* Some calls are direct, but they should match anyway */ + assert(oc->stobj->stevedore->methods->getobj == smp_oc_getobj); CAST_OBJ_NOTNULL(sg, oc->stobj->priv, SMP_SEG_MAGIC); so = smp_find_so(sg, oc->stobj->priv2); From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] c440f0e Adopt libz/libvgz fix from FreeBSD: Message-ID: commit c440f0e69325429a58fa648d07232f637573e4f6 Author: Poul-Henning Kamp Date: Mon Sep 21 11:26:20 2015 +0000 Adopt libz/libvgz fix from FreeBSD: r287541 | dim | 2015-09-07 20:55:14 +0000 (Mon, 07 Sep 2015) | 7 lines In libz's inflateMark(), avoid left-shifting a negative integer, which is undefined. Reviewed by: delphij Differential Revision: https://reviews.freebsd.org/D3344 MFC after: 3 days diff --git a/lib/libvgz/inflate.c b/lib/libvgz/inflate.c index e3e9fce..5c1a641 100644 --- a/lib/libvgz/inflate.c +++ b/lib/libvgz/inflate.c @@ -1510,7 +1510,7 @@ z_streamp strm; { struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; + if (strm == Z_NULL || strm->state == Z_NULL) return -(1L << 16); state = (struct inflate_state FAR *)strm->state; return ((long)(state->back) << 16) + (state->mode == COPY ? state->length : From fgsch at lodoss.net Mon Sep 28 11:31:07 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 2a582e5 Allow to change varnishtest's buffer size Message-ID: commit 2a582e59fc69a22fc17c5c23036b252cde55607b Author: Federico G. Schwindt Date: Mon Sep 21 12:56:58 2015 +0100 Allow to change varnishtest's buffer size From Carlos Abalde (carlos-dot-abalde-at-gmail-dot-com) with comments from Dridi and phk. diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index cfdea02..60b6fcb 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -46,6 +46,7 @@ #include "vev.h" #include "vfil.h" +#include "vnum.h" #include "vqueue.h" #include "vrnd.h" #include "vsa.h" @@ -80,6 +81,7 @@ struct vtc_job { int iflg = 0; unsigned vtc_maxdur = 60; +unsigned vtc_bufsiz = 512 * 1024; static VTAILQ_HEAD(, vtc_tst) tst_head = VTAILQ_HEAD_INITIALIZER(tst_head); static struct vev_base *vb; @@ -124,6 +126,7 @@ usage(void) { fprintf(stderr, "usage: varnishtest [options] file ...\n"); #define FMT " %-28s # %s\n" + fprintf(stderr, FMT, "-b size", "Set internal buffer size (default: 512K)"); fprintf(stderr, FMT, "-D name=val", "Define macro"); fprintf(stderr, FMT, "-i", "Find varnishd in build tree"); fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel"); @@ -234,7 +237,7 @@ start_test(void) ALLOC_OBJ(jp, JOB_MAGIC); AN(jp); - jp->bufsiz = 512*1024; /* XXX */ + jp->bufsiz = vtc_bufsiz; jp->buf = mmap(NULL, jp->bufsiz, PROT_READ|PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0); @@ -432,6 +435,7 @@ main(int argc, char * const *argv) int ntest = 1; /* Run tests this many times */ struct vtc_tst *tp; char *p; + uintmax_t bufsiz; /* Default names of programs */ #define VTC_PROG(l) extmacro_def(#l, #l); @@ -453,8 +457,21 @@ main(int argc, char * const *argv) setbuf(stdout, NULL); setbuf(stderr, NULL); - while ((ch = getopt(argc, argv, "D:ij:klLn:qt:vW")) != -1) { + while ((ch = getopt(argc, argv, "b:D:ij:klLn:qt:vW")) != -1) { switch (ch) { + case 'b': + if (VNUM_2bytes(optarg, &bufsiz, 0)) { + fprintf(stderr, "Cannot parse b opt '%s'\n", + optarg); + exit(2); + } + if (bufsiz > UINT_MAX) { + fprintf(stderr, "Invalid b opt '%s'\n", + optarg); + exit(2); + } + vtc_bufsiz = (unsigned)bufsiz; + break; case 'D': if (!parse_D_opt(optarg)) { fprintf(stderr, "Cannot parse D opt '%s'\n", diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 5aa1928..00828ff 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -15,7 +15,7 @@ Test program for Varnish SYNOPSIS ======== -varnishtest [-iklLqv] [-n iter] [-D name=val] [-j jobs] [-t duration] file [file ...] +varnishtest [-iklLqv] [-n iter] [-b size] [-D name=val] [-j jobs] [-t duration] file [file ...] DESCRIPTION =========== @@ -30,6 +30,8 @@ simulate a transaction to provoke a specific behavior. The following options are available: +-b size Set internal buffer size (default: 512K) + -D name=val Define macro for use in scripts -i Find varnishd in build tree From fgsch at lodoss.net Mon Sep 28 11:31:07 2015 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] a2e1557 Update params and minor style changes Message-ID: commit a2e15572b2c8349f263b3c653eae2682932a848e Author: Federico G. Schwindt Date: Mon Sep 21 13:08:33 2015 +0100 Update params and minor style changes diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index 60b6fcb..9c9f255 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -126,17 +126,19 @@ usage(void) { fprintf(stderr, "usage: varnishtest [options] file ...\n"); #define FMT " %-28s # %s\n" - fprintf(stderr, FMT, "-b size", "Set internal buffer size (default: 512K)"); + fprintf(stderr, FMT, "-b size", + "Set internal buffer size (default: 512K)"); fprintf(stderr, FMT, "-D name=val", "Define macro"); fprintf(stderr, FMT, "-i", "Find varnishd in build tree"); fprintf(stderr, FMT, "-j jobs", "Run this many tests in parallel"); fprintf(stderr, FMT, "-k", "Continue on test failure"); - fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails"); fprintf(stderr, FMT, "-L", "Always leave temporary vtc.*"); + fprintf(stderr, FMT, "-l", "Leave temporary vtc.* if test fails"); fprintf(stderr, FMT, "-n iterations", "Run tests this many times"); fprintf(stderr, FMT, "-q", "Quiet mode: report only failures"); fprintf(stderr, FMT, "-t duration", "Time tests out after this long"); fprintf(stderr, FMT, "-v", "Verbose mode: always report test log"); + fprintf(stderr, FMT, "-W", "Enable the witness facility for locking"); fprintf(stderr, "\n"); exit(1); } @@ -457,17 +459,17 @@ main(int argc, char * const *argv) setbuf(stdout, NULL); setbuf(stderr, NULL); - while ((ch = getopt(argc, argv, "b:D:ij:klLn:qt:vW")) != -1) { + while ((ch = getopt(argc, argv, "b:D:hij:kLln:qt:vW")) != -1) { switch (ch) { case 'b': if (VNUM_2bytes(optarg, &bufsiz, 0)) { fprintf(stderr, "Cannot parse b opt '%s'\n", - optarg); + optarg); exit(2); } if (bufsiz > UINT_MAX) { fprintf(stderr, "Invalid b opt '%s'\n", - optarg); + optarg); exit(2); } vtc_bufsiz = (unsigned)bufsiz; @@ -475,7 +477,7 @@ main(int argc, char * const *argv) case 'D': if (!parse_D_opt(optarg)) { fprintf(stderr, "Cannot parse D opt '%s'\n", - optarg); + optarg); exit(2); } break; @@ -485,12 +487,12 @@ main(int argc, char * const *argv) case 'j': npar = strtoul(optarg, NULL, 0); break; - case 'l': - leave_temp = 1; - break; case 'L': leave_temp = 2; break; + case 'l': + leave_temp = 1; + break; case 'k': vtc_continue = !vtc_continue; break; diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 00828ff..5bfca7b 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -15,7 +15,7 @@ Test program for Varnish SYNOPSIS ======== -varnishtest [-iklLqv] [-n iter] [-b size] [-D name=val] [-j jobs] [-t duration] file [file ...] +varnishtest [-hikLlqvW] [-b size] [-D name=val] [-j jobs] [-n iter] [-t duration] file [file ...] DESCRIPTION =========== @@ -34,16 +34,18 @@ The following options are available: -D name=val Define macro for use in scripts +-h Show help + -i Find varnishd in build tree -j jobs Run this many tests in parallel -k Continue on test failure --l Leave temporary vtc.* if test fails - -L Always leave temporary vtc.* +-l Leave temporary vtc.* if test fails + -n iterations Run tests this many times -q Quiet mode: report only failures @@ -54,8 +56,6 @@ The following options are available: -W Enable the witness facility for locking --h Show help - file File to use as a script From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 6c14014 Fixes to get the "Makefile.phk" to work again fram Kacper. Message-ID: commit 6c14014dc1b70914e3832f0503536dd1b2d1550d Author: Poul-Henning Kamp Date: Mon Sep 21 12:21:50 2015 +0000 Fixes to get the "Makefile.phk" to work again fram Kacper. Minor fixes for FreeBSD by: phk diff --git a/Makefile.inc.phk b/Makefile.inc.phk index 216dcad..c864efa 100644 --- a/Makefile.inc.phk +++ b/Makefile.inc.phk @@ -196,6 +196,8 @@ vcc_if.c vcc_if.h: vmod.vcc $(TOPDIR)/lib/libvcc/vmodtool.py $(VMODNAME).so: $(VMOD_OBJ) $(CC) $(VMOD_LDFLAGS) -o $(VMODNAME).so $^ + mkdir -p .libs + (cd .libs && ln -sf ../$(VMODNAME).so) .PHONY: vmod_install vmod_install: $(VMODNAME).so diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk index 9922d9f..e849a28 100644 --- a/bin/varnishd/Makefile.phk +++ b/bin/varnishd/Makefile.phk @@ -1,13 +1,14 @@ -VPATH += cache common mgt waiter storage hash +VPATH += cache common mgt waiter storage hash http1 proxy PROG_SRC += cache/cache_acceptor.c PROG_SRC += cache/cache_backend.c PROG_SRC += cache/cache_backend_cfg.c -PROG_SRC += cache/cache_backend_poll.c +PROG_SRC += cache/cache_backend_tcp.c +PROG_SRC += cache/cache_backend_probe.c PROG_SRC += cache/cache_ban.c PROG_SRC += cache/cache_busyobj.c PROG_SRC += cache/cache_cli.c -PROG_SRC += cache/cache_dir.c +PROG_SRC += cache/cache_director.c PROG_SRC += cache/cache_esi_deliver.c PROG_SRC += cache/cache_esi_fetch.c PROG_SRC += cache/cache_esi_parse.c @@ -17,18 +18,23 @@ PROG_SRC += cache/cache_fetch_proc.c PROG_SRC += cache/cache_gzip.c PROG_SRC += cache/cache_hash.c PROG_SRC += cache/cache_http.c -PROG_SRC += cache/cache_http1_deliver.c -PROG_SRC += cache/cache_http1_fetch.c -PROG_SRC += cache/cache_http1_fsm.c -PROG_SRC += cache/cache_http1_proto.c +PROG_SRC += http1/cache_http1_deliver.c +PROG_SRC += http1/cache_http1_fetch.c +PROG_SRC += http1/cache_http1_fsm.c +PROG_SRC += http1/cache_http1_proto.c +PROG_SRC += http1/cache_http1_pipe.c +PROG_SRC += http1/cache_http1_line.c +PROG_SRC += http1/cache_http1_vfp.c PROG_SRC += cache/cache_lck.c PROG_SRC += cache/cache_main.c PROG_SRC += cache/cache_mempool.c PROG_SRC += cache/cache_obj.c PROG_SRC += cache/cache_panic.c -PROG_SRC += cache/cache_pipe.c PROG_SRC += cache/cache_pool.c +PROG_SRC += cache/cache_range.c +PROG_SRC += cache/cache_req.c PROG_SRC += cache/cache_req_fsm.c +PROG_SRC += cache/cache_req_body.c PROG_SRC += cache/cache_rfc2616.c PROG_SRC += cache/cache_session.c PROG_SRC += cache/cache_shmlog.c @@ -38,16 +44,19 @@ PROG_SRC += cache/cache_vrt.c PROG_SRC += cache/cache_vrt_re.c PROG_SRC += cache/cache_vrt_var.c PROG_SRC += cache/cache_vrt_vmod.c +PROG_SRC += cache/cache_vrt_priv.c PROG_SRC += cache/cache_wrk.c -PROG_SRC += cache/cache_wrw.c PROG_SRC += cache/cache_ws.c +PROG_SRC += cache/cache_deliver_proc.c + +PROG_SRC += proxy/cache_proxy_proto.c PROG_SRC += common/common_vsc.c PROG_SRC += common/common_vsm.c PROG_SRC += hash/hash_classic.c PROG_SRC += hash/hash_critbit.c -PROG_SRC += hash/hash_mgt.c +PROG_SRC += hash/mgt_hash.c PROG_SRC += hash/hash_simple_list.c PROG_SRC += mgt/mgt_child.c @@ -59,18 +68,21 @@ PROG_SRC += mgt/mgt_param_tbl.c PROG_SRC += mgt/mgt_param_tcp.c PROG_SRC += mgt/mgt_param_tweak.c PROG_SRC += mgt/mgt_pool.c -PROG_SRC += mgt/mgt_sandbox.c -PROG_SRC += mgt/mgt_sandbox_solaris.c +PROG_SRC += mgt/mgt_jail.c +PROG_SRC += mgt/mgt_jail_unix.c +PROG_SRC += mgt/mgt_jail_solaris.c PROG_SRC += mgt/mgt_shmem.c PROG_SRC += mgt/mgt_vcc.c +PROG_SRC += mgt/mgt_vcl.c +PROG_SRC += mgt/mgt_acceptor.c PROG_SRC += storage/stevedore.c -PROG_SRC += storage/stevedore_mgt.c +PROG_SRC += storage/mgt_stevedore.c PROG_SRC += storage/stevedore_utils.c PROG_SRC += storage/storage_file.c PROG_SRC += storage/storage_malloc.c PROG_SRC += storage/storage_persistent.c -PROG_SRC += storage/storage_persistent_mgt.c +PROG_SRC += storage/mgt_storage_persistent.c PROG_SRC += storage/storage_persistent_silo.c PROG_SRC += storage/storage_persistent_subr.c PROG_SRC += storage/storage_umem.c @@ -98,6 +110,8 @@ MADE_FILES += builtin_vcl.h TODO_INSTALL += install_etc +CFLAGS += -DVARNISHD_IS_NOT_A_VMOD + TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk diff --git a/bin/varnishhist/Makefile.phk b/bin/varnishhist/Makefile.phk index 145414d..77e8c31 100644 --- a/bin/varnishhist/Makefile.phk +++ b/bin/varnishhist/Makefile.phk @@ -1,7 +1,10 @@ PROG_SRC = varnishhist.c +PROG_SRC += varnishhist_options.c -LD_ADD += ${LIB_VARNISH} +LD_ADD += ${LIB_VARNISHTOOLS} LD_ADD += ${LIB_VARNISHAPI} +LD_ADD += ${LIB_VARNISH} +LD_ADD += -lpthread -lncurses -lm ${LIB_PCRE} TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk diff --git a/bin/varnishtest/Makefile.phk b/bin/varnishtest/Makefile.phk index 748977e..438bfed 100644 --- a/bin/varnishtest/Makefile.phk +++ b/bin/varnishtest/Makefile.phk @@ -7,6 +7,7 @@ PROG_SRC += vtc_main.c PROG_SRC += vtc_sema.c PROG_SRC += vtc_server.c PROG_SRC += vtc_varnish.c +PROG_SRC += vtc_process.c LD_ADD += ${LIB_VARNISHAPI} LD_ADD += ${LIB_VARNISH} @@ -26,4 +27,4 @@ include $(TOPDIR)/Makefile.inc.phk .PHONY: all_tests all_tests: - ./varnishtest -i -j 4 tests/*.vtc + ./varnishtest -i -j 24 tests/*.vtc diff --git a/bin/varnishtop/Makefile.phk b/bin/varnishtop/Makefile.phk index 3c5684c..7f8d760 100644 --- a/bin/varnishtop/Makefile.phk +++ b/bin/varnishtop/Makefile.phk @@ -5,7 +5,7 @@ LD_ADD += ${LIB_VARNISHTOOLS} LD_ADD += ${LIB_VARNISHAPI} LD_ADD += ${LIB_VARNISH} LD_ADD += ${LIB_PCRE} -LD_ADD += -lm +LD_ADD += -lm -lpthread -lncurses TODO_ALL += build_man diff --git a/config.phk b/config.phk index 16c3571..760ea22 100644 --- a/config.phk +++ b/config.phk @@ -63,7 +63,9 @@ if true ; then ncursesw/curses.h \ priv.h \ pthread_np.h \ + edit/readline/readline.h \ readline/history.h \ + editline/readline.h \ readline/readline.h \ sys/endian.h \ sys/filio.h \ @@ -88,7 +90,10 @@ if true ; then echo "#define PACKAGE_VERSION \"${ADM_VERSION}\"" >> ${CONFIG_H}_ echo ' + #define VARNISH_VCL_DIR "/etc/varnish" #define VARNISH_STATE_DIR "/tmp/phk/" + #define VARNISH_VMOD_DIR "/usr/lib/varnish/vmods" + #define VCS_Branch "master" ' >> ${CONFIG_H}_ if [ ! -f ${CONFIG_H} ] ; then mv ${CONFIG_H}_ ${CONFIG_H} @@ -107,8 +112,10 @@ VMAV=include/vmod_abi.h if [ -d ./.git ] ; then V=`git show -s --pretty=format:%h` + B=`git rev-parse --abbrev-ref HEAD` else V="NOGIT" + B="NOGIT" fi ( echo "/* $V */" @@ -119,6 +126,7 @@ echo " * make(1) updates this when necessary" echo " *" echo " */" echo "#define VCS_Version \"$V\"" +echo "#define VCS_Branch \"$B\"" ) > ${VCSF}_ if [ ! -f ${VCSF} ] ; then mv ${VCSF}_ ${VCSF} diff --git a/doc/sphinx/Makefile.phk b/doc/sphinx/Makefile.phk index 7e43fef..8ed14ae 100644 --- a/doc/sphinx/Makefile.phk +++ b/doc/sphinx/Makefile.phk @@ -156,7 +156,6 @@ EXTRA_DIST = \ users-guide/intro.rst \ users-guide/operation-logging.rst \ users-guide/operation-statistics.rst \ - users-guide/params.rst \ users-guide/performance.rst \ users-guide/purging.rst \ users-guide/report.rst \ @@ -179,7 +178,19 @@ EXTRA_DIST = \ users-guide/vcl-saint-and-grace.rst \ users-guide/vcl-syntax.rst \ users-guide/vcl-variables.rst \ - users-guide/vcl.rst + users-guide/vcl.rst \ + include/params.rst \ + include/varnishncsa_options.rst \ + include/varnishncsa_synopsis.rst \ + include/varnishlog_options.rst \ + include/varnishlog_synopsis.rst \ + include/varnishtop_options.rst \ + include/varnishtop_synopsis.rst \ + include/varnishhist_options.rst \ + include/varnishhist_synopsis.rst \ + reference/vmod_std.generated.rst \ + reference/vmod_directors.generated.rst + dist-hook: $(MAKE) html @@ -188,6 +199,41 @@ dist-hook: distclean-local: rm -rf $(BUILDDIR) -# XXX: doesn't work... -#reference/params.rst: $(top_builddir)/bin/varnishd/varnishd -# $(top_builddir)/bin/varnishd/varnishd -x dumprstparam > reference/params.rst +# XXX: here be dragons +include/params.rst: ../../bin/varnishd/varnishd + ../../bin/varnishd/varnishd -x dumprstparam > $@ + + +# only sphinx needs the opt2rst stuff anyway +%_opt2rst: ../../bin/%/%_options.h %_options.c + +include/varnishncsa_options.rst: varnishncsa_opt2rst + ../../bin/varnishncsa/varnishncsa_opt2rst options > $@ + +include/varnishncsa_synopsis.rst: varnishncsa_opt2rst + ../../bin/varnishncsa/varnishncsa_opt2rst synopsis > $@ + +include/varnishlog_options.rst: varnishlog_opt2rst + ../../bin/varnishlog/varnishlog_opt2rst options > $@ + +include/varnishlog_synopsis.rst: varnishlog_opt2rst + ../../bin/varnishlog/varnishlog_opt2rst synopsis > $@ + +include/varnishtop_options.rst: varnishtop_opt2rst + ../../bin/varnishtop/varnishtop_opt2rst options > $@ + +include/varnishtop_synopsis.rst: varnishtop_opt2rst + ../../bin/varnishtop/varnishtop_opt2rst synopsis > $@ + +include/varnishhist_options.rst: varnishhist_opt2rst + ./varnishhist_opt2rst options > $@ + +include/varnishhist_synopsis.rst: varnishhist_opt2rst + ./varnishhist_opt2rst synopsis > $@ + +reference/vmod_std.generated.rst: reference ../../lib/libvmod_std/vmod_std.rst + cp ../../lib/libvmod_std/vmod_std.rst $@ + +reference/vmod_directors.generated.rst: reference ../../lib/libvmod_directors/vmod_directors.rst + cp ../../lib/libvmod_directors/vmod_directors.rst $@ + diff --git a/lib/libvmod_debug/Makefile.phk b/lib/libvmod_debug/Makefile.phk index a692640..35135cb 100644 --- a/lib/libvmod_debug/Makefile.phk +++ b/lib/libvmod_debug/Makefile.phk @@ -1,6 +1,7 @@ VMOD_SRC += vmod_debug.c VMOD_SRC += vmod_debug_obj.c +VMOD_SRC += vmod_debug_dyn.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk From martin at varnish-software.com Mon Sep 28 11:31:07 2015 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] fda295b Only add size of struct object when using default storeobj_methods Message-ID: commit fda295b73341a762db28ed1d6441a0616efcbd88 Author: Martin Blix Grydeland Date: Tue Sep 22 15:53:38 2015 +0200 Only add size of struct object when using default storeobj_methods This is to not leak the size of struct object to stevedores that might have their own cache_obj.c implementation. diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index 77a601c..0929ba8 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -219,12 +219,14 @@ STV_MkObject(const struct stevedore *stv, struct objcore *oc, void *ptr) int stv_default_allocobj(const struct stevedore *stv, struct objcore *oc, - unsigned ltot) + unsigned wsl) { struct object *o; struct storage *st; + unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + ltot = sizeof(struct object) + PRNDUP(wsl); st = stv->alloc(stv, ltot); if (st == NULL) return (0); @@ -250,24 +252,20 @@ STV_NewObject(struct objcore *oc, struct worker *wrk, const char *hint, unsigned wsl) { struct stevedore *stv, *stv0; - unsigned ltot; int i, j; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); assert(wsl > 0); - wsl = PRNDUP(wsl); - - ltot = sizeof(struct object) + wsl; stv = stv0 = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); if (j == 0 && hint == NULL) { do { stv = stv_pick_stevedore(wrk->vsl, &hint); AN(stv->allocobj); - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); } while (j == 0 && stv != stv0); } if (j == 0) { @@ -275,7 +273,7 @@ STV_NewObject(struct objcore *oc, struct worker *wrk, for (i = 0; j == 0 && i < cache_param->nuke_limit; i++) { if (EXP_NukeOne(wrk, stv->lru) == -1) break; - j = stv->allocobj(stv, oc, ltot); + j = stv->allocobj(stv, oc, wsl); } } diff --git a/bin/varnishd/storage/storage_persistent.c b/bin/varnishd/storage/storage_persistent.c index 160cc35..2679675 100644 --- a/bin/varnishd/storage/storage_persistent.c +++ b/bin/varnishd/storage/storage_persistent.c @@ -502,7 +502,7 @@ smp_allocx(const struct stevedore *st, size_t min_size, size_t max_size, */ static int -smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) +smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned wsl) { struct object *o; struct storage *st; @@ -510,6 +510,7 @@ smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) struct smp_seg *sg; struct smp_object *so; unsigned objidx; + unsigned ltot; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); CAST_OBJ_NOTNULL(sc, stv->priv, SMP_SC_MAGIC); @@ -518,6 +519,7 @@ smp_allocobj(const struct stevedore *stv, struct objcore *oc, unsigned ltot) if ((oc->exp.ttl + oc->exp.grace + oc->exp.keep) <= 0.) return (0); + ltot = sizeof(struct object) + PRNDUP(wsl); ltot = IRNUP(sc, ltot); st = smp_allocx(stv, ltot, ltot, &so, &objidx, &sg); From dridi.boukelmoune at gmail.com Mon Sep 28 11:31:07 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 4f6de9e Partial rewrite of the docs on writing a director Message-ID: commit 4f6de9ecd0bd2fa25dba66497964b1d8388f98bf Author: Dridi Boukelmoune Date: Thu Sep 24 08:02:06 2015 +0200 Partial rewrite of the docs on writing a director Better ordering of the topics, and hopefully better wording overall. diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 9f1381c..23c73ee 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -54,59 +54,49 @@ A director can be summed up as: - a set of operations - the associated state -What's the difference between a *cluster* director and a *backend* director? +The difference between a *cluster* director and a *backend* director is mainly The functions they will implement. -Creating a Director -=================== - -Custom Backends ---------------- - -If you want to implement a custom backend, have a look at how Varnish -implements native backends. It is the canonical implementation, and though it -provides other services like connection pooling or statistics, it is -essentially a director which state is a ``struct backend``. Varnish native -backends currently speak HTTP/1 over TCP, and as such, you need to make your -own custom backend if you want Varnish to do otherwise such as connect over -UDP or UNIX-domain sockets or speak a different protocol. +Cluster Directors +================= -You may also consider making your custom backend compliant with regards to the -VCL state (see :ref:`ref-vmod-event-functions`). +As in :ref:`vmod_directors(3)`, you can write directors that will group +backends sharing the same role, and pick them according to a strategy. If you +need more than the built-in strategies (round-robin, hash, ...), even though +they can be stacked, it is always possible to write your own. -A "backend" director must not implement the ``resolve`` function. More on that -below (:ref:`ref-writing-a-director-cluster`). +In this case you simply need to implement the ``resolve`` function for the +director. Directors are walked until a leaf director is found. A leaf director +doesn't have a ``resolve`` function and is used to actually make the backend +request, just like the backends you declare in VCL. Dynamic Backends ----------------- - -.. TODO document the VRT_BACKEND_FIELDS dance +================ If you want to speak HTTP/1 over TCP, but for some reason VCL does not fit the bill, you can instead reuse the whole backend facility. It allows you for instance to add and remove backends on-demand without the need to reload your VCL. You can then leverage your provisioning system. -You don't really deal with ``struct backend``, all you need is available -through the runtime API. Consider the following snippet:: +Consider the following snippet:: backend default { .host = "localhost"; } -The VCL compiler will turn this declaration into a ``struct vrt_backend``. When -the VCL is loaded, Varnish will call ``VRT_new_backend`` in order to create the -director. Dynamic backends are built just like static backends, one *struct* at -a time. You can get rid of the ``struct vrt_backend`` as soon as you have the -``struct director``. +The VCL compiler turns this declaration into a ``struct vrt_backend``. When the +VCL is loaded, Varnish calls ``VRT_new_backend`` in order to create the +director. Varnish doesn't expose its data structure for actual backends, only +the director abstraction and dynamic backends are built just like static +backends, one *struct* at a time. You can get rid of the ``struct vrt_backend`` +as soon as you have the ``struct director``. -Unlike a custom backend, a dynamic backend can't exceed its VCL's lifespan, -because native backends are *owned* by VCLs. Though a dynamic backend can't -outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The -VCL will delete the remaining backends once discarded, you don't need to take -care of it. +A (dynamic) backend can't exceed its VCL's lifespan, because native backends +are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be +deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining +backends once discarded, you don't need to take care of it. Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure @@ -124,20 +114,6 @@ subscribe to VCL events and watch for VCL state (see .. _ref-writing-a-director-cluster: -Cluster Directors ------------------ - -As in :ref:`vmod_directors(3)`, you can write directors that will group -backends sharing the same role, and pick them according to a strategy. If you -need more than the built-in strategies (round-robin, hash, ...), even though -they can be stacked, it is always possible to write your own. - -In this case you simply need to implement the ``resolve`` function for the -director. Directors are walked until a leaf director is found. A leaf director -doesn't have a ``resolve`` function and is used to actually make the backend -request. - - Health Probes ============= @@ -157,3 +133,39 @@ probe and disable the feature on a cold VCL (see Instead of initializing your own probe definition, you can get a ``VCL_PROBE`` directly built from VCL (see :ref:`ref-vmod-vcl-c-types`). + +What's the difference ? + + +Custom Backends +=============== + +If you want to implement a custom backend, have a look at how Varnish +implements native backends. It is the canonical implementation, and though it +provides other services like connection pooling or statistics, it is +essentially a director which state is a ``struct backend``. Varnish native +backends currently speak HTTP/1 over TCP, and as such, you need to make your +own custom backend if you want Varnish to do otherwise such as connect over +UDP or UNIX-domain sockets or speak a different protocol. + +If you want to leverage probes declarations in VCL, which have the advantage of +being reusable since they are only specifications, you can. However, you need +to implement the whole probing infrastructure from scratch. + +You may also consider making your custom backend compliant with regards to the +VCL state (see :ref:`ref-vmod-event-functions`). + + +Data structure considerations +----------------------------- + +When you are creating a custom backend, you may want to provide the semantics +of the native backends. In this case, instead of repeating the redundant fields +between data structures, you can use the macros ``VRT_BACKEND_FIELDS`` and +``VRT_BACKEND_PROBE_FIELDS`` to declare them all at once. This is the little +dance Varnish uses to copy data between the ``struct vrt_backend`` and its +internal data structure for example. + +The copy can be automated with the macros ``VRT_BACKEND_HANDLE`` and +``VRT_BACKEND_PROBE_HANDLE``. You can look at how they can be used in the +Varnish code base. From dridi.boukelmoune at gmail.com Mon Sep 28 11:31:07 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 200e3dd Removing the TODO on VMOD objects documentation Message-ID: commit 200e3dd6c3cc5175ec792033265fcbf6d36c6ff0 Author: Dridi Boukelmoune Date: Thu Sep 24 08:06:35 2015 +0200 Removing the TODO on VMOD objects documentation Until I get a burst of inspiration, let's not release a blatant TODO in the docs. diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index b3ccefa..697fc6a 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -382,12 +382,7 @@ first with a ``VCL_EVENT_WARM`` event, and then a ``VCL_EVENT_USE`` event. Unless a user decides that a given VCL should always be warm, an inactive VMOD will eventually become cold and should manage resources accordingly. -.. _ref-vmod-objects: - -VMOD Objects -============ - -TODO +.. TODO vmod objects When to lock, and when not to lock ================================== From dridi.boukelmoune at gmail.com Mon Sep 28 11:31:07 2015 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 6f0f632 Remove a missing docs ref from last Message-ID: commit 6f0f632c874743fbc56e2bc4cab4bdc849230564 Author: Dridi Boukelmoune Date: Thu Sep 24 08:49:18 2015 +0200 Remove a missing docs ref from last diff --git a/doc/sphinx/reference/directors.rst b/doc/sphinx/reference/directors.rst index 23c73ee..8ad919b 100644 --- a/doc/sphinx/reference/directors.rst +++ b/doc/sphinx/reference/directors.rst @@ -98,7 +98,9 @@ are *owned* by VCLs. Though a dynamic backend can't outlive its VCL, it can be deleted any time with ``VRT_delete_backend``. The VCL will delete the remaining backends once discarded, you don't need to take care of it. -Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic +.. XXX Consider using an object (see :ref:`ref-vmod-objects`) to manipulate dynamic + +Consider using an object to manipulate dynamic backends. They are tied to the VCL life cycle and make a handy data structure to keep track of backends and objects have a VCL name you can reuse for the director. It is also true for *cluster* directors that may reference native From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 66beb68 Fix a race in persistent startup which seldomly triggered p00005 Message-ID: commit 66beb68288394bdb2d95c9640933121a3a0cfef5 Author: Poul-Henning Kamp Date: Mon Sep 28 06:54:22 2015 +0000 Fix a race in persistent startup which seldomly triggered p00005 diff --git a/bin/varnishd/storage/storage_persistent_silo.c b/bin/varnishd/storage/storage_persistent_silo.c index 6d5c771..45c8a66 100644 --- a/bin/varnishd/storage/storage_persistent_silo.c +++ b/bin/varnishd/storage/storage_persistent_silo.c @@ -166,8 +166,8 @@ smp_load_seg(struct worker *wrk, const struct smp_sc *sc, oc->ban = BAN_RefBan(oc, so->ban, sc->tailban); HSH_Insert(wrk, so->hash, oc); oc->exp = so->exp; - EXP_Inject(wrk, oc, sg->lru); sg->nobj++; + EXP_Inject(wrk, oc, sg->lru); } Pool_Sumstat(wrk); sg->flags |= SMP_SEG_LOADED; From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] 52b16a9 Ignore strange protocols in resolver results Message-ID: commit 52b16a94ec5383ecfeb9e4998812ba0eee9161c0 Author: Poul-Henning Kamp Date: Mon Sep 28 07:19:08 2015 +0000 Ignore strange protocols in resolver results diff --git a/lib/libvcc/vcc_utils.c b/lib/libvcc/vcc_utils.c index 049c177..6b56959 100644 --- a/lib/libvcc/vcc_utils.c +++ b/lib/libvcc/vcc_utils.c @@ -177,8 +177,6 @@ rs_callback(void *priv, const struct suckaddr *vsa) else if (VSA_Compare(vsa, rss->vsa6)) rss->wrong++; rss->retval++; - } else { - WRONG("Wrong protocol"); } return (0); } From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] b854e42 '***' is a better resolver-barfer than /// under circumstances not fully understood. Message-ID: commit b854e4272bfec199130ad05dff223d9decd15528 Author: Poul-Henning Kamp Date: Mon Sep 28 07:32:21 2015 +0000 '***' is a better resolver-barfer than /// under circumstances not fully understood. diff --git a/bin/varnishtest/tests/c00003.vtc b/bin/varnishtest/tests/c00003.vtc index f2efcce..1013b86 100644 --- a/bin/varnishtest/tests/c00003.vtc +++ b/bin/varnishtest/tests/c00003.vtc @@ -5,10 +5,10 @@ varnishtest "Check that we fail to start if any listen address does not work" # All bad listen addresses err_shell "could not be resolved to an IP address" { - ${varnishd} -F -a "${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 + ${varnishd} -F -a "${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } # old style address list err_shell "Unknown protocol" { - ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b /// -n ${tmpdir} 2>&1 + ${varnishd} -F -a "127.0.0.1:0,${bad_ip}:0" -b '***' -n ${tmpdir} 2>&1 } From phk at FreeBSD.org Mon Sep 28 11:31:07 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] f3c5905 Add a small delay to stabilize this testcase. Message-ID: commit f3c5905e73ff3d1fcb62f021e399956ee8871e9f Author: Poul-Henning Kamp Date: Mon Sep 28 09:27:28 2015 +0000 Add a small delay to stabilize this testcase. diff --git a/bin/varnishtest/tests/g00005.vtc b/bin/varnishtest/tests/g00005.vtc index 158a264..bc47a5d 100644 --- a/bin/varnishtest/tests/g00005.vtc +++ b/bin/varnishtest/tests/g00005.vtc @@ -21,6 +21,10 @@ client c1 { gunzip expect resp.bodylen == "10" + # This delay attempts to ensure that the busyobj + # is completed before we attempt the range request + delay .2 + txreq -hdr "Range: bytes=3-5" rxresp expect resp.http.content-encoding == "" From lkarsten at varnish-software.com Mon Sep 28 11:31:07 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] f521053 Merge branch 'master' of git.varnish-cache.org:varnish-cache into 4.1 Message-ID: commit f5210530e56177724019d5e3b0e9bf0bee363b02 Merge: b783655 f3c5905 Author: Lasse Karstensen Date: Mon Sep 28 13:12:09 2015 +0200 Merge branch 'master' of git.varnish-cache.org:varnish-cache into 4.1 From lkarsten at varnish-software.com Mon Sep 28 11:31:07 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 28 Sep 2015 13:31:07 +0200 Subject: [4.1] f0bfbee Prepare 4.1.0-rc1. Message-ID: commit f0bfbeecdc387594dffbab8ce6b9421afe2ec575 Author: Lasse Karstensen Date: Mon Sep 28 13:30:36 2015 +0200 Prepare 4.1.0-rc1. diff --git a/configure.ac b/configure.ac index c2f416d..93b2f8f 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2015 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [4.1.0-beta1], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.1.0-rc1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/doc/changes.rst b/doc/changes.rst index 4761f05..40d612d 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,3 +1,17 @@ +==================================== +Varnish Cache 4.1.0-rc1 (2015-09-28) +==================================== + +Changes since 4.1.0-beta1: + +- Documentation updates. +- Stabilization fixes on testcase p00005.vtc. +- Avoid compiler warning in zlib. +- Bug 1792_: Avoid using fallocate() with -sfile on non-EXT4. + +.. _1792: https://www.varnish-cache.org/trac/ticket/1792 + + ====================================== Varnish Cache 4.1.0-beta1 (2015-09-11) ====================================== From phk at FreeBSD.org Tue Sep 29 09:41:23 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Sep 2015 11:41:23 +0200 Subject: [master] 66049ad Adjust numbers for smartOS-amd64 Message-ID: commit 66049ad7fd4860cb8c6bf12a2d9d577769bff070 Author: Poul-Henning Kamp Date: Tue Sep 29 09:41:01 2015 +0000 Adjust numbers for smartOS-amd64 diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index 770fcd6..2f8e992 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -39,7 +39,7 @@ client c1 { expect resp.http.overflowed == "false" expect resp.http.free_backend > 9000 - expect resp.http.free_session > 250 + expect resp.http.free_session >= 240 expect resp.http.free_thread > 2000 } -run From phk at FreeBSD.org Tue Sep 29 09:44:18 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Sep 2015 11:44:18 +0200 Subject: [master] 8f26d4a Try adjusting limits for el6-i386 Message-ID: commit 8f26d4a30aef4b6b564e04e5d7ad9e77070c0a26 Author: Poul-Henning Kamp Date: Tue Sep 29 09:44:02 2015 +0000 Try adjusting limits for el6-i386 diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc index 9cd4a1f..7572613 100644 --- a/bin/varnishtest/tests/c00071.vtc +++ b/bin/varnishtest/tests/c00071.vtc @@ -14,7 +14,7 @@ server s1 { varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { - debug.workspace_allocate(client, debug.workspace_free(client) - 200); + debug.workspace_allocate(client, debug.workspace_free(client) - 150); if (req.url ~ "/bar") { set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; From lkarsten at varnish-software.com Tue Sep 29 13:22:34 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 29 Sep 2015 15:22:34 +0200 Subject: [master] aad2aaa WS_Printf() can also overflow the workspace. Message-ID: commit aad2aaaeadccc6844c5d1c9c80354193fa7180be Author: Lasse Karstensen Date: Mon Sep 28 17:04:47 2015 +0200 WS_Printf() can also overflow the workspace. diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c index 60fdd44..7070f1a 100644 --- a/bin/varnishd/cache/cache_ws.c +++ b/bin/varnishd/cache/cache_ws.c @@ -187,6 +187,7 @@ WS_Printf(struct ws *ws, const char *fmt, ...) va_end(ap); if (v >= u) { WS_Release(ws, 0); + WS_MarkOverflow(ws); p = NULL; } else { WS_Release(ws, v + 1); From phk at FreeBSD.org Wed Sep 30 11:20:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 30 Sep 2015 13:20:24 +0200 Subject: [4.1] 66049ad Adjust numbers for smartOS-amd64 Message-ID: commit 66049ad7fd4860cb8c6bf12a2d9d577769bff070 Author: Poul-Henning Kamp Date: Tue Sep 29 09:41:01 2015 +0000 Adjust numbers for smartOS-amd64 diff --git a/bin/varnishtest/tests/c00070.vtc b/bin/varnishtest/tests/c00070.vtc index 770fcd6..2f8e992 100644 --- a/bin/varnishtest/tests/c00070.vtc +++ b/bin/varnishtest/tests/c00070.vtc @@ -39,7 +39,7 @@ client c1 { expect resp.http.overflowed == "false" expect resp.http.free_backend > 9000 - expect resp.http.free_session > 250 + expect resp.http.free_session >= 240 expect resp.http.free_thread > 2000 } -run From phk at FreeBSD.org Wed Sep 30 11:20:24 2015 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 30 Sep 2015 13:20:24 +0200 Subject: [4.1] 8f26d4a Try adjusting limits for el6-i386 Message-ID: commit 8f26d4a30aef4b6b564e04e5d7ad9e77070c0a26 Author: Poul-Henning Kamp Date: Tue Sep 29 09:44:02 2015 +0000 Try adjusting limits for el6-i386 diff --git a/bin/varnishtest/tests/c00071.vtc b/bin/varnishtest/tests/c00071.vtc index 9cd4a1f..7572613 100644 --- a/bin/varnishtest/tests/c00071.vtc +++ b/bin/varnishtest/tests/c00071.vtc @@ -14,7 +14,7 @@ server s1 { varnish v1 -vcl+backend { import ${vmod_debug}; sub vcl_deliver { - debug.workspace_allocate(client, debug.workspace_free(client) - 200); + debug.workspace_allocate(client, debug.workspace_free(client) - 150); if (req.url ~ "/bar") { set resp.http.x-foo = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; From lkarsten at varnish-software.com Wed Sep 30 11:20:24 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:20:24 +0200 Subject: [4.1] aad2aaa WS_Printf() can also overflow the workspace. Message-ID: commit aad2aaaeadccc6844c5d1c9c80354193fa7180be Author: Lasse Karstensen Date: Mon Sep 28 17:04:47 2015 +0200 WS_Printf() can also overflow the workspace. diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c index 60fdd44..7070f1a 100644 --- a/bin/varnishd/cache/cache_ws.c +++ b/bin/varnishd/cache/cache_ws.c @@ -187,6 +187,7 @@ WS_Printf(struct ws *ws, const char *fmt, ...) va_end(ap); if (v >= u) { WS_Release(ws, 0); + WS_MarkOverflow(ws); p = NULL; } else { WS_Release(ws, v + 1); From lkarsten at varnish-software.com Wed Sep 30 11:20:24 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:20:24 +0200 Subject: [4.1] 4f25a38 Merge branch 'master' into 4.1 Message-ID: commit 4f25a383beb0c6e8980719106fe5ee778b330c24 Merge: f0bfbee aad2aaa Author: Lasse Karstensen Date: Wed Sep 30 11:29:18 2015 +0200 Merge branch 'master' into 4.1 From lkarsten at varnish-software.com Wed Sep 30 11:20:24 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:20:24 +0200 Subject: [4.1] b961b70 List minute update of what is new. Message-ID: commit b961b70cad1ee597f702a5e0d2cab793c81b8ad9 Author: Lasse Karstensen Date: Wed Sep 30 13:18:29 2015 +0200 List minute update of what is new. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 63c7343..5077c0a 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -1,7 +1,7 @@ .. _whatsnew_changes: -Changes in Varnish 4.1 (unreleased) -=================================== +Changes in Varnish 4.1 +====================== Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. @@ -122,10 +122,24 @@ Protocol support Support for HTTP/0.9 on the client side has been retired. -Surrogate keys -============== -Not yet documented. +More modules available +====================== + +Varnish has an ecosystem for third-party modules (vmods). New since +the last release, these are worth knowing about: + +libvmod-saintmode: Saint mode ("inferred health probes from traffic") was taken +out of Varnish core in 4.0, and is now back as a separate vmod. This is useful +for detecting failing backends before the health probes pick it up. + +libvmod-xkey: Secondary hash keys for cache objects, based on the hashtwo vmod +written by Varnish Software. Allows for arbitrary grouping of objects to be +purged in one go, avoiding use of ban invalidation. Also known as Cache Keys or +Surrogate Key support. + +libvmod-rtstatus: Real time statistics dashboard. + Passing data between ESI requests ================================= From lkarsten at varnish-software.com Wed Sep 30 11:26:05 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:26:05 +0200 Subject: [4.1] 7122d8d Prepare 4.1.0-release. Message-ID: commit 7122d8d238b0142b5d92af48ef2123552a9f625a Author: Lasse Karstensen Date: Wed Sep 30 13:21:27 2015 +0200 Prepare 4.1.0-release. diff --git a/configure.ac b/configure.ac index 93b2f8f..ec02717 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2015 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [4.1.0-rc1], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.1.0], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/doc/changes.rst b/doc/changes.rst index 40d612d..6016ddc 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,6 +1,6 @@ -==================================== -Varnish Cache 4.1.0-rc1 (2015-09-28) -==================================== +================================ +Varnish Cache 4.1.0 (2015-09-30) +================================ Changes since 4.1.0-beta1: From lkarsten at varnish-software.com Wed Sep 30 11:36:03 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:36:03 +0200 Subject: [master] 14b995d List minute update of what is new. Message-ID: commit 14b995defa2ed0c4a45ab443a0e556e3a1c058a4 Author: Lasse Karstensen Date: Wed Sep 30 13:18:29 2015 +0200 List minute update of what is new. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 63c7343..5077c0a 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -1,7 +1,7 @@ .. _whatsnew_changes: -Changes in Varnish 4.1 (unreleased) -=================================== +Changes in Varnish 4.1 +====================== Varnish 4.1 is the continuation of the new streaming architecture seen in Varnish 4.0. @@ -122,10 +122,24 @@ Protocol support Support for HTTP/0.9 on the client side has been retired. -Surrogate keys -============== -Not yet documented. +More modules available +====================== + +Varnish has an ecosystem for third-party modules (vmods). New since +the last release, these are worth knowing about: + +libvmod-saintmode: Saint mode ("inferred health probes from traffic") was taken +out of Varnish core in 4.0, and is now back as a separate vmod. This is useful +for detecting failing backends before the health probes pick it up. + +libvmod-xkey: Secondary hash keys for cache objects, based on the hashtwo vmod +written by Varnish Software. Allows for arbitrary grouping of objects to be +purged in one go, avoiding use of ban invalidation. Also known as Cache Keys or +Surrogate Key support. + +libvmod-rtstatus: Real time statistics dashboard. + Passing data between ESI requests ================================= From lkarsten at varnish-software.com Wed Sep 30 11:36:03 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:36:03 +0200 Subject: [master] e03fb09 Add README.Packaging in distribution. Message-ID: commit e03fb09ffeaa76b67b270f288ec59c13aaaec6b8 Author: Lasse Karstensen Date: Wed Sep 30 13:35:23 2015 +0200 Add README.Packaging in distribution. diff --git a/Makefile.am b/Makefile.am index e49505f..b947ceb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ m4dir = $(datadir)/aclocal m4_DATA = varnish.m4 CLEANFILES = cscope.in.out cscope.out cscope.po.out -EXTRA_DIST = LICENSE autogen.sh varnishapi.pc.in varnish.m4 +EXTRA_DIST = README.Packaging LICENSE autogen.sh varnishapi.pc.in varnish.m4 DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ From lkarsten at varnish-software.com Wed Sep 30 11:37:36 2015 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 30 Sep 2015 13:37:36 +0200 Subject: [4.1] 3041728 Add README.Packaging in distribution. Message-ID: commit 3041728c596139834b789c424ad886306f30334c Author: Lasse Karstensen Date: Wed Sep 30 13:35:23 2015 +0200 Add README.Packaging in distribution. diff --git a/Makefile.am b/Makefile.am index e49505f..b947ceb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -9,7 +9,7 @@ m4dir = $(datadir)/aclocal m4_DATA = varnish.m4 CLEANFILES = cscope.in.out cscope.out cscope.po.out -EXTRA_DIST = LICENSE autogen.sh varnishapi.pc.in varnish.m4 +EXTRA_DIST = README.Packaging LICENSE autogen.sh varnishapi.pc.in varnish.m4 DISTCHECK_CONFIGURE_FLAGS = \ --enable-developer-warnings \ From daghf at varnish-software.com Wed Sep 30 13:28:35 2015 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Wed, 30 Sep 2015 15:28:35 +0200 Subject: [master] dcb6d43 Add beresp.was_304 to changes list. Message-ID: commit dcb6d43611edb9e123043b4f225aaed6ea21d5fa Author: Dag Haavi Finstad Date: Wed Sep 30 15:28:33 2015 +0200 Add beresp.was_304 to changes list. diff --git a/doc/sphinx/whats-new/changes.rst b/doc/sphinx/whats-new/changes.rst index 5077c0a..d9b0825 100644 --- a/doc/sphinx/whats-new/changes.rst +++ b/doc/sphinx/whats-new/changes.rst @@ -157,4 +157,8 @@ Other noteworthy small changes * Varnish will now use the ``stale-while-revalidate`` defined in RFC5861 to set object grace time. * -smalloc storage is now recommended over -sfile on Linux systems. +* New VCL variable ``beresp.was_304`` has been introduced in + ``vcl_backend_response``. Will be set to ``true`` if the response + from the backend was a positive result of a conditional fetch (``304 + Not Modified``).