From phk at FreeBSD.org Thu Jan 2 09:51:32 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 10:51:32 +0100 Subject: [master] 0bff803 Eliminate an unused argument. Message-ID: commit 0bff8039e3c5f56b6e15d603d266913a11211239 Author: Poul-Henning Kamp Date: Thu Jan 2 09:51:08 2014 +0000 Eliminate an unused argument. (And Happy New Year!) diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 5998e38..2fe14f3 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -810,7 +810,7 @@ void VBE_UseHealth(const struct director *vdi); void VBE_DiscardHealth(const struct director *vdi); -struct vbc *VDI_GetFd(const struct director *, struct busyobj *); +struct vbc *VDI_GetFd(struct busyobj *); int VDI_Healthy(const struct director *); void VDI_CloseFd(struct vbc **vbp); void VDI_RecycleFd(struct vbc **vbp); diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c index b3f17cf..5ac4e76 100644 --- a/bin/varnishd/cache/cache_dir.c +++ b/bin/varnishd/cache/cache_dir.c @@ -101,13 +101,13 @@ VDI_RecycleFd(struct vbc **vbp) /* Get a connection --------------------------------------------------*/ struct vbc * -VDI_GetFd(const struct director *d, struct busyobj *bo) +VDI_GetFd(struct busyobj *bo) { struct vbc *vc; + struct director *d; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); - if (d == NULL) - d = bo->director; + d = bo->director; CHECK_OBJ_NOTNULL(d, DIRECTOR_MAGIC); vc = d->getfd(d, bo); if (vc != NULL) diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c index 1bf8bd1..3adcdc2 100644 --- a/bin/varnishd/cache/cache_http1_fetch.c +++ b/bin/varnishd/cache/cache_http1_fetch.c @@ -293,7 +293,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req) hp = bo->bereq; - bo->vbc = VDI_GetFd(NULL, bo); + bo->vbc = VDI_GetFd(bo); if (bo->vbc == NULL) { VSLb(bo->vsl, SLT_FetchError, "no backend connection"); return (-1); diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c index a049196..b4403bb 100644 --- a/bin/varnishd/cache/cache_pipe.c +++ b/bin/varnishd/cache/cache_pipe.c @@ -73,7 +73,7 @@ PipeRequest(struct req *req, struct busyobj *bo) CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); - vc = VDI_GetFd(NULL, bo); + vc = VDI_GetFd(bo); if (vc == NULL) return; bo->vbc = vc; /* For panic dumping */ From phk at FreeBSD.org Thu Jan 2 10:08:35 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 11:08:35 +0100 Subject: [master] 9ba514c Eliminate debugging work-around, to quench a warning. Message-ID: commit 9ba514cc736573a2ab659f12238d088a002b967a Author: Poul-Henning Kamp Date: Thu Jan 2 10:07:46 2014 +0000 Eliminate debugging work-around, to quench a warning. diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index 9e2d0c8..3fc2b43 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -345,7 +345,7 @@ i_mode(void) vsb = VSB_new_auto(); - q = p = read_file("Makefile_"); + q = p = read_file("Makefile"); if (p == NULL) { fprintf(stderr, "No Makefile to search for -i flag.\n"); VSB_printf(vsb, "%s/../..", cwd); From phk at FreeBSD.org Thu Jan 2 10:08:35 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 11:08:35 +0100 Subject: [master] 7f9a989 Fix NULL deref related to a backend we don't know any more. Message-ID: commit 7f9a989f2178295d52a92e0be4f2ca2c15cd919b Author: Poul-Henning Kamp Date: Thu Jan 2 10:08:06 2014 +0000 Fix NULL deref related to a backend we don't know any more. Fixes #1398 diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index a1223fd..617ef4c 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -301,6 +301,8 @@ VRT_IP_string(const struct vrt_ctx *ctx, VCL_IP ip) unsigned len; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + if (ip == NULL) + return (NULL); len = WS_Reserve(ctx->ws, 0); p = ctx->ws->f; VTCP_name(ip, p, len, NULL, 0); diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index aec97dd..cb0d42e 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -251,8 +251,14 @@ VRT_r_beresp_backend_name(const struct vrt_ctx *ctx) CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); - CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC); - return(ctx->bo->vbc->backend->vcl_name); + if (ctx->bo->vbc != NULL) { + CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC); + return (ctx->bo->vbc->backend->vcl_name); + } + if (ctx->bo->director != NULL) { + return (ctx->bo->director->vcl_name); + } + return (NULL); } VCL_IP @@ -261,8 +267,11 @@ VRT_r_beresp_backend_ip(const struct vrt_ctx *ctx) CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); - CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC); - return(ctx->bo->vbc->addr); + if (ctx->bo->vbc != NULL) { + CHECK_OBJ_NOTNULL(ctx->bo->vbc, VBC_MAGIC); + return(ctx->bo->vbc->addr); + } else + return (NULL); } const char * diff --git a/bin/varnishtest/tests/r01398.vtc b/bin/varnishtest/tests/r01398.vtc new file mode 100644 index 0000000..6c5cb7d --- /dev/null +++ b/bin/varnishtest/tests/r01398.vtc @@ -0,0 +1,20 @@ +varnishtest "ticket 1398" + +varnish v1 -vcl { + backend foo { + .host = "${bad_ip}"; .port = "9080"; + } + sub vcl_backend_response { + set beresp.http.X-BE-Name = beresp.backend.name; + set beresp.http.X-BE-IP = beresp.backend.ip; + } +} -start + +client c1 { + txreq + rxresp + expect resp.status == 503 + expect resp.http.X-BE-Name == foo + expect resp.http.X-BE-IP == "" +} -run + From phk at FreeBSD.org Thu Jan 2 13:27:59 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 14:27:59 +0100 Subject: [master] 4deb2b8 Make sure that we also report the obj.status in vsl Message-ID: commit 4deb2b8e65c5f02e7461cb1613b717d38778a675 Author: Poul-Henning Kamp Date: Thu Jan 2 13:27:40 2014 +0000 Make sure that we also report the obj.status in vsl diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index b6f3916..d7053cc 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -609,6 +609,7 @@ http_FilterResp(const struct http *fm, struct http *to, unsigned how) CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); http_SetH(to, HTTP_HDR_PROTO, "HTTP/1.1"); to->status = fm->status; + http_linkh(to, fm, HTTP_HDR_STATUS); http_linkh(to, fm, HTTP_HDR_RESPONSE); http_filterfields(to, fm, how); } From phk at FreeBSD.org Thu Jan 2 16:03:42 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 17:03:42 +0100 Subject: [master] 1cb0471 Make sure we have copied all we need from the req.* http structure for the bg-fetch, before we release the request to carry on. Message-ID: commit 1cb047172faed3c38bc8d0cd0fad8af249a3302a Author: Poul-Henning Kamp Date: Thu Jan 2 16:02:15 2014 +0000 Make sure we have copied all we need from the req.* http structure for the bg-fetch, before we release the request to carry on. Fixes #1399 diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index c2bdb32..9e82921 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -50,6 +50,7 @@ vbf_release_req(struct busyobj *bo) assert(bo->state == BOS_INVALID); AN(bo->req); bo->req = NULL; + http_CopyHome(bo->bereq); VBO_setstate(bo, BOS_REQ_DONE); } diff --git a/bin/varnishtest/tests/r01399.vtc b/bin/varnishtest/tests/r01399.vtc new file mode 100644 index 0000000..d2ea1d0 --- /dev/null +++ b/bin/varnishtest/tests/r01399.vtc @@ -0,0 +1,49 @@ +varnishtest "1399 race issue with bg-fetches" + +server s1 { + rxreq + txresp -bodylen 1 + + sema r1 sync 2 + + # Delay here, to stall the bgfetch for a while, to give the req time to finish + # delivery and cleanup up struct req + delay 2 + + # Shut the connection to force the bgfetch to retry + close + accept + + # And see if it has all its marbles still... + rxreq + expect req.url == "/" + txresp -bodylen 2 + +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.ttl = 2s; + set beresp.grace = 1800s; + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.content-length == 1 + +} -run + +# 3 is longer than the ttl, in order to kick off the bgfetch +delay 3 + +client c1 { + txreq + rxresp + expect resp.http.content-length == 1 + sema r1 sync 2 +} -run + +# Wait for the server to not explode +server s1 -wait From phk at FreeBSD.org Thu Jan 2 16:03:42 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 02 Jan 2014 17:03:42 +0100 Subject: [master] 7ac280c Clean up the setting of synthetic response headers a bit further, the last fixe was clearly not enough. Message-ID: commit 7ac280c6f5067bae31c22a18342f2be600b51878 Author: Poul-Henning Kamp Date: Thu Jan 2 15:56:05 2014 +0000 Clean up the setting of synthetic response headers a bit further, the last fixe was clearly not enough. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index e7ef1bb..c2bdb32 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -145,10 +145,8 @@ make_it_503(struct busyobj *bo) { HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp); - bo->err_code = 503; http_SetH(bo->beresp, HTTP_HDR_PROTO, "HTTP/1.1"); - http_SetResp(bo->beresp, - "HTTP/1.1", 503, "Backend fetch failed"); + http_SetResp(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed"); http_SetHeader(bo->beresp, "Content-Length: 0"); http_SetHeader(bo->beresp, "Connection: close"); } diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index d7053cc..97abe39 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -515,7 +515,7 @@ http_SetResp(struct http *to, const char *proto, uint16_t status, CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); http_SetH(to, HTTP_HDR_PROTO, proto); assert(status >= 100 && status <= 999); - to->status = status; + http_PutStatus(to, status); http_SetH(to, HTTP_HDR_RESPONSE, response); } @@ -714,9 +714,12 @@ http_PutProtocol(const struct http *to, const char *protocol) void http_PutStatus(struct http *to, uint16_t status) { + char buf[4]; assert(status >= 100 && status <= 999); to->status = status; + bprintf(buf, "%03d", status % 1000); + http_SetH(to, HTTP_HDR_STATUS, WS_Copy(to->ws, buf, sizeof buf)); } void From phk at FreeBSD.org Fri Jan 3 10:16:38 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 03 Jan 2014 11:16:38 +0100 Subject: [master] b0a84bd Add this testcase just to be sure the problem don't reappear. Message-ID: commit b0a84bdf7f9e88c01baa5ecb1953bc585639d68d Author: Poul-Henning Kamp Date: Fri Jan 3 10:16:18 2014 +0000 Add this testcase just to be sure the problem don't reappear. diff --git a/bin/varnishtest/r01086.vtc b/bin/varnishtest/r01086.vtc new file mode 100644 index 0000000..ba4ace5 --- /dev/null +++ b/bin/varnishtest/r01086.vtc @@ -0,0 +1,76 @@ +varnishtest "#1086 junk after gzip from backend and streaming enabled" + +server s1 { + # This one will be streamed + rxreq + txresp -nolen \ + -hdr "Content-Encoding: gzip" \ + -hdr "Transfer-Encoding: Chunked" \ + -hdr "Set-Cookie: FOO" + send "14\r\n" + # An empty gzip file: + sendhex "1f8b" + sendhex "08" + sendhex "00" + sendhex "00000000" + sendhex "00" + sendhex "03" + sendhex "0300" + sendhex "00000000" + sendhex "00000000" + send "\r\n" + + chunked "FOOBAR" + + chunkedlen 0 + + accept + + # This one will not be streamed + rxreq + txresp -nolen \ + -hdr "Content-Encoding: gzip" \ + -hdr "Transfer-Encoding: Chunked" \ + -hdr "Set-Cookie: BAR" + send "14\r\n" + # An empty gzip file: + sendhex "1f8b" + sendhex "08" + sendhex "00" + sendhex "00000000" + sendhex "00" + sendhex "03" + sendhex "0300" + sendhex "00000000" + sendhex "00000000" + send "\r\n" + + chunked "FOOBAR" + + chunkedlen 0 + +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (beresp.http.set-cookie == "BAR") { + set beresp.do_stream = false; + } + } +} -start + +client c1 { + txreq -hdr "Cookie: FOO" + rxresp + expect resp.status == 200 + expect resp.bodylen == 0 +} -run + +delay .1 + +client c1 { + txreq -hdr "Cookie: BAR" + rxresp + expect resp.status == 503 +} -run + From phk at FreeBSD.org Fri Jan 3 10:19:55 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 03 Jan 2014 11:19:55 +0100 Subject: [master] f950e87 This problem was already fixed. Message-ID: commit f950e875c2f8d89c0903e3cff29fb11d5fc2858a Author: Poul-Henning Kamp Date: Fri Jan 3 10:19:28 2014 +0000 This problem was already fixed. Fixes #1395 diff --git a/bin/varnishtest/tests/r01395.vtc b/bin/varnishtest/tests/r01395.vtc new file mode 100644 index 0000000..77506a4 --- /dev/null +++ b/bin/varnishtest/tests/r01395.vtc @@ -0,0 +1,17 @@ +varnishtest "Test vcl_error is called even if vcl_backend_fetch failed" + +varnish v1 -vcl { + backend default { + .host = "${bad_ip}"; .port = "9090"; + } + + sub vcl_error { + set obj.status = 200; + } +} -start + +client c1 { + txreq -url "/" + rxresp + expect resp.status == 503 +} -run From phk at FreeBSD.org Fri Jan 3 15:02:15 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 03 Jan 2014 16:02:15 +0100 Subject: [master] 3deb1c3 Correct fix for #1395, I wasn't paying attention to what the test-case actually wanted to do. Message-ID: commit 3deb1c39ad924a9d44f546ec188a5735f9f9284c Author: Poul-Henning Kamp Date: Fri Jan 3 15:01:15 2014 +0000 Correct fix for #1395, I wasn't paying attention to what the test-case actually wanted to do. Hat-tip: scn diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 9e82921..e142103 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -190,6 +190,7 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) if (i) { AZ(bo->vbc); + (void)VFP_Error(bo, "Failed to fetch object headers"); make_it_503(bo); } else { AN(bo->vbc); @@ -452,8 +453,10 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) if (bo->do_stream) HSH_Unbusy(&wrk->stats, obj->objcore); - assert(bo->state == BOS_REQ_DONE); - VBO_setstate(bo, BOS_FETCHING); + if (bo->state == BOS_REQ_DONE) + VBO_setstate(bo, BOS_FETCHING); + else if (bo->state != BOS_FAILED) + WRONG("Wrong bo->state"); switch (bo->htc.body_status) { case BS_NONE: diff --git a/bin/varnishtest/tests/b00015.vtc b/bin/varnishtest/tests/b00015.vtc index 029f782..9905e96 100644 --- a/bin/varnishtest/tests/b00015.vtc +++ b/bin/varnishtest/tests/b00015.vtc @@ -21,7 +21,7 @@ client c1 { txreq -url "/" rxresp expect resp.status == 503 - expect resp.http.X-varnish == "1004" + expect resp.http.X-varnish == "1005" } -run delay .1 @@ -46,7 +46,7 @@ client c1 { txreq -url "/" rxresp expect resp.status == 302 - expect resp.http.X-varnish == "1007" + expect resp.http.X-varnish == "1009" } -run delay .1 @@ -55,7 +55,7 @@ client c1 { txreq -url "/" rxresp expect resp.status == 302 - expect resp.http.X-varnish == "1010 1008" + expect resp.http.X-varnish == "1012 1010" } -run delay .1 @@ -79,7 +79,7 @@ client c1 { txreq -url "/2" rxresp expect resp.status == 502 - expect resp.http.X-varnish == "1012" + expect resp.http.X-varnish == "1014" } -run delay .1 @@ -88,7 +88,7 @@ client c1 { txreq -url "/2" rxresp expect resp.status == 502 - expect resp.http.X-varnish == "1015 1013" + expect resp.http.X-varnish == "1017 1015" } -run delay .1 diff --git a/bin/varnishtest/tests/r01337.vtc b/bin/varnishtest/tests/r01337.vtc index 1af5573..ccb1b80 100644 --- a/bin/varnishtest/tests/r01337.vtc +++ b/bin/varnishtest/tests/r01337.vtc @@ -52,27 +52,43 @@ client c1 { txreq -url /small rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /low rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /high rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /X rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /Y rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /Z rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /x rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /y rxresp expect resp.status == 503 +} -run +client c1 { txreq -url /z rxresp expect resp.status == 503 diff --git a/bin/varnishtest/tests/r01395.vtc b/bin/varnishtest/tests/r01395.vtc index 77506a4..c3243f6 100644 --- a/bin/varnishtest/tests/r01395.vtc +++ b/bin/varnishtest/tests/r01395.vtc @@ -6,12 +6,12 @@ varnish v1 -vcl { } sub vcl_error { - set obj.status = 200; + set obj.status = 299; } } -start client c1 { txreq -url "/" rxresp - expect resp.status == 503 + expect resp.status == 299 } -run diff --git a/bin/varnishtest/tests/r01398.vtc b/bin/varnishtest/tests/r01398.vtc index 6c5cb7d..fe89e0d 100644 --- a/bin/varnishtest/tests/r01398.vtc +++ b/bin/varnishtest/tests/r01398.vtc @@ -14,7 +14,7 @@ client c1 { txreq rxresp expect resp.status == 503 - expect resp.http.X-BE-Name == foo - expect resp.http.X-BE-IP == "" + expect resp.http.X-BE-Name == "" + expect resp.http.X-BE-IP == "" } -run From apj at mutt.dk Sat Jan 4 14:40:26 2014 From: apj at mutt.dk (Andreas Plesner) Date: Sat, 04 Jan 2014 15:40:26 +0100 Subject: [master] 4b74d28 Spelling nit, courtesy of fgs Message-ID: commit 4b74d285723c54de35520d593938bc983d84f3bc Author: Andreas Plesner Date: Sat Jan 4 15:39:35 2014 +0100 Spelling nit, courtesy of fgs diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 9e8a050..3b643fc 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -49,7 +49,7 @@ static unsigned vbcps = sizeof(struct vbc); /*-------------------------------------------------------------------- * The "simple" director really isn't, since thats where all the actual - * connections happen. Nontheless, pretend it is simple by sequestering + * connections happen. Nonetheless, pretend it is simple by sequestering * the directoricity of it under this line. */ From phk at FreeBSD.org Mon Jan 6 08:53:14 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 09:53:14 +0100 Subject: [master] 3d50d45 Only assert on complete IMS object if we have a good status. Message-ID: commit 3d50d453ad6cd2b9d4da72d970b3051862757123 Author: Poul-Henning Kamp Date: Mon Jan 6 08:52:54 2014 +0000 Only assert on complete IMS object if we have a good status. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index e142103..bb6c7b2 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -633,10 +633,11 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) } while (ois == OIS_DATA || ois == OIS_STREAM); ObjIterEnd(&oi); bo->stats = NULL; - assert(al == bo->ims_obj->len); - assert(obj->len == al); - if (bo->state != BOS_FAILED) + if (bo->state != BOS_FAILED) { + assert(al == bo->ims_obj->len); + assert(obj->len == al); VBO_setstate(bo, BOS_FINISHED); + } HSH_Complete(obj->objcore); return (F_STP_DONE); } From phk at FreeBSD.org Mon Jan 6 17:27:52 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 18:27:52 +0100 Subject: [master] a5bf869 Don't send Content-Length on 304 responses. Message-ID: commit a5bf869f4fd5de53eb5e8c3084d5931154cc58d3 Author: Poul-Henning Kamp Date: Mon Jan 6 17:26:39 2014 +0000 Don't send Content-Length on 304 responses. It seems that browser writers also have trouble figuring out that twisted logic in HTTP/1.1. Fixes: #1404 Spotted by: Scoof diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c index 65c25d5..974202d 100644 --- a/bin/varnishd/cache/cache_http1_deliver.c +++ b/bin/varnishd/cache/cache_http1_deliver.c @@ -207,6 +207,10 @@ V1D_Deliver(struct req *req) /* In ESI mode, we can't know the aggregate length */ req->res_mode &= ~RES_LEN; req->res_mode |= RES_ESI; + } else if (req->resp->status == 304) { + req->res_mode &= ~RES_LEN; + http_Unset(req->resp, H_Content_Length); + req->wantbody = 0; } else if (req->obj->objcore->busyobj == NULL) { /* XXX: Not happy with this convoluted test */ req->res_mode |= RES_LEN; @@ -284,9 +288,6 @@ V1D_Deliver(struct req *req) if (!(req->res_mode & RES_ESI_CHILD)) req->acct_req.hdrbytes += HTTP1_Write(req->wrk, req->resp, 1); - if (!req->wantbody) - req->res_mode &= ~RES_CHUNKED; - if (req->res_mode & RES_CHUNKED) WRW_Chunked(req->wrk); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index d80c16f..ca15070 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -146,12 +146,10 @@ cnt_deliver(struct worker *wrk, struct req *req) assert(wrk->handling == VCL_RET_DELIVER); if (!(req->obj->objcore->flags & OC_F_PASS) + && req->esi_level == 0 && req->obj->response == 200 - && req->http->conds && RFC2616_Do_Cond(req)) { - req->wantbody = 0; + && req->http->conds && RFC2616_Do_Cond(req)) http_SetResp(req->resp, "HTTP/1.1", 304, "Not Modified"); - // http_Unset(req->resp, H_Content_Length); - } V1D_Deliver(req); diff --git a/bin/varnishtest/tests/r01404.vtc b/bin/varnishtest/tests/r01404.vtc new file mode 100644 index 0000000..1411a00 --- /dev/null +++ b/bin/varnishtest/tests/r01404.vtc @@ -0,0 +1,19 @@ +varnishtest "Test that 304 does not send Content-Length" + +server s1 { + rxreq + txresp -hdr "ETag: foo" -body "11111\n" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.do_stream = true; + } +} -start + +client c1 { + txreq -hdr "If-None-Match: foo" + rxresp -no_obj + expect resp.status == 304 + expect resp.http.Content-Length == +} -run From phk at FreeBSD.org Mon Jan 6 20:03:09 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 21:03:09 +0100 Subject: [master] 3289723 Handle out of storage on conditional bg fetches Message-ID: commit 3289723cc30b6a86ab77843d1055b606b1c1e83c Author: Poul-Henning Kamp Date: Mon Jan 6 20:02:52 2014 +0000 Handle out of storage on conditional bg fetches diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index bb6c7b2..a33f152 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -615,10 +615,10 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) do { ois = ObjIter(oi, &sp, &sl); while (sl > 0) { - if (st == NULL) { + if (st == NULL) st = VFP_GetStorage(bo, bo->ims_obj->len - al); - XXXAN(st); - } + if (st == NULL) + break; tl = sl; if (tl > st->space - st->len) tl = st->space - st->len; From phk at FreeBSD.org Mon Jan 6 20:12:47 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 21:12:47 +0100 Subject: [master] 44f4a82 Add a couple of clarifying asserts Message-ID: commit 44f4a821fcdcd1d4954b17a6b2390c756ad5920f Author: Poul-Henning Kamp Date: Mon Jan 6 20:12:33 2014 +0000 Add a couple of clarifying asserts diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index ca15070..07436cf 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -417,6 +417,8 @@ cnt_lookup(struct worker *wrk, struct req *req) switch (wrk->handling) { case VCL_RET_DELIVER: if (boc != NULL) { + AZ(oc->flags & (OC_F_FAILED|OC_F_DYING|OC_F_PASS)); + AZ(oc->busyobj); VBF_Fetch(wrk, req, boc, o, VBF_BACKGROUND); } else { (void)HTTP1_DiscardReqBody(req);// XXX: handle err From phk at FreeBSD.org Mon Jan 6 20:18:44 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 21:18:44 +0100 Subject: [master] 761f240 Another protective assert Message-ID: commit 761f240e849c07a9b6bcdaef76ad01f820e6348f Author: Poul-Henning Kamp Date: Mon Jan 6 20:18:29 2014 +0000 Another protective assert (and a typo) diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index a33f152..f251074 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -749,6 +749,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, if (oldobj != NULL) { if (http_GetHdr(oldobj->http, H_Last_Modified, NULL) || http_GetHdr(oldobj->http, H_ETag, NULL)) { + assert(oldobj->objcore->refcnt > 0); HSH_Ref(oldobj->objcore); bo->ims_obj = oldobj; } diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 07436cf..5bc4a71 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -434,7 +434,7 @@ cnt_lookup(struct worker *wrk, struct req *req) else { /* * We don't have a busy object, so treat this - * lige a pass + * like a pass */ VSLb(req->vsl, SLT_VCL_Error, "vcl_hit{} returns fetch without busy object." From phk at FreeBSD.org Mon Jan 6 20:46:03 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 06 Jan 2014 21:46:03 +0100 Subject: [master] c0096f7 Lay #1397 to rest: It was something as trivial as a typo from my side, but staring at the wrong assert for hours on end did not reveal that. Message-ID: commit c0096f759b8af324d1253993fd76960ecbd2e399 Author: Poul-Henning Kamp Date: Mon Jan 6 20:45:10 2014 +0000 Lay #1397 to rest: It was something as trivial as a typo from my side, but staring at the wrong assert for hours on end did not reveal that. Many thanks to: scoof Fixes #1397 diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index f251074..3a00269 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -626,11 +626,12 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) al += tl; sp = (char *)sp + tl; sl -= tl; - VBO_extend(bo, al); + VBO_extend(bo, tl); if (st->len == st->space) st = NULL; } - } while (ois == OIS_DATA || ois == OIS_STREAM); + } while (bo->state < BOS_FAILED && + (ois == OIS_DATA || ois == OIS_STREAM)); ObjIterEnd(&oi); bo->stats = NULL; if (bo->state != BOS_FAILED) { diff --git a/bin/varnishtest/tests/b00025.vtc b/bin/varnishtest/tests/b00025.vtc index 3ba0e64..05536ab 100644 --- a/bin/varnishtest/tests/b00025.vtc +++ b/bin/varnishtest/tests/b00025.vtc @@ -16,6 +16,9 @@ varnish v1 -vcl { } } -start +# Fragmenting storage tests for #1397 +varnish v1 -cliok "debug.fragfetch 4" + client c1 { txreq rxresp diff --git a/bin/varnishtest/tests/r01399.vtc b/bin/varnishtest/tests/r01399.vtc index d2ea1d0..48a0bc0 100644 --- a/bin/varnishtest/tests/r01399.vtc +++ b/bin/varnishtest/tests/r01399.vtc @@ -29,7 +29,7 @@ varnish v1 -vcl+backend { } -start client c1 { - txreq + txreq rxresp expect resp.http.content-length == 1 @@ -39,7 +39,7 @@ client c1 { delay 3 client c1 { - txreq + txreq rxresp expect resp.http.content-length == 1 sema r1 sync 2 From phk at FreeBSD.org Tue Jan 7 10:35:13 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 11:35:13 +0100 Subject: [master] d9fa76b Move this test into the pen. Message-ID: commit d9fa76bfe764e1014590544093382f036ad2a43d Author: Poul-Henning Kamp Date: Tue Jan 7 10:34:43 2014 +0000 Move this test into the pen. Spotted by: fgs diff --git a/bin/varnishtest/r01086.vtc b/bin/varnishtest/r01086.vtc deleted file mode 100644 index ba4ace5..0000000 --- a/bin/varnishtest/r01086.vtc +++ /dev/null @@ -1,76 +0,0 @@ -varnishtest "#1086 junk after gzip from backend and streaming enabled" - -server s1 { - # This one will be streamed - rxreq - txresp -nolen \ - -hdr "Content-Encoding: gzip" \ - -hdr "Transfer-Encoding: Chunked" \ - -hdr "Set-Cookie: FOO" - send "14\r\n" - # An empty gzip file: - sendhex "1f8b" - sendhex "08" - sendhex "00" - sendhex "00000000" - sendhex "00" - sendhex "03" - sendhex "0300" - sendhex "00000000" - sendhex "00000000" - send "\r\n" - - chunked "FOOBAR" - - chunkedlen 0 - - accept - - # This one will not be streamed - rxreq - txresp -nolen \ - -hdr "Content-Encoding: gzip" \ - -hdr "Transfer-Encoding: Chunked" \ - -hdr "Set-Cookie: BAR" - send "14\r\n" - # An empty gzip file: - sendhex "1f8b" - sendhex "08" - sendhex "00" - sendhex "00000000" - sendhex "00" - sendhex "03" - sendhex "0300" - sendhex "00000000" - sendhex "00000000" - send "\r\n" - - chunked "FOOBAR" - - chunkedlen 0 - -} -start - -varnish v1 -vcl+backend { - sub vcl_backend_response { - if (beresp.http.set-cookie == "BAR") { - set beresp.do_stream = false; - } - } -} -start - -client c1 { - txreq -hdr "Cookie: FOO" - rxresp - expect resp.status == 200 - expect resp.bodylen == 0 -} -run - -delay .1 - -client c1 { - txreq -hdr "Cookie: BAR" - rxresp - expect resp.status == 503 -} -run - diff --git a/bin/varnishtest/tests/r01086.vtc b/bin/varnishtest/tests/r01086.vtc new file mode 100644 index 0000000..ba4ace5 --- /dev/null +++ b/bin/varnishtest/tests/r01086.vtc @@ -0,0 +1,76 @@ +varnishtest "#1086 junk after gzip from backend and streaming enabled" + +server s1 { + # This one will be streamed + rxreq + txresp -nolen \ + -hdr "Content-Encoding: gzip" \ + -hdr "Transfer-Encoding: Chunked" \ + -hdr "Set-Cookie: FOO" + send "14\r\n" + # An empty gzip file: + sendhex "1f8b" + sendhex "08" + sendhex "00" + sendhex "00000000" + sendhex "00" + sendhex "03" + sendhex "0300" + sendhex "00000000" + sendhex "00000000" + send "\r\n" + + chunked "FOOBAR" + + chunkedlen 0 + + accept + + # This one will not be streamed + rxreq + txresp -nolen \ + -hdr "Content-Encoding: gzip" \ + -hdr "Transfer-Encoding: Chunked" \ + -hdr "Set-Cookie: BAR" + send "14\r\n" + # An empty gzip file: + sendhex "1f8b" + sendhex "08" + sendhex "00" + sendhex "00000000" + sendhex "00" + sendhex "03" + sendhex "0300" + sendhex "00000000" + sendhex "00000000" + send "\r\n" + + chunked "FOOBAR" + + chunkedlen 0 + +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (beresp.http.set-cookie == "BAR") { + set beresp.do_stream = false; + } + } +} -start + +client c1 { + txreq -hdr "Cookie: FOO" + rxresp + expect resp.status == 200 + expect resp.bodylen == 0 +} -run + +delay .1 + +client c1 { + txreq -hdr "Cookie: BAR" + rxresp + expect resp.status == 503 +} -run + From phk at FreeBSD.org Tue Jan 7 11:23:49 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 12:23:49 +0100 Subject: [master] 948e3fd Start a new transaction (xid) on restart Message-ID: commit 948e3fd025d38d0e9e00aee04239a43640c80c86 Author: Poul-Henning Kamp Date: Tue Jan 7 11:13:28 2014 +0000 Start a new transaction (xid) on restart diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 5bc4a71..048bcc3 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -627,17 +627,28 @@ DOT err_restart [label="ERROR",shape=plaintext] */ static enum req_fsm_nxt -cnt_restart(const struct worker *wrk, struct req *req) +cnt_restart(struct worker *wrk, struct req *req) { + unsigned wid, owid; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); req->director = NULL; if (++req->restarts >= cache_param->max_restarts) { + VSLb(req->vsl, SLT_VCL_Error, "Too many restarts"); req->err_code = 503; req->req_step = R_STP_ERROR; } else { + wid = VXID_Get(&wrk->vxid_pool); + // XXX: ReqEnd + ReqAcct ? + VSLb(req->vsl, SLT_Link, "req %u", wid); + VSLb(req->vsl, SLT_End, ""); + VSL_Flush(req->vsl, 0); + owid = req->vsl->wid & VSL_IDENTMASK; + req->vsl->wid = wid | VSL_CLIENTMARKER; + VSLb(req->vsl, SLT_Begin, "req %u", owid); + req->err_code = 0; req->req_step = R_STP_RECV; } From phk at FreeBSD.org Tue Jan 7 13:55:22 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 14:55:22 +0100 Subject: [master] 1199d24 Give SLT_Begin and SLT_Link a third field "why", and normalise the first field to the type of entity. Message-ID: commit 1199d2419382943603ed0b8c2e4eaa204f785468 Author: Poul-Henning Kamp Date: Tue Jan 7 13:53:45 2014 +0000 Give SLT_Begin and SLT_Link a third field "why", and normalise the first field to the type of entity. Martin will commit corresponding and necessary changes to the API in a matter of milliseconds or possibly hours or days, so minor weirdness from varnishlog/ncsa can be expected for a brief amount of time. Testcase l00000 & l00001 are also broken until the API catches up. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 2fe14f3..58c1b3c 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -844,7 +844,7 @@ double BAN_Time(const struct ban *ban); /* cache_busyobj.c */ void VBO_Init(void); -struct busyobj *VBO_GetBusyObj(struct worker *, struct req *); +struct busyobj *VBO_GetBusyObj(struct worker *, const struct req *); void VBO_DerefBusyObj(struct worker *wrk, struct busyobj **busyobj); void VBO_Free(struct busyobj **vbo); void VBO_extend(struct busyobj *, ssize_t); diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index 5519168..2466404 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -89,7 +89,7 @@ VBO_Free(struct busyobj **bop) } struct busyobj * -VBO_GetBusyObj(struct worker *wrk, struct req *req) +VBO_GetBusyObj(struct worker *wrk, const struct req *req) { struct busyobj *bo = NULL; uint16_t nhttp; @@ -136,8 +136,6 @@ VBO_GetBusyObj(struct worker *wrk, struct req *req) sz = cache_param->vsl_buffer; VSL_Setup(bo->vsl, p, sz); bo->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_BACKENDMARKER; - VSLb(bo->vsl, SLT_Begin, "bereq %u", req->vsl->wid & VSL_IDENTMASK); - VSLb(req->vsl, SLT_Link, "bereq %u", bo->vsl->wid & VSL_IDENTMASK); p += sz; p = (void*)PRNDUP(p); assert(p < bo->end); diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 76fc1c5..a2904c8 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -61,8 +61,8 @@ ved_include(struct req *preq, const char *src, const char *host) req = SES_GetReq(wrk, preq->sp); req->req_body_status = REQ_BODY_NONE; - VSLb(req->vsl, SLT_Begin, "esireq %u", preq->vsl->wid & VSL_IDENTMASK); - VSLb(preq->vsl, SLT_Link, "esireq %u", req->vsl->wid & VSL_IDENTMASK); + VSLb(req->vsl, SLT_Begin, "req %u esi", preq->vsl->wid & VSL_IDENTMASK); + VSLb(preq->vsl, SLT_Link, "req %u esi", req->vsl->wid & VSL_IDENTMASK); req->esi_level = preq->esi_level + 1; HTTP_Copy(req->http0, preq->http0); diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 3a00269..f261f70 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -724,6 +724,7 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, struct object *oldobj, enum vbf_fetch_mode_e mode) { struct busyobj *bo; + const char *how; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC); @@ -732,6 +733,19 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, bo = VBO_GetBusyObj(wrk, req); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + + switch(mode) { + case VBF_PASS: how = "pass"; break; + case VBF_NORMAL: how = "fetch"; break; + case VBF_BACKGROUND: how = "bgfetch"; break; + default: WRONG("Wrong fetch mode"); + } + + VSLb(bo->vsl, SLT_Begin, "bereq %u %s ", + req->vsl->wid & VSL_IDENTMASK, how); + VSLb(req->vsl, SLT_Link, "bereq %u %s ", + bo->vsl->wid & VSL_IDENTMASK, how); + bo->refcount = 2; oc->busyobj = bo; diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c index c1564be..7818260 100644 --- a/bin/varnishd/cache/cache_http1_fsm.c +++ b/bin/varnishd/cache/cache_http1_fsm.c @@ -286,9 +286,9 @@ http1_dissect(struct worker *wrk, struct req *req) */ if (req->vsl->wid == 0) { req->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_CLIENTMARKER; - VSLb(req->vsl, SLT_Begin, "req %u", + VSLb(req->vsl, SLT_Begin, "req %u rxreq", req->sp->vxid & VSL_IDENTMASK); - VSL(SLT_Link, req->sp->vxid, "req %u", + VSL(SLT_Link, req->sp->vxid, "req %u rxreq", req->vsl->wid & VSL_IDENTMASK); } diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 048bcc3..92aeb19 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -642,12 +642,12 @@ cnt_restart(struct worker *wrk, struct req *req) } else { wid = VXID_Get(&wrk->vxid_pool); // XXX: ReqEnd + ReqAcct ? - VSLb(req->vsl, SLT_Link, "req %u", wid); + VSLb(req->vsl, SLT_Link, "req %u restart", wid); VSLb(req->vsl, SLT_End, ""); VSL_Flush(req->vsl, 0); owid = req->vsl->wid & VSL_IDENTMASK; req->vsl->wid = wid | VSL_CLIENTMARKER; - VSLb(req->vsl, SLT_Begin, "req %u", owid); + VSLb(req->vsl, SLT_Begin, "req %u restart", owid); req->err_code = 0; req->req_step = R_STP_RECV; diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c index 7b38cef..83ed4cd 100644 --- a/bin/varnishd/cache/cache_session.c +++ b/bin/varnishd/cache/cache_session.c @@ -197,7 +197,7 @@ ses_vsl_socket(struct sess *sp, const char *lsockname) sp->client_port_str = WS_Copy(sp->ws, lport, -1); VTCP_name(sess_local_addr(sp), laddr, sizeof laddr, lport, sizeof lport); - VSL(SLT_Begin, sp->vxid, "sess"); + VSL(SLT_Begin, sp->vxid, "sess 0 HTTP/1"); VSL(SLT_SessOpen, sp->vxid, "%s %s %s %s %s %.6f %d", sp->client_addr_str, sp->client_port_str, lsockname, laddr, lport, sp->t_open, sp->fd); @@ -389,8 +389,9 @@ SES_GetReq(struct worker *wrk, struct sess *sp) sz = cache_param->vsl_buffer; VSL_Setup(req->vsl, p, sz); req->vsl->wid = VXID_Get(&wrk->vxid_pool) | VSL_CLIENTMARKER; - VSLb(req->vsl, SLT_Begin, "req %u", sp->vxid & VSL_IDENTMASK); - VSL(SLT_Link, req->sp->vxid, "req %u", req->vsl->wid & VSL_IDENTMASK); + VSLb(req->vsl, SLT_Begin, "req %u rxreq", sp->vxid & VSL_IDENTMASK); + VSL(SLT_Link, req->sp->vxid, "req %u rxreq", + req->vsl->wid & VSL_IDENTMASK); p += sz; p = (void*)PRNDUP(p); From phk at FreeBSD.org Tue Jan 7 14:52:11 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 15:52:11 +0100 Subject: [master] aa44091 Quench a warning about empty format args. Message-ID: commit aa44091e6a3cf34911f1ef2a038e00601296c970 Author: Poul-Henning Kamp Date: Tue Jan 7 14:51:55 2014 +0000 Quench a warning about empty format args. diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 92aeb19..c9defc8 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -643,7 +643,7 @@ cnt_restart(struct worker *wrk, struct req *req) wid = VXID_Get(&wrk->vxid_pool); // XXX: ReqEnd + ReqAcct ? VSLb(req->vsl, SLT_Link, "req %u restart", wid); - VSLb(req->vsl, SLT_End, ""); + VSLb(req->vsl, SLT_End, "%s", ""); VSL_Flush(req->vsl, 0); owid = req->vsl->wid & VSL_IDENTMASK; req->vsl->wid = wid | VSL_CLIENTMARKER; From phk at FreeBSD.org Tue Jan 7 19:01:39 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 20:01:39 +0100 Subject: [master] 5763353 Move the probing of system default tcp-keepalive parameters to a separate source file and open (and close) a socket specifically for that purpose, so we can do the right thing with parameter defaults. Message-ID: commit 57633531456febf60663562b938f3ff7a40f59d3 Author: Poul-Henning Kamp Date: Tue Jan 7 19:00:37 2014 +0000 Move the probing of system default tcp-keepalive parameters to a separate source file and open (and close) a socket specifically for that purpose, so we can do the right thing with parameter defaults. diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index 6980404..9d281f1 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -64,6 +64,7 @@ varnishd_SOURCES = \ mgt/mgt_param.c \ mgt/mgt_param_tbl.c \ mgt/mgt_param_bits.c \ + mgt/mgt_param_tcp.c \ mgt/mgt_param_tweak.c \ mgt/mgt_pool.c \ mgt/mgt_sandbox.c \ diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c index 6a601a8..e56750f 100644 --- a/bin/varnishd/cache/cache_acceptor.c +++ b/bin/varnishd/cache/cache_acceptor.c @@ -368,26 +368,11 @@ VCA_SetupSess(struct worker *wrk, struct sess *sp) /*--------------------------------------------------------------------*/ -#ifdef HAVE_TCP_KEEP -static void -vca_tcp_keep_probe(int sock, int nam, volatile unsigned *dst) -{ - int i, x; - socklen_t l; - - l = sizeof x; - i = getsockopt(sock, IPPROTO_TCP, nam, &x, &l); - if (i == 0 && x < *dst) - *dst = x; -} -#endif - static void * vca_acct(void *arg) { struct listen_sock *ls; double t0, now; - unsigned u; int i; THR_SetName("cache-acceptor"); @@ -399,18 +384,6 @@ vca_acct(void *arg) if (ls->sock < 0) continue; AZ(listen(ls->sock, cache_param->listen_depth)); -#ifdef HAVE_TCP_KEEP - u = (unsigned)round(cache_param->tcp_keepalive_time); - vca_tcp_keep_probe(ls->sock, TCP_KEEPIDLE, &u); - cache_param->tcp_keepalive_time = u; - - vca_tcp_keep_probe(ls->sock, - TCP_KEEPCNT, &cache_param->tcp_keepalive_probes); - - u = (unsigned)round(cache_param->tcp_keepalive_intvl); - vca_tcp_keep_probe(ls->sock, TCP_KEEPINTVL, &u); - cache_param->tcp_keepalive_intvl = u; -#endif vca_tcp_opt_set(ls->sock, 1); if (cache_param->accept_filter) { i = VTCP_filter_http(ls->sock); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index c9defc8..fdf99db 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -648,7 +648,6 @@ cnt_restart(struct worker *wrk, struct req *req) owid = req->vsl->wid & VSL_IDENTMASK; req->vsl->wid = wid | VSL_CLIENTMARKER; VSLb(req->vsl, SLT_Begin, "req %u restart", owid); - req->err_code = 0; req->req_step = R_STP_RECV; } diff --git a/bin/varnishd/mgt/mgt.h b/bin/varnishd/mgt/mgt.h index 68efbeb..ecdc6d8 100644 --- a/bin/varnishd/mgt/mgt.h +++ b/bin/varnishd/mgt/mgt.h @@ -33,6 +33,7 @@ #include "common/common.h" struct cli; +struct parspec; extern struct vev_base *mgt_evb; extern unsigned d_flag; @@ -79,8 +80,12 @@ void MCF_SetMaximum(const char *param, const char *def); void MCF_ParamSet(struct cli *, const char *param, const char *val); void MCF_ParamProtect(struct cli *, const char *arg); void MCF_DumpRstParam(void); +void MCF_AddParams(struct parspec *ps); extern struct params mgt_param; +/* mgt_param_tcp.c */ +void MCF_TcpParams(void); + /* mgt_sandbox.c */ enum sandbox_e { SANDBOX_VCC = 1, diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c index cd007b1..7da3d88 100644 --- a/bin/varnishd/mgt/mgt_main.c +++ b/bin/varnishd/mgt/mgt_main.c @@ -348,6 +348,8 @@ init_params(struct cli *cli) MCF_CollectParams(); + MCF_TcpParams(); + /* If we have nobody/nogroup, use them as defaults */ if (getpwnam("nobody") != NULL) MCF_SetDefault("user", "nobody"); diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c index 8294332..621129d 100644 --- a/bin/varnishd/mgt/mgt_param.c +++ b/bin/varnishd/mgt/mgt_param.c @@ -358,7 +358,7 @@ mcf_parspec_cmp(const void *a, const void *b) return (strcmp((*pa)->name, (*pb)->name)); } -static void +void MCF_AddParams(struct parspec *ps) { struct parspec *pp; diff --git a/bin/varnishd/mgt/mgt_param_tbl.c b/bin/varnishd/mgt/mgt_param_tbl.c index ecc36f7..de8d1d8 100644 --- a/bin/varnishd/mgt/mgt_param_tbl.c +++ b/bin/varnishd/mgt/mgt_param_tbl.c @@ -215,31 +215,6 @@ struct parspec mgt_parspec[] = { "See setsockopt(2) under SO_SNDTIMEO for more information.", DELAYED_EFFECT, "60", "seconds" }, -#ifdef HAVE_TCP_KEEP - { "tcp_keepalive_time", tweak_timeout, &mgt_param.tcp_keepalive_time, - "1", "7200", - "The number of seconds a connection needs to be idle before " - "TCP begins sending out keep-alive probes. Note that this " - "setting will only take effect when it is less than the " - "system default.", - EXPERIMENTAL, - "600", "seconds" }, - { "tcp_keepalive_probes", tweak_uint, &mgt_param.tcp_keepalive_probes, - "1", "100", - "The maximum number of TCP keep-alive probes to send before " - "giving up and killing the connection if no response is " - "obtained from the other end. Note that this setting will " - "only take effect when it is less than the system default.", - EXPERIMENTAL, - "5", "probes" }, - { "tcp_keepalive_intvl", tweak_timeout, &mgt_param.tcp_keepalive_intvl, - "1", "100", - "The number of seconds between TCP keep-alive probes. Note " - "that this setting will only take effect when it is less than" - "the system default.", - EXPERIMENTAL, - "5", "seconds" }, -#endif { "auto_restart", tweak_bool, &mgt_param.auto_restart, NULL, NULL, "Restart child process automatically if it dies.", diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c new file mode 100644 index 0000000..7e5c7f9 --- /dev/null +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2013 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. + * + * Parameters related to TCP keepalives are not universally available + * as socket options, and probing for system-wide defaults more appropriate + * than our own involves slightly too much grunt-work to be neglible + * so we sequestrate that code here. + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include + +#include "mgt/mgt.h" +#include "common/params.h" + +#include "vss.h" + +#include "mgt/mgt_param.h" + +static struct parspec mgt_parspec_tcp_keep[] = { + { "tcp_keepalive_time", tweak_timeout, &mgt_param.tcp_keepalive_time, + "1", "7200", + "The number of seconds a connection needs to be idle before " + "TCP begins sending out keep-alive probes.", + EXPERIMENTAL, + "", "seconds" }, + { "tcp_keepalive_probes", tweak_uint, &mgt_param.tcp_keepalive_probes, + "1", "100", + "The maximum number of TCP keep-alive probes to send before " + "giving up and killing the connection if no response is " + "obtained from the other end.", + EXPERIMENTAL, + "", "probes" }, + { "tcp_keepalive_intvl", tweak_timeout, &mgt_param.tcp_keepalive_intvl, + "1", "100", + "The number of seconds between TCP keep-alive probes.", + EXPERIMENTAL, + "", "seconds" }, + { NULL, NULL, NULL } +}; + +#ifdef HAVE_TCP_KEEP + +static void +tcp_probe(int sock, int nam, const char *param, unsigned def) +{ + int i; + socklen_t l; + unsigned u; + char buf[10]; + const char *p; + + l = sizeof u; + i = getsockopt(sock, IPPROTO_TCP, nam, &u, &l); + if (i < 0 || u == 0) + u = def; + bprintf(buf, "%u", u); + p = strdup(buf); + AN(p); + MCF_SetDefault(param, p); +} + +static void +tcp_keep_probes(void) +{ + int i, s; + struct vss_addr **ta; + + /* Probe a dummy socket for default values */ + + i = VSS_resolve(":0", NULL, &ta); + if (i == 0) + return; // XXX: log + assert (i > 0); + s = VSS_listen(ta[0], 10); + if (s < 0) + return; // XXX: log + + tcp_probe(s, TCP_KEEPIDLE, "tcp_keepalive_time", 600); + tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes", 5); + tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl", 5); + AZ(close(s)); +} +#endif + +void +MCF_TcpParams(void) +{ +#ifdef HAVE_TCP_KEEP + MCF_AddParams(mgt_parspec_tcp_keep); + tcp_keep_probes(); +#endif +} From phk at FreeBSD.org Tue Jan 7 20:31:03 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 21:31:03 +0100 Subject: [master] 6ffbdc7 Keep Makefile.phk prototype up to date Message-ID: commit 6ffbdc7d614b25701ceb131be6d3179b6d7a0d94 Author: Poul-Henning Kamp Date: Tue Jan 7 20:30:47 2014 +0000 Keep Makefile.phk prototype up to date diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk index 30c1a89..d0ee858 100644 --- a/bin/varnishd/Makefile.phk +++ b/bin/varnishd/Makefile.phk @@ -56,6 +56,7 @@ PROG_SRC += mgt/mgt_main.c PROG_SRC += mgt/mgt_param.c PROG_SRC += mgt/mgt_param_bits.c 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 From phk at FreeBSD.org Tue Jan 7 22:35:18 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 23:35:18 +0100 Subject: [master] dee9dd0 Make sure we only decrement n_object when we truly deallocate an object. Message-ID: commit dee9dd00c1bd00ebb84892495fd1b0e6ffce3dc7 Author: Poul-Henning Kamp Date: Tue Jan 7 22:34:55 2014 +0000 Make sure we only decrement n_object when we truly deallocate an object. diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 68dbe61..e6f1dc4 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -792,9 +792,10 @@ HSH_DerefObjCore(struct dstat *ds, struct objcore **ocp) BAN_DestroyObj(oc); AZ(oc->ban); - if (oc->methods != NULL) + if (oc->methods != NULL) { oc_freeobj(oc); - ds->n_object--; + ds->n_object--; + } FREE_OBJ(oc); ds->n_objectcore--; From phk at FreeBSD.org Tue Jan 7 22:41:40 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 07 Jan 2014 23:41:40 +0100 Subject: [master] 1f526fb ifdef the param structure, we only need it if we have TCP_KEEP Message-ID: commit 1f526fbc1dd90b548cc6b9cb7bd52e9ac22a2e89 Author: Poul-Henning Kamp Date: Tue Jan 7 22:41:21 2014 +0000 ifdef the param structure, we only need it if we have TCP_KEEP diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index 7e5c7f9..66d10ab 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -49,6 +49,8 @@ #include "mgt/mgt_param.h" +#ifdef HAVE_TCP_KEEP + static struct parspec mgt_parspec_tcp_keep[] = { { "tcp_keepalive_time", tweak_timeout, &mgt_param.tcp_keepalive_time, "1", "7200", @@ -71,8 +73,6 @@ static struct parspec mgt_parspec_tcp_keep[] = { { NULL, NULL, NULL } }; -#ifdef HAVE_TCP_KEEP - static void tcp_probe(int sock, int nam, const char *param, unsigned def) { From phk at FreeBSD.org Wed Jan 8 10:49:47 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 08 Jan 2014 11:49:47 +0100 Subject: [master] 989cd35 Renovate how we VSL log HTTP headers, so that all changes, including unsets are logged. Message-ID: commit 989cd35232fa33f42e6214ce553c00a0e9ce0a4f Author: Poul-Henning Kamp Date: Wed Jan 8 10:49:11 2014 +0000 Renovate how we VSL log HTTP headers, so that all changes, including unsets are logged. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 58c1b3c..236ca87 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -991,6 +991,7 @@ void http_FilterReq(struct http *to, const struct http *fm, unsigned how); void http_FilterResp(const struct http *fm, struct http *to, unsigned how); void http_PutProtocol(const struct http *to, const char *protocol); void http_PutStatus(struct http *to, uint16_t status); +void http_ForceHeader(struct http *to, const char *hdr, const char *val); void http_PutResponse(const struct http *to, const char *response); void http_PrintfHeader(struct http *to, const char *fmt, ...) __printflike(2, 3); @@ -1013,7 +1014,7 @@ enum sess_close http_DoConnection(const struct http *); void http_CopyHome(const struct http *hp); void http_Unset(struct http *hp, const char *hdr); void http_CollectHdr(struct http *hp, const char *hdr); -void http_VSLH(const struct http *hp, unsigned hdr); +void http_VSL_log(const struct http *hp); /* cache_http1_proto.c */ diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index f261f70..088e0f1 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -84,8 +84,7 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) * client doesn't grok it. We will uncompress for * the minority of clients which don't. */ - http_Unset(bo->bereq0, H_Accept_Encoding); - http_SetHeader(bo->bereq0, "Accept-Encoding: gzip"); + http_ForceHeader(bo->bereq0, H_Accept_Encoding, "gzip"); } } if (bo->ims_obj != NULL) { @@ -196,6 +195,8 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) AN(bo->vbc); } + http_VSL_log(bo->beresp); + /* * These two headers can be spread over multiple actual headers * and we rely on their content outside of VCL, so collect them diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 97abe39..711ea2b 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -41,6 +41,8 @@ #include "tbl/http_headers.h" #undef HTTPH +/*--------------------------------------------------------------------*/ + static const enum VSL_tag_e foo[] = { [HTTP_Method] = SLT_ReqMethod, [HTTP_Resp] = SLT_RespMethod, @@ -61,13 +63,35 @@ http2shmlog(const struct http *hp, int t) return ((enum VSL_tag_e)(foo[hp->logtag] + t)); } -void +static void http_VSLH(const struct http *hp, unsigned hdr) { - AN(hp->vsl); - AN(hp->vsl->wid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER)); - VSLbt(hp->vsl, http2shmlog(hp, hdr), hp->hd[hdr]); + if (hp->vsl != NULL) { + AN(hp->vsl->wid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER)); + VSLbt(hp->vsl, http2shmlog(hp, hdr), hp->hd[hdr]); + } +} + +static void +http_VSLH_del(const struct http *hp, unsigned hdr) +{ + + if (hp->vsl != NULL) { + AN(hp->vsl->wid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER)); + VSLbt(hp->vsl, ((enum VSL_tag_e)(http2shmlog(hp, hdr) + 1)), + hp->hd[hdr]); + } +} + +void +http_VSL_log(const struct http *hp) +{ + unsigned u; + + for (u = 0; u < hp->nhd; u++) + if (hp->hd[u].b != NULL) + http_VSLH(hp, u); } /*--------------------------------------------------------------------*/ @@ -488,6 +512,7 @@ http_SetH(const struct http *to, unsigned n, const char *fm) to->hd[n].b = TRUST_ME(fm); to->hd[n].e = strchr(to->hd[n].b, '\0'); to->hdf[n] = 0; + http_VSLH(to, n); } static void @@ -498,6 +523,7 @@ http_linkh(const struct http *to, const struct http *fm, unsigned n) Tcheck(fm->hd[n]); to->hd[n] = fm->hd[n]; to->hdf[n] = fm->hdf[n]; + http_VSLH(to, n); } void @@ -574,6 +600,7 @@ http_filterfields(struct http *to, const struct http *fm, unsigned how) if (to->nhd < to->shd) { to->hd[to->nhd] = fm->hd[u]; to->hdf[to->nhd] = 0; + http_VSLH(to, to->nhd); to->nhd++; } else { VSC_C_main->losthdr++; @@ -629,13 +656,11 @@ http_CopyHome(const struct http *hp) if (hp->hd[u].b == NULL) continue; if (hp->hd[u].b >= hp->ws->s && hp->hd[u].e <= hp->ws->e) { - http_VSLH(hp, u); continue; } l = Tlen(hp->hd[u]); p = WS_Copy(hp->ws, hp->hd[u].b, l + 1L); if (p != NULL) { - http_VSLH(hp, u); hp->hd[u].b = p; hp->hd[u].e = p + l; } else { @@ -679,6 +704,19 @@ http_SetHeader(struct http *to, const char *hdr) /*--------------------------------------------------------------------*/ +void +http_ForceHeader(struct http *to, const char *hdr, const char *val) +{ + + CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); + if (http_HdrIs(to, hdr, val)) + return; + http_Unset(to, hdr); + http_PrintfHeader(to, "%s %s", hdr + 1, val); +} + +/*--------------------------------------------------------------------*/ + static void http_PutField(const struct http *to, int field, const char *string) { @@ -698,6 +736,7 @@ http_PutField(const struct http *to, int field, const char *string) to->hd[field].b = p; to->hd[field].e = p + l; to->hdf[field] = 0; + http_VSLH(to, field); } } @@ -719,7 +758,7 @@ http_PutStatus(struct http *to, uint16_t status) assert(status >= 100 && status <= 999); to->status = status; bprintf(buf, "%03d", status % 1000); - http_SetH(to, HTTP_HDR_STATUS, WS_Copy(to->ws, buf, sizeof buf)); + http_PutField(to, HTTP_HDR_STATUS, buf); } void @@ -752,9 +791,11 @@ http_PrintfHeader(struct http *to, const char *fmt, ...) to->hd[to->nhd].e = to->ws->f + n; to->hdf[to->nhd] = 0; WS_Release(to->ws, n + 1); + http_VSLH(to, to->nhd); to->nhd++; } } + /*--------------------------------------------------------------------*/ void @@ -765,8 +806,10 @@ http_Unset(struct http *hp, const char *hdr) for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) { if (hp->hd[u].b == NULL) continue; - if (http_IsHdr(&hp->hd[u], hdr)) + if (http_IsHdr(&hp->hd[u], hdr)) { + http_VSLH_del(hp, u); continue; + } if (v != u) { memcpy(&hp->hd[v], &hp->hd[u], sizeof *hp->hd); memcpy(&hp->hdf[v], &hp->hdf[u], sizeof *hp->hdf); diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c index db0a1c5..ef1043e 100644 --- a/bin/varnishd/cache/cache_http1_proto.c +++ b/bin/varnishd/cache/cache_http1_proto.c @@ -279,7 +279,6 @@ htc_dissect_hdrs(struct http *hp, char *p, const struct http_conn *htc) hp->hdf[hp->nhd] = 0; hp->hd[hp->nhd].b = p; hp->hd[hp->nhd].e = q; - http_VSLH(hp, hp->nhd); hp->nhd++; } else { VSLb(hp->vsl, SLT_BogoHeader, "Too many headers: %.*s", @@ -364,15 +363,10 @@ htc_splitline(struct http *hp, const struct http_conn *htc, int req) p += vct_skipcrlf(p); *hp->hd[h1].e = '\0'; - http_VSLH(hp, h1); - *hp->hd[h2].e = '\0'; - http_VSLH(hp, h2); - if (hp->hd[h3].e != NULL) { + if (hp->hd[h3].e != NULL) *hp->hd[h3].e = '\0'; - http_VSLH(hp, h3); - } return (htc_dissect_hdrs(hp, p, htc)); } @@ -519,7 +513,6 @@ HTTP1_Write(const struct worker *w, const struct http *hp, int resp) if (resp) { l = WRW_WriteH(w, &hp->hd[HTTP_HDR_PROTO], " "); - http_VSLH(hp, HTTP_HDR_PROTO); hp->hd[HTTP_HDR_STATUS].b = WS_Alloc(hp->ws, 4); AN(hp->hd[HTTP_HDR_STATUS].b); @@ -528,18 +521,13 @@ HTTP1_Write(const struct worker *w, const struct http *hp, int resp) hp->hd[HTTP_HDR_STATUS].e = hp->hd[HTTP_HDR_STATUS].b + 3; l += WRW_WriteH(w, &hp->hd[HTTP_HDR_STATUS], " "); - http_VSLH(hp, HTTP_HDR_STATUS); l += WRW_WriteH(w, &hp->hd[HTTP_HDR_RESPONSE], "\r\n"); - http_VSLH(hp, HTTP_HDR_RESPONSE); } else { AN(hp->hd[HTTP_HDR_URL].b); l = WRW_WriteH(w, &hp->hd[HTTP_HDR_METHOD], " "); - http_VSLH(hp, HTTP_HDR_METHOD); l += WRW_WriteH(w, &hp->hd[HTTP_HDR_URL], " "); - http_VSLH(hp, HTTP_HDR_URL); l += WRW_WriteH(w, &hp->hd[HTTP_HDR_PROTO], "\r\n"); - http_VSLH(hp, HTTP_HDR_PROTO); } for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { if (hp->hd[u].b == NULL) @@ -547,7 +535,6 @@ HTTP1_Write(const struct worker *w, const struct http *hp, int resp) AN(hp->hd[u].b); AN(hp->hd[u].e); l += WRW_WriteH(w, &hp->hd[u], "\r\n"); - http_VSLH(hp, u); } l += WRW_Write(w, "\r\n", -1); return (l); diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index fdf99db..8c5b43f 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -690,6 +690,8 @@ cnt_recv(struct worker *wrk, struct req *req) VSLb(req->vsl, SLT_ReqStart, "%s %s", req->sp->client_addr_str, req->sp->client_port_str); + http_VSL_log(req->http); + if (req->err_code) { req->req_step = R_STP_ERROR; return (REQ_FSM_MORE); @@ -716,12 +718,12 @@ cnt_recv(struct worker *wrk, struct req *req) } recv_handling = wrk->handling; + /* We wash the A-E header here for the sake of VRY */ if (cache_param->http_gzip_support && (recv_handling != VCL_RET_PIPE) && (recv_handling != VCL_RET_PASS)) { if (RFC2616_Req_Gzip(req->http)) { - http_Unset(req->http, H_Accept_Encoding); - http_SetHeader(req->http, "Accept-Encoding: gzip"); + http_ForceHeader(req->http, H_Accept_Encoding, "gzip"); } else { http_Unset(req->http, H_Accept_Encoding); } From martin at varnish-software.com Wed Jan 8 14:50:10 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 08 Jan 2014 15:50:10 +0100 Subject: [master] 0d28c61 The corresponding API changes Message-ID: commit 0d28c61c3df439e7947ccfa7d969305a57e913ad Author: Martin Blix Grydeland Date: Wed Jan 8 14:09:18 2014 +0100 The corresponding API changes This makes the logging API work again after the changes to the Begin and Link log records. Even though restarts are linked below the request that initiated them, the API will report them at the same level as the initiating request. This is to help makes queries depending on levels predictable. diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index ace0122..cecdaf6 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -60,7 +60,6 @@ enum VSL_transaction_e { VSL_t_unknown, VSL_t_sess, VSL_t_req, - VSL_t_esireq, VSL_t_bereq, VSL_t_raw, VSL_t__MAX, diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index dd17839..4bbfc05 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -220,7 +220,6 @@ static const char * const VSL_transactions[VSL_t__MAX] = { [VSL_t_unknown] = "<< Unknown >>", [VSL_t_sess] = "<< Session >>", [VSL_t_req] = "<< Request >>", - [VSL_t_esireq] = "<< ESI-req >>", [VSL_t_bereq] = "<< BeReq >>", [VSL_t_raw] = "<< Record >>", }; @@ -339,7 +338,6 @@ VSL_PrintTransactions(struct VSL_data *vsl, struct VSL_transaction * const pt[], if (vsl->c_opt || vsl->b_opt) { switch (t->type) { case VSL_t_req: - case VSL_t_esireq: if (!vsl->c_opt) continue; break; diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 802b525..9c589a0 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -52,11 +52,22 @@ static const char * const vsl_t_names[VSL_t__MAX] = { [VSL_t_unknown] = "unknown", [VSL_t_sess] = "sess", [VSL_t_req] = "req", - [VSL_t_esireq] = "esireq", [VSL_t_bereq] = "bereq", [VSL_t_raw] = "raw", }; +/* The transaction reasons we care about */ +enum vsl_reason_e { + vsl_r_unknown, + vsl_r_restart, + vsl_r__MAX, +}; + +static const char * const vsl_r_names[vsl_r__MAX] = { + [vsl_r_unknown] = "unknown", + [vsl_r_restart] = "restart", +}; + struct vtx; struct vslc_raw { @@ -140,6 +151,7 @@ struct vtx { complete */ enum VSL_transaction_e type; + enum vsl_reason_e reason; struct vtx *parent; VTAILQ_HEAD(,vtx) child; @@ -488,6 +500,7 @@ vtx_new(struct VSLQ *vslq) vtx->t_start = VTIM_mono(); vtx->flags = 0; vtx->type = VSL_t_unknown; + vtx->reason = vsl_r_unknown; vtx->parent = NULL; vtx->n_child = 0; vtx->n_childready = 0; @@ -658,39 +671,41 @@ vtx_set_parent(struct vtx *parent, struct vtx *child) /* Parse a begin or link record. Returns the number of elements that was successfully parsed. */ static int -vtx_parse_beginlink(const char *str, enum VSL_transaction_e *ptype, - unsigned *pvxid) +vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, + unsigned *pvxid, enum vsl_reason_e *preason) { - char buf[8]; + char type[16], reason[16]; unsigned vxid; int i, j; - enum VSL_transaction_e type = VSL_t_unknown; AN(str); - i = sscanf(str, "%7s %u", buf, &vxid); + AN(ptype); + AN(pvxid); + AN(preason); + + i = sscanf(str, "%15s %u %15s", type, &vxid, reason); if (i < 1) - return (-1); + return (0); for (j = 0; j < VSL_t__MAX; j++) - if (!strcmp(buf, vsl_t_names[j])) + if (!strcmp(type, vsl_t_names[j])) break; - switch (j) { - case VSL_t_sess: - case VSL_t_req: - case VSL_t_esireq: - case VSL_t_bereq: - /* Valid types */ - type = j; - break; - default: - return (-1); - } + if (j < VSL_t__MAX) + *ptype = j; + else + *ptype = VSL_t_unknown; if (i == 1) - vxid = 0; - if (ptype) - *ptype = type; - if (pvxid) - *pvxid = vxid; - return (i); + return (1); + *pvxid = vxid; + if (i == 2) + return (2); + for (j = 0; j < vsl_r__MAX; j++) + if (!strcmp(reason, vsl_r_names[j])) + break; + if (j < vsl_r__MAX) + *preason = j; + else + *preason = vsl_r_unknown; + return (3); } /* Parse and process a begin record */ @@ -699,6 +714,7 @@ vtx_scan_begin(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) { int i; enum VSL_transaction_e type; + enum vsl_reason_e reason; unsigned p_vxid; struct vtx *p_vtx; @@ -706,20 +722,22 @@ vtx_scan_begin(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) AZ(vtx->flags & VTX_F_READY); - i = vtx_parse_beginlink(VSL_CDATA(ptr), &type, &p_vxid); - if (i < 1) + i = vtx_parse_link(VSL_CDATA(ptr), &type, &p_vxid, &reason); + if (i != 3) return (vtx_diag_tag(vtx, ptr, "parse error")); + if (type == VSL_t_unknown) + (void)vtx_diag_tag(vtx, ptr, "unknown vxid type"); /* Check/set vtx type */ - assert(type != VSL_t_unknown); - if (vtx->type != VSL_t_unknown && vtx->type != type) { + if (vtx->type != VSL_t_unknown && vtx->type != type) /* Type not matching the one previously set by a link record */ - return (vtx_diag_tag(vtx, ptr, "type mismatch")); - } + (void)vtx_diag_tag(vtx, ptr, "type mismatch"); vtx->type = type; + vtx->reason = reason; - if (i == 1 || p_vxid == 0) + if (p_vxid == 0) + /* No parent */ return (0); if (vslq->grouping == VSL_g_vxid) @@ -739,17 +757,15 @@ vtx_scan_begin(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) p_vtx = vtx_lookup(vslq, p_vxid); if (p_vtx == NULL) { - /* Not seen parent yet. Insert it and create link. */ + /* Not seen parent yet. Create it. */ p_vtx = vtx_add(vslq, p_vxid); AN(p_vtx); - vtx_set_parent(p_vtx, vtx); - return (0); + } else { + CHECK_OBJ_NOTNULL(p_vtx, VTX_MAGIC); + if (p_vtx->flags & VTX_F_COMPLETE) + return (vtx_diag_tag(vtx, ptr, "link too late")); } - CHECK_OBJ_NOTNULL(p_vtx, VTX_MAGIC); - if (p_vtx->flags & VTX_F_COMPLETE) - return (vtx_diag_tag(vtx, ptr, "link too late")); - /* Create link */ vtx_set_parent(p_vtx, vtx); @@ -762,6 +778,7 @@ vtx_scan_link(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) { int i; enum VSL_transaction_e c_type; + enum vsl_reason_e c_reason; unsigned c_vxid; struct vtx *c_vtx; @@ -769,11 +786,11 @@ vtx_scan_link(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) AZ(vtx->flags & VTX_F_READY); - i = vtx_parse_beginlink(VSL_CDATA(ptr), &c_type, &c_vxid); - if (i < 2) + i = vtx_parse_link(VSL_CDATA(ptr), &c_type, &c_vxid, &c_reason); + if (i != 3) return (vtx_diag_tag(vtx, ptr, "parse error")); - assert(i == 2); - assert(c_type != VSL_t_unknown); + if (c_type == VSL_t_unknown) + (void)vtx_diag_tag(vtx, ptr, "unknown vxid type"); if (vslq->grouping == VSL_g_vxid) return (0); /* No links */ @@ -786,7 +803,9 @@ vtx_scan_link(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) /* Child not seen before. Insert it and create link */ c_vtx = vtx_add(vslq, c_vxid); AN(c_vtx); + AZ(c_vtx->parent); c_vtx->type = c_type; + c_vtx->reason = c_reason; vtx_set_parent(vtx, c_vtx); return (0); } @@ -800,9 +819,10 @@ vtx_scan_link(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) if (c_vtx->flags & VTX_F_COMPLETE) return (vtx_diag_tag(vtx, ptr, "link too late")); if (c_vtx->type != VSL_t_unknown && c_vtx->type != c_type) - return (vtx_diag_tag(vtx, ptr, "type mismatch")); + (void)vtx_diag_tag(vtx, ptr, "type mismatch"); c_vtx->type = c_type; + c_vtx->reason = c_reason; vtx_set_parent(vtx, c_vtx); return (0); } @@ -901,7 +921,11 @@ vslq_callback(const struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func, assert(i < n); (void)vslc_vtx_reset(&vtx->c.cursor); vtxs[i] = vtx; - trans[i].level = trans[j].level + 1; + if (vtx->reason == vsl_r_restart) + /* Restarts stay at the same level as parent */ + trans[i].level = trans[j].level; + else + trans[i].level = trans[j].level + 1; trans[i].vxid = vtx->key.vxid; trans[i].vxid_parent = trans[j].vxid; trans[i].type = vtx->type; @@ -950,7 +974,6 @@ vtx_synth_rec(struct vtx *vtx, unsigned tag, const char *fmt, ...) synth->data[1] = vtx->key.vxid; switch (vtx->type) { case VSL_t_req: - case VSL_t_esireq: synth->data[1] |= VSL_CLIENTMARKER; break; case VSL_t_bereq: From martin at varnish-software.com Wed Jan 8 14:50:10 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 08 Jan 2014 15:50:10 +0100 Subject: [master] 93e58f1 Fix test cases after Begin and Link changes Message-ID: commit 93e58f110be7066491f7337ab7c8a45891b47b17 Author: Martin Blix Grydeland Date: Wed Jan 8 15:12:38 2014 +0100 Fix test cases after Begin and Link changes diff --git a/bin/varnishtest/tests/l00000.vtc b/bin/varnishtest/tests/l00000.vtc index adf7c8f..c4dd3f1 100644 --- a/bin/varnishtest/tests/l00000.vtc +++ b/bin/varnishtest/tests/l00000.vtc @@ -16,10 +16,10 @@ logexpect l1 -v v1 -g session { expect 0 = End expect 0 * Begin "req 1000" - expect 0 = ReqMethod GET + expect 0 = ReqMethod GET expect 0 = ReqURL / expect 0 = ReqProtocol HTTP/1.1 - expect * = ReqHeader "Foo: bar" + expect * = ReqHeader "Foo: bar" expect * = Link bereq expect * = ReqEnd expect 0 = End @@ -29,7 +29,7 @@ logexpect l1 -v v1 -g session { } -start # Check with a query (this selects only the backend request) -logexpect l2 -v v1 -g vxid -q "Begin eq 'bereq 1001'" { +logexpect l2 -v v1 -g vxid -q "Begin ~ 'bereq 1001'" { expect 0 1002 Begin expect * = End } -start diff --git a/bin/varnishtest/tests/l00001.vtc b/bin/varnishtest/tests/l00001.vtc index 1da61df..a161c7b 100644 --- a/bin/varnishtest/tests/l00001.vtc +++ b/bin/varnishtest/tests/l00001.vtc @@ -20,7 +20,7 @@ client c1 { } -run # Test 'eq' operator -logexpect l1 -d 1 -g vxid -q "Begin eq 'req 1000'" { +logexpect l1 -d 1 -g vxid -q "Begin eq 'req 1000 rxreq'" { expect 0 * Begin req expect * = ReqEnd expect * = End From martin at varnish-software.com Wed Jan 8 14:50:10 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 08 Jan 2014 15:50:10 +0100 Subject: [master] 99bdea7 Document the levels with regard to restarts Message-ID: commit 99bdea7723f6551cb1990559a0f802cb24a52154 Author: Martin Blix Grydeland Date: Wed Jan 8 15:49:40 2014 +0100 Document the levels with regard to restarts diff --git a/doc/sphinx/reference/vsl-query.rst b/doc/sphinx/reference/vsl-query.rst index 6f4a41f..9547a59 100644 --- a/doc/sphinx/reference/vsl-query.rst +++ b/doc/sphinx/reference/vsl-query.rst @@ -35,8 +35,12 @@ When grouping transactions, there is a hierarchy structure showing which transaction initiated what. The level increases by one by an 'initiated by' relation, so for example a backend transaction will have one higher level than the client transaction that initiated it on -a cache miss. Levels start counting at 1, except when using raw where -it will always be 0. +a cache miss. Request restart transactions does not have it's level +increased. This is to help predicting the level for a given +transaction. + +Levels start counting at 1, except when using raw where it will always +be 0. The grouping modes are: From martin at varnish-software.com Wed Jan 8 15:58:58 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 08 Jan 2014 16:58:58 +0100 Subject: [master] 18876a3 Fix test case Message-ID: commit 18876a359a7e8f22654180a11a8fd0208fc75d88 Author: Martin Blix Grydeland Date: Wed Jan 8 16:58:45 2014 +0100 Fix test case diff --git a/bin/varnishtest/tests/l00000.vtc b/bin/varnishtest/tests/l00000.vtc index c4dd3f1..09423cc 100644 --- a/bin/varnishtest/tests/l00000.vtc +++ b/bin/varnishtest/tests/l00000.vtc @@ -16,6 +16,7 @@ logexpect l1 -v v1 -g session { expect 0 = End expect 0 * Begin "req 1000" + expect 0 = ReqStart expect 0 = ReqMethod GET expect 0 = ReqURL / expect 0 = ReqProtocol HTTP/1.1 From phk at FreeBSD.org Wed Jan 8 21:09:33 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 08 Jan 2014 22:09:33 +0100 Subject: [master] a8e79f6 Simplify the trickery to find the right SLT for http header operations. Message-ID: commit a8e79f6d0e79f55d863c68bb011098345e86355e Author: Poul-Henning Kamp Date: Wed Jan 8 21:05:10 2014 +0000 Simplify the trickery to find the right SLT for http header operations. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 236ca87..e733c38 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -177,18 +177,6 @@ struct ws { }; /*-------------------------------------------------------------------- - * HTTP Request/Response/Header handling structure. - */ - -enum httpwhence { - HTTP_Method = 1, - HTTP_Resp, - HTTP_Bereq, - HTTP_Beresp, - HTTP_Obj -}; - -/*-------------------------------------------------------------------- * Ban info event types */ @@ -197,7 +185,7 @@ struct http { unsigned magic; #define HTTP_MAGIC 0x6428b5c9 - enum httpwhence logtag; + enum VSL_tag_e logtag; /* Must be SLT_*Method */ struct vsl_log *vsl; struct ws *ws; @@ -998,7 +986,7 @@ void http_PrintfHeader(struct http *to, const char *fmt, ...) void http_SetHeader(struct http *to, const char *hdr); void http_SetH(const struct http *to, unsigned n, const char *fm); void http_ForceGet(const struct http *to); -void HTTP_Setup(struct http *, struct ws *, struct vsl_log *, enum httpwhence); +void HTTP_Setup(struct http *, struct ws *, struct vsl_log *, enum VSL_tag_e); void http_Teardown(struct http *ht); int http_GetHdr(const struct http *hp, const char *hdr, char **ptr); int http_GetHdrData(const struct http *hp, const char *hdr, diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index a2904c8..e76b437 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -69,7 +69,7 @@ ved_include(struct req *preq, const char *src, const char *host) req->http0->conds = 0; - HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Method); + HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod); http_SetH(req->http0, HTTP_HDR_URL, src); if (host != NULL && *host != '\0') { diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 088e0f1..4ee5b97 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -72,7 +72,7 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) AZ(bo->should_close); AZ(bo->storage_hint); - HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, HTTP_Bereq); + HTTP_Setup(bo->bereq0, bo->ws, bo->vsl, SLT_BereqMethod); http_FilterReq(bo->bereq0, bo->req->http, bo->do_pass ? HTTPH_R_PASS : HTTPH_R_FETCH); if (!bo->do_pass) { @@ -118,7 +118,7 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) AZ(bo->should_close); AZ(bo->storage_hint); - HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq); + HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod); HTTP_Copy(bo->bereq, bo->bereq0); VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, bo->bereq->ws); @@ -144,7 +144,7 @@ static void make_it_503(struct busyobj *bo) { - HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp); + HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod); http_SetH(bo->beresp, HTTP_HDR_PROTO, "HTTP/1.1"); http_SetResp(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed"); http_SetHeader(bo->beresp, "Content-Length: 0"); @@ -164,7 +164,7 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) xxxassert (wrk->handling == VCL_RET_FETCH); - HTTP_Setup(bo->beresp, bo->ws, bo->vsl, HTTP_Beresp); + HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod); if (!bo->do_pass && bo->req != NULL) vbf_release_req(bo); /* XXX: retry ?? */ @@ -433,7 +433,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) hp = bo->beresp; hp2 = obj->http; - hp2->logtag = HTTP_Obj; + hp2->logtag = SLT_ObjMethod; http_FilterResp(hp, hp2, bo->uncacheable ? HTTPH_R_PASS : HTTPH_A_INS); http_CopyHome(hp2); @@ -594,7 +594,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) obj->vxid = bo->vsl->wid; - obj->http->logtag = HTTP_Obj; + obj->http->logtag = SLT_ObjMethod; /* XXX: we should have our own HTTP_A_CONDFETCH */ http_FilterResp(bo->ims_obj->http, obj->http, HTTPH_A_INS); http_CopyHome(obj->http); diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 711ea2b..93d60a9 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -41,49 +41,46 @@ #include "tbl/http_headers.h" #undef HTTPH -/*--------------------------------------------------------------------*/ - -static const enum VSL_tag_e foo[] = { - [HTTP_Method] = SLT_ReqMethod, - [HTTP_Resp] = SLT_RespMethod, - [HTTP_Bereq] = SLT_BereqMethod, - [HTTP_Beresp] = SLT_BerespMethod, - [HTTP_Obj] = SLT_ObjMethod, -}; - -static enum VSL_tag_e -http2shmlog(const struct http *hp, int t) -{ - - CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); - if (t > HTTP_HDR_FIRST) - t = HTTP_HDR_FIRST; - assert(hp->logtag >= HTTP_Method && hp->logtag <= HTTP_Obj); /*lint !e685*/ - assert(t >= HTTP_HDR_METHOD && t <= HTTP_HDR_FIRST); - return ((enum VSL_tag_e)(foo[hp->logtag] + t)); -} +/*-------------------------------------------------------------------- + * These two functions are in an incestous relationship with the + * order of macros in include/tbl/vsl_tags_http.h + * + * The http->logtag is the SLT_*Method enum, and we add to that, to + * get the SLT_ to use. + */ static void http_VSLH(const struct http *hp, unsigned hdr) { + int i; if (hp->vsl != NULL) { AN(hp->vsl->wid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER)); - VSLbt(hp->vsl, http2shmlog(hp, hdr), hp->hd[hdr]); + i = hdr; + if (i > HTTP_HDR_FIRST) + i = HTTP_HDR_FIRST; + i += hp->logtag; + VSLbt(hp->vsl, (enum VSL_tag_e)i, hp->hd[hdr]); } } static void http_VSLH_del(const struct http *hp, unsigned hdr) { + int i; if (hp->vsl != NULL) { + /* We don't support unsetting stuff in the first line */ + assert (hdr >= HTTP_HDR_FIRST); AN(hp->vsl->wid & (VSL_CLIENTMARKER|VSL_BACKENDMARKER)); - VSLbt(hp->vsl, ((enum VSL_tag_e)(http2shmlog(hp, hdr) + 1)), - hp->hd[hdr]); + i = (HTTP_HDR_UNSET - HTTP_HDR_METHOD); + i += hp->logtag; + VSLbt(hp->vsl, (enum VSL_tag_e)i, hp->hd[hdr]); } } +/*--------------------------------------------------------------------*/ + void http_VSL_log(const struct http *hp) { @@ -145,7 +142,7 @@ HTTP_create(void *p, uint16_t nhttp) void HTTP_Setup(struct http *hp, struct ws *ws, struct vsl_log *vsl, - enum httpwhence whence) + enum VSL_tag_e whence) { http_Teardown(hp); hp->logtag = whence; diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c index 7818260..46cddb7 100644 --- a/bin/varnishd/cache/cache_http1_fsm.c +++ b/bin/varnishd/cache/cache_http1_fsm.c @@ -297,7 +297,7 @@ http1_dissect(struct worker *wrk, struct req *req) req->vcl = wrk->vcl; wrk->vcl = NULL; - HTTP_Setup(req->http, req->ws, req->vsl, HTTP_Method); + HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod); req->err_code = HTTP1_DissectRequest(req); /* If we could not even parse the request, just close */ diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 8c5b43f..11c5c84 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -103,7 +103,7 @@ cnt_deliver(struct worker *wrk, struct req *req) if (!(req->obj->objcore->flags & OC_F_PRIVATE)) EXP_Touch(req->obj->objcore, req->t_resp); - HTTP_Setup(req->resp, req->ws, req->vsl, HTTP_Resp); + HTTP_Setup(req->resp, req->ws, req->vsl, SLT_RespMethod); http_ClrHeader(req->resp); http_FilterResp(req->obj->http, req->resp, 0); @@ -594,7 +594,7 @@ cnt_pipe(struct worker *wrk, struct req *req) req->acct_req.pipe++; bo = VBO_GetBusyObj(wrk, req); - HTTP_Setup(bo->bereq, bo->ws, bo->vsl, HTTP_Bereq); + HTTP_Setup(bo->bereq, bo->ws, bo->vsl, SLT_BereqMethod); http_FilterReq(bo->bereq, req->http, 0); // XXX: 0 ? http_PrintfHeader(bo->bereq, "X-Varnish: %u", req->vsl->wid & VSL_IDENTMASK); diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index c54b982..70b2dd2 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -283,7 +283,7 @@ STV_MkObject(struct stevedore *stv, struct busyobj *bo, WS_Assert(bo->ws_o); assert(bo->ws_o->e <= (char*)ptr + ltot); - HTTP_Setup(o->http, bo->ws_o, bo->vsl, HTTP_Obj); + HTTP_Setup(o->http, bo->ws_o, bo->vsl, SLT_ObjMethod); o->http->magic = HTTP_MAGIC; o->exp = bo->exp; o->last_use = bo->t_fetch; diff --git a/bin/varnishtest/tests/r01029.vtc b/bin/varnishtest/tests/r01029.vtc index 745fb68..7058ef4 100644 --- a/bin/varnishtest/tests/r01029.vtc +++ b/bin/varnishtest/tests/r01029.vtc @@ -23,12 +23,12 @@ varnish v1 -vcl+backend { } -start client c1 { - txreq -url "/bar" -hdr "Accept-Encoding: gzip" + txreq -url "/bar" -hdr "Accept-Encoding: gzip,foo" rxresp gunzip expect resp.bodylen == 5 - txreq -url "/foo" -hdr "Accept-Encoding: gzip" + txreq -url "/foo" -hdr "Accept-Encoding: gzip,foo" rxresp expect resp.bodylen == 21 } -run diff --git a/include/tbl/vsl_tags_http.h b/include/tbl/vsl_tags_http.h index 8d7e56d..3a3ae50 100644 --- a/include/tbl/vsl_tags_http.h +++ b/include/tbl/vsl_tags_http.h @@ -27,8 +27,11 @@ * * Define the VSL tags for HTTP protocol messages * - * The order of this table is not random, do not resort. - * In particular, the FIRST and LOST entries must be last, in that order. + * NB: The order of this table is not random, DO NOT RESORT. + * + * Specifically FIRST, UNSET and LOST entries must be last, in that order. + * + * See bin/varnishd/cache/cache_http.c::http_VSLH() for the other side. * * Arguments: * Tag-Name @@ -64,6 +67,15 @@ SLTH(Header, HTTP_HDR_FIRST, 1, 1, "header", "\t+----- Header name\n" "\n" ) +SLTH(Unset, HTTP_HDR_UNSET, 0, 0, "unset header", + "HTTP header contents.\n\n" + "The format is::\n\n" + "\t%s: %s\n" + "\t| |\n" + "\t| +- Header value\n" + "\t+----- Header name\n" + "\n" +) SLTH(Lost, HTTP_HDR_LOST, 0, 0, "lost header", "" ) From phk at FreeBSD.org Wed Jan 8 23:39:05 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 09 Jan 2014 00:39:05 +0100 Subject: [master] abd1ad8 Try to make this test more reliable. Message-ID: commit abd1ad832a4004f9a35d3aab0fa1c687259ebfba Author: Poul-Henning Kamp Date: Wed Jan 8 23:38:53 2014 +0000 Try to make this test more reliable. diff --git a/bin/varnishtest/tests/r01086.vtc b/bin/varnishtest/tests/r01086.vtc index ba4ace5..667cc4d 100644 --- a/bin/varnishtest/tests/r01086.vtc +++ b/bin/varnishtest/tests/r01086.vtc @@ -20,6 +20,8 @@ server s1 { sendhex "00000000" send "\r\n" + delay .2 + chunked "FOOBAR" chunkedlen 0 @@ -45,6 +47,8 @@ server s1 { sendhex "00000000" send "\r\n" + delay .2 + chunked "FOOBAR" chunkedlen 0 From martin at varnish-software.com Thu Jan 9 14:16:26 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 09 Jan 2014 15:16:26 +0100 Subject: [master] 5acde03 Expose the transaction reason through the API Message-ID: commit 5acde036d493f79beaa9b55350ec97882f0ce3e8 Author: Martin Blix Grydeland Date: Thu Jan 9 14:29:29 2014 +0100 Expose the transaction reason through the API This allows the parsed transaction reason to be visible in the transactions returned from the API. This is to pave the way for varnishncsa to see which req transactions are ESI's and skip these. diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index cecdaf6..fee24d1 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -65,11 +65,24 @@ enum VSL_transaction_e { VSL_t__MAX, }; +enum VSL_reason_e { + VSL_r_unknown, + VSL_r_http_1, + VSL_r_rxreq, + VSL_r_esi, + VSL_r_restart, + VSL_r_pass, + VSL_r_fetch, + VSL_r_bgfetch, + VSL_r__MAX, +}; + struct VSL_transaction { unsigned level; int32_t vxid; int32_t vxid_parent; enum VSL_transaction_e type; + enum VSL_reason_e reason; struct VSL_cursor *c; }; diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index 9c589a0..b4fdc59 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -56,16 +56,15 @@ static const char * const vsl_t_names[VSL_t__MAX] = { [VSL_t_raw] = "raw", }; -/* The transaction reasons we care about */ -enum vsl_reason_e { - vsl_r_unknown, - vsl_r_restart, - vsl_r__MAX, -}; - -static const char * const vsl_r_names[vsl_r__MAX] = { - [vsl_r_unknown] = "unknown", - [vsl_r_restart] = "restart", +static const char * const vsl_r_names[VSL_r__MAX] = { + [VSL_r_unknown] = "unknown", + [VSL_r_http_1] = "HTTP/1", + [VSL_r_rxreq] = "rxreq", + [VSL_r_esi] = "esi", + [VSL_r_restart] = "restart", + [VSL_r_pass] = "pass", + [VSL_r_fetch] = "fetch", + [VSL_r_bgfetch] = "bgfetch", }; struct vtx; @@ -151,7 +150,7 @@ struct vtx { complete */ enum VSL_transaction_e type; - enum vsl_reason_e reason; + enum VSL_reason_e reason; struct vtx *parent; VTAILQ_HEAD(,vtx) child; @@ -500,7 +499,7 @@ vtx_new(struct VSLQ *vslq) vtx->t_start = VTIM_mono(); vtx->flags = 0; vtx->type = VSL_t_unknown; - vtx->reason = vsl_r_unknown; + vtx->reason = VSL_r_unknown; vtx->parent = NULL; vtx->n_child = 0; vtx->n_childready = 0; @@ -672,7 +671,7 @@ vtx_set_parent(struct vtx *parent, struct vtx *child) successfully parsed. */ static int vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, - unsigned *pvxid, enum vsl_reason_e *preason) + unsigned *pvxid, enum VSL_reason_e *preason) { char type[16], reason[16]; unsigned vxid; @@ -698,13 +697,13 @@ vtx_parse_link(const char *str, enum VSL_transaction_e *ptype, *pvxid = vxid; if (i == 2) return (2); - for (j = 0; j < vsl_r__MAX; j++) + for (j = 0; j < VSL_r__MAX; j++) if (!strcmp(reason, vsl_r_names[j])) break; - if (j < vsl_r__MAX) + if (j < VSL_r__MAX) *preason = j; else - *preason = vsl_r_unknown; + *preason = VSL_r_unknown; return (3); } @@ -714,7 +713,7 @@ vtx_scan_begin(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) { int i; enum VSL_transaction_e type; - enum vsl_reason_e reason; + enum VSL_reason_e reason; unsigned p_vxid; struct vtx *p_vtx; @@ -778,7 +777,7 @@ vtx_scan_link(struct VSLQ *vslq, struct vtx *vtx, const uint32_t *ptr) { int i; enum VSL_transaction_e c_type; - enum vsl_reason_e c_reason; + enum VSL_reason_e c_reason; unsigned c_vxid; struct vtx *c_vtx; @@ -913,6 +912,7 @@ vslq_callback(const struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func, trans[0].vxid = vtx->key.vxid; trans[0].vxid_parent = 0; trans[0].type = vtx->type; + trans[0].reason = vtx->reason; trans[0].c = &vtx->c.cursor; i = 1; j = 0; @@ -921,7 +921,7 @@ vslq_callback(const struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func, assert(i < n); (void)vslc_vtx_reset(&vtx->c.cursor); vtxs[i] = vtx; - if (vtx->reason == vsl_r_restart) + if (vtx->reason == VSL_r_restart) /* Restarts stay at the same level as parent */ trans[i].level = trans[j].level; else @@ -929,6 +929,7 @@ vslq_callback(const struct VSLQ *vslq, struct vtx *vtx, VSLQ_dispatch_f *func, trans[i].vxid = vtx->key.vxid; trans[i].vxid_parent = trans[j].vxid; trans[i].type = vtx->type; + trans[i].reason = vtx->reason; trans[i].c = &vtx->c.cursor; i++; } @@ -1063,6 +1064,7 @@ VSLQ_New(struct VSL_data *vsl, struct VSL_cursor **cp, vslq->raw.c.cursor.priv_data = &vslq->raw.c; vslq->raw.trans.level = 0; vslq->raw.trans.type = VSL_t_raw; + vslq->raw.trans.reason = VSL_r_unknown; vslq->raw.trans.c = &vslq->raw.c.cursor; vslq->raw.ptrans[0] = &vslq->raw.trans; vslq->raw.ptrans[1] = NULL; From martin at varnish-software.com Thu Jan 9 14:16:26 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 09 Jan 2014 15:16:26 +0100 Subject: [master] 28479d5 varnishncsa: Don't output anything for a transaction that is restarted Message-ID: commit 28479d51ab0dd9b14c0ab49e0f80bc216ba84460 Author: Martin Blix Grydeland Date: Thu Jan 9 14:57:56 2014 +0100 varnishncsa: Don't output anything for a transaction that is restarted diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index c2656de..a651393 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -731,7 +731,7 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], unsigned tag; const char *b, *e, *p; struct watch *w; - int i; + int i, skip; (void)vsl; (void)priv; @@ -742,7 +742,8 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], continue; CTX.hitmiss = "-"; CTX.handling = "-"; - while ((1 == VSL_Next(t->c))) { + skip = 0; + while (skip == 0 && 1 == VSL_Next(t->c)) { tag = VSL_TAG(t->c->rec.ptr); b = VSL_CDATA(t->c->rec.ptr); e = b + VSL_LEN(t->c->rec.ptr); @@ -808,6 +809,10 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], CTX.handling = "pipe"; } break; + case SLT_VCL_return: + if (!strcasecmp(b, "restart")) + skip = 1; + break; default: break; } @@ -831,6 +836,8 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], if (tag == SLT_RespHeader) process_hdr(&CTX.watch_resphdr, b, e); } + if (skip) + continue; i = print(); if (i) return (i); From martin at varnish-software.com Thu Jan 9 14:16:26 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 09 Jan 2014 15:16:26 +0100 Subject: [master] f499a18 varnishncsa: Don't output ESI subrequests Message-ID: commit f499a18cbf4ddde645bca22f6a3add1bcea372af Author: Martin Blix Grydeland Date: Thu Jan 9 14:59:22 2014 +0100 varnishncsa: Don't output ESI subrequests diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index a651393..1a69003 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -739,6 +739,10 @@ dispatch_f(struct VSL_data *vsl, struct VSL_transaction * const pt[], for (t = pt[0]; t != NULL; t = *++pt) { CTX.gen++; if (t->type != VSL_t_req) + /* Only look at client requests */ + continue; + if (t->reason == VSL_r_esi) + /* Skip ESI requests */ continue; CTX.hitmiss = "-"; CTX.handling = "-"; From martin at varnish-software.com Thu Jan 9 14:16:26 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 09 Jan 2014 15:16:26 +0100 Subject: [master] cc346cd Update documentation of Begin and Link log records Message-ID: commit cc346cd0518635d723f0d35f366e3b08c5d3d9a6 Author: Martin Blix Grydeland Date: Thu Jan 9 15:04:41 2014 +0100 Update documentation of Begin and Link log records diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index b39028a..7fc8c77 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -425,20 +425,22 @@ SLTM(Gzip, 0, "G(un)zip performed on object", SLTM(Link, 0, "Links to a child VXID", "Links this VXID to any child VXID it initiates.\n\n" "The format is::\n\n" - "\t%s %d\n" - "\t| |\n" - "\t| +- Child vxid\n" - "\t+---- Child type (\"req\", \"bereq\" or \"esireq\")\n" + "\t%s %d %s\n" + "\t| | |\n" + "\t| | +- Reason\n" + "\t| +---- Child vxid\n" + "\t+------- Child type (\"req\" or \"bereq\")\n" "\n" ) SLTM(Begin, 0, "Marks the start of a VXID", "The first record of a VXID transaction.\n\n" "The format is::\n\n" - "\t%s %d\n" - "\t| |\n" - "\t| +- Parent vxid\n" - "\t+---- Type (\"sess\", \"req\", \"bereq\" or \"esireq\")\n" + "\t%s %d %s\n" + "\t| | |\n" + "\t| | +- Reason\n" + "\t| +---- Parent vxid\n" + "\t+------- Type (\"sess\", \"req\" or \"bereq\")\n" "\n" ) From phk at FreeBSD.org Fri Jan 10 14:49:03 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 10 Jan 2014 15:49:03 +0100 Subject: [master] ddd00e1 Make vsb's conform to miniobj.h convention Message-ID: commit ddd00e1075c3258602858dffc1ac04d7d4bb4e3f Author: Poul-Henning Kamp Date: Fri Jan 10 14:48:42 2014 +0000 Make vsb's conform to miniobj.h convention Spotted by: daghf diff --git a/include/vsb.h b/include/vsb.h index 555b17f..3734361 100644 --- a/include/vsb.h +++ b/include/vsb.h @@ -37,7 +37,8 @@ * Structure definition */ struct vsb { - unsigned s_magic; + unsigned magic; +#define VSB_MAGIC 0x4a82dd8a char *s_buf; /* storage buffer */ int s_error; /* current error code */ ssize_t s_size; /* size of storage buffer */ diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c index a751046..91a7fa2 100644 --- a/lib/libvarnish/vsb.c +++ b/lib/libvarnish/vsb.c @@ -45,7 +45,6 @@ __FBSDID("$FreeBSD: head/sys/kern/subr_vsb.c 222004 2011-05-17 06:36:32Z phk $") #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ -#define VSB_MAGIC 0x4a82dd8a /* * Predicates */ @@ -84,8 +83,8 @@ _assert_VSB_integrity(const char *fun, const struct vsb *s) (void)s; KASSERT(s != NULL, ("%s called with a NULL vsb pointer", fun)); - KASSERT(s->s_magic == VSB_MAGIC, - ("%s called wih an unintialized vsb pointer", fun)); + KASSERT(s->magic == VSB_MAGIC, + ("%s called wih an bogus vsb pointer", fun)); KASSERT(s->s_buf != NULL, ("%s called with uninitialized or corrupt vsb", fun)); KASSERT(s->s_len < s->s_size, @@ -167,7 +166,7 @@ VSB_newbuf(struct vsb *s, char *buf, int length, int flags) { memset(s, 0, sizeof(*s)); - s->s_magic = VSB_MAGIC; + s->magic = VSB_MAGIC; s->s_flags = flags; s->s_size = length; s->s_buf = buf; From phk at FreeBSD.org Sat Jan 11 19:18:16 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 11 Jan 2014 20:18:16 +0100 Subject: [master] 9dbcdff Constify a couple of largish tables. Message-ID: commit 9dbcdff45325233f00d90efd0a2c350e8ea9cd4a Author: Poul-Henning Kamp Date: Sat Jan 11 19:18:04 2014 +0000 Constify a couple of largish tables. diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index fee24d1..a01360f 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -119,12 +119,12 @@ typedef void VSL_tagfind_f(int tag, void *priv); * priv: The priv argument */ -extern const char *VSL_tags[SLT__MAX]; +extern const char * const VSL_tags[SLT__MAX]; /* * Tag to string array. Contains NULL for invalid tags. */ -extern unsigned VSL_tagflags[SLT__MAX]; +extern const unsigned VSL_tagflags[SLT__MAX]; /* * Tag flags array. */ diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 4bbfc05..3d659f5 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -57,13 +57,13 @@ /*--------------------------------------------------------------------*/ -const char *VSL_tags[SLT__MAX] = { +const char * const VSL_tags[SLT__MAX] = { # define SLTM(foo,flags,sdesc,ldesc) [SLT_##foo] = #foo, # include "tbl/vsl_tags.h" # undef SLTM }; -unsigned VSL_tagflags[SLT__MAX] = { +const unsigned VSL_tagflags[SLT__MAX] = { # define SLTM(foo, flags, sdesc, ldesc) [SLT_##foo] = flags, # include "tbl/vsl_tags.h" # undef SLTM From phk at FreeBSD.org Mon Jan 13 21:49:18 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 13 Jan 2014 22:49:18 +0100 Subject: [master] a16c070 Add a missing but inconsequential free(3). Message-ID: commit a16c0707b59e1cef8aa69245f950debb350ee20b Author: Poul-Henning Kamp Date: Mon Jan 13 20:58:47 2014 +0000 Add a missing but inconsequential free(3). Spotted by: Coverity diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index 66d10ab..8c639b3 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -35,6 +35,7 @@ #include "config.h" #include +#include #include #include #include @@ -96,7 +97,7 @@ static void tcp_keep_probes(void) { int i, s; - struct vss_addr **ta; + struct vss_addr **ta = NULL; /* Probe a dummy socket for default values */ @@ -112,6 +113,7 @@ tcp_keep_probes(void) tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes", 5); tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl", 5); AZ(close(s)); + free(ta); } #endif From phk at FreeBSD.org Mon Jan 13 21:49:18 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 13 Jan 2014 22:49:18 +0100 Subject: [master] 35b9981 Add a testcase for #1406 to -trunk, which is not affected. Message-ID: commit 35b9981b5d79b9350cff10f15a95d28cc3ac0157 Author: Poul-Henning Kamp Date: Mon Jan 13 21:42:41 2014 +0000 Add a testcase for #1406 to -trunk, which is not affected. diff --git a/bin/varnishtest/tests/r01406.vtc b/bin/varnishtest/tests/r01406.vtc new file mode 100644 index 0000000..491f9e9 --- /dev/null +++ b/bin/varnishtest/tests/r01406.vtc @@ -0,0 +1,35 @@ +varnishtest "#1406 empty header" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -arg "-p vcc_allow_inline_c=true" -vcl+backend { + import ${vmod_std} ; + + C{ + static const struct gethdr_s VGC_HDR_REQ_foo = + { HDR_REQ, "\020X-CUSTOM-HEADER:"}; + }C + + sub vcl_recv { + C{ + VRT_SetHdr(ctx, &VGC_HDR_REQ_foo, 0, vrt_magic_string_end ); + }C + } + + sub vcl_deliver { + if (req.http.X-CUSTOM-HEADER) { + set resp.http.foo = "yes"; + } else { + set resp.http.foo = "no"; + } + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == yes +} -run From phk at FreeBSD.org Tue Jan 14 09:46:30 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 14 Jan 2014 10:46:30 +0100 Subject: [master] bb710b1 Tighten various asserts in the expiry code and close what could conceiveably be a race that might be able to cause #1405. Message-ID: commit bb710b14b5362d5b109fa95351fae853c807334b Author: Poul-Henning Kamp Date: Tue Jan 14 09:45:48 2014 +0000 Tighten various asserts in the expiry code and close what could conceiveably be a race that might be able to cause #1405. diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c index 49890bd..0126357 100644 --- a/bin/varnishd/cache/cache_expire.c +++ b/bin/varnishd/cache/cache_expire.c @@ -134,7 +134,8 @@ EXP_Inject(struct objcore *oc, struct lru *lru, double when) CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); - AZ(oc->flags & OC_F_OFFLRU); + AZ(oc->flags & (OC_F_OFFLRU | OC_F_INSERT | OC_F_MOVE)); + AZ(oc->flags & OC_F_DYING); AZ(oc->flags & OC_F_BUSY); if (lru == NULL) @@ -229,9 +230,8 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep) CHECK_OBJ_NOTNULL(o, OBJECT_MAGIC); oc = o->objcore; - if (oc == NULL) - return; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + assert(oc->refcnt > 0); if (!isnan(ttl)) o->exp.ttl = now + ttl - o->exp.t_origin; @@ -280,18 +280,19 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep) int EXP_NukeOne(struct busyobj *bo, struct lru *lru) { - struct objcore *oc; + struct objcore *oc, *oc2; struct objhead *oh; struct object *o; /* Find the first currently unused object on the LRU. */ Lck_Lock(&lru->mtx); - VTAILQ_FOREACH(oc, &lru->lru_head, lru_list) { + VTAILQ_FOREACH_SAFE(oc, &lru->lru_head, lru_list, oc2) { CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); VSLb(bo->vsl, SLT_ExpKill, "LRU_Cand p=%p f=0x%x r=%d", oc, oc->flags, oc->refcnt); + AZ(oc->flags & OC_F_OFFLRU); AZ(oc->flags & OC_F_DYING); /* @@ -310,9 +311,11 @@ EXP_NukeOne(struct busyobj *bo, struct lru *lru) oc->refcnt++; VSC_C_main->n_lru_nuked++; // XXX per lru ? VTAILQ_REMOVE(&lru->lru_head, oc, lru_list); + } else { + oc = NULL; } Lck_Unlock(&oh->mtx); - if (oc->flags & OC_F_DYING) + if (oc != NULL) break; } Lck_Unlock(&lru->mtx); @@ -431,10 +434,12 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, double now) Lck_Lock(&lru->mtx); flags = oc->flags; AN(flags & OC_F_OFFLRU); - oc->flags &= ~(OC_F_INSERT | OC_F_MOVE | OC_F_OFFLRU); + oc->flags &= ~(OC_F_INSERT | OC_F_MOVE); oc->last_lru = now; - if (!(flags & OC_F_DYING)) + if (!(flags & OC_F_DYING)) { VTAILQ_INSERT_TAIL(&lru->lru_head, oc, lru_list); + oc->flags &= ~OC_F_OFFLRU; + } Lck_Unlock(&lru->mtx); if (flags & OC_F_DYING) { @@ -443,8 +448,8 @@ exp_inbox(struct exp_priv *ep, struct objcore *oc, double now) if (!(flags & OC_F_INSERT)) { assert(oc->timer_idx != BINHEAP_NOIDX); binheap_delete(ep->heap, oc->timer_idx); - assert(oc->timer_idx == BINHEAP_NOIDX); } + assert(oc->timer_idx == BINHEAP_NOIDX); (void)HSH_DerefObjCore(&ep->wrk->stats, &oc); return; } From phk at FreeBSD.org Thu Jan 16 10:47:26 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 11:47:26 +0100 Subject: [master] b7e380c Make it possible to avoid -fstack-protector on OmniOS Message-ID: commit b7e380c3e2a2b1df8418879fa16915f38eee24d8 Author: Poul-Henning Kamp Date: Thu Jan 16 10:47:04 2014 +0000 Make it possible to avoid -fstack-protector on OmniOS Submitted by: fgs diff --git a/configure.ac b/configure.ac index ea2039a..a28c9ad 100644 --- a/configure.ac +++ b/configure.ac @@ -465,7 +465,7 @@ AX_CHECK_COMPILE_FLAG([-Werror=unused-result], OCFLAGS="${OCFLAGS} -Wno-unused-result"])]) # This corresponds to FreeBSD's WARNS level 6 -DEVELOPER_CFLAGS="-fstack-protector -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wno-pointer-sign -Wextra -Wno-missing-field-initializers -Wno-sign-compare" +DEVELOPER_CFLAGS="-Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Wnested-externs -Wno-pointer-sign -Wextra -Wno-missing-field-initializers -Wno-sign-compare" # These are not compliable yet DEVELOPER_GCC_CFLAGS="-Wold-style-definition -Wredundant-decls " @@ -476,6 +476,16 @@ DEVELOPER_CLANG_CFLAGS="-Wmissing-variable-declarations -Wno-string-plus-int" # -Wno-empty-body #DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} ${DEVELOPER_CLANG_CFLAGS}" +# --enable-stack-protector +AC_ARG_ENABLE(stack-protector, + AS_HELP_STRING([--enable-stack-protector],[enable stack protector (default is YES)]), + [], + [enable_stack_protector=yes]) + +if test "x$enable_developer_warnings" != "xno"; then + DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -fstack-protector" +fi + # --enable-developer-warnings AC_ARG_ENABLE(developer-warnings, AS_HELP_STRING([--enable-developer-warnings],[enable strict warnings (default is NO)]), From fgsch at varnish-software.com Thu Jan 16 11:14:24 2014 From: fgsch at varnish-software.com (Federico G. Schwindt) Date: Thu, 16 Jan 2014 12:14:24 +0100 Subject: [master] 6cd9149 Fix paste error on my diff so --disable-stack-protector really works Message-ID: commit 6cd9149acdb43a8104332c8f14749839e6c599c4 Author: Federico G. Schwindt Date: Thu Jan 16 11:13:37 2014 +0000 Fix paste error on my diff so --disable-stack-protector really works diff --git a/configure.ac b/configure.ac index a28c9ad..26d58a9 100644 --- a/configure.ac +++ b/configure.ac @@ -482,7 +482,7 @@ AC_ARG_ENABLE(stack-protector, [], [enable_stack_protector=yes]) -if test "x$enable_developer_warnings" != "xno"; then +if test "x$enable_stack_protector" != "xno"; then DEVELOPER_CFLAGS="${DEVELOPER_CFLAGS} -fstack-protector" fi From phk at FreeBSD.org Thu Jan 16 11:20:54 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 12:20:54 +0100 Subject: [master] 05aba58 Inject another BOS_STATE, to tell if we have committed to action in vcl_backend_response{} Message-ID: commit 05aba583a0a911681c08d0b4e54a71248758c84a Author: Poul-Henning Kamp Date: Thu Jan 16 11:20:04 2014 +0000 Inject another BOS_STATE, to tell if we have committed to action in vcl_backend_response{} diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index e733c38..1c0a203 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -502,6 +502,7 @@ oc_getlru(const struct objcore *oc) enum busyobj_state_e { BOS_INVALID = 0, /* don't touch (yet) */ BOS_REQ_DONE, /* beresp.* can be examined */ + BOS_COMITTED, /* beresp.* can be examined */ BOS_FETCHING, /* beresp.* can be examined */ BOS_FINISHED, /* object is complete */ BOS_FAILED, /* something went wrong */ diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 4ee5b97..defba02 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -238,24 +238,25 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) VCL_backend_response_method(bo->vcl, wrk, NULL, bo, bo->beresp->ws); - if (bo->do_esi) - bo->do_stream = 0; - if (bo->do_pass) - bo->fetch_objcore->flags |= OC_F_PASS; - - if (wrk->handling == VCL_RET_DELIVER) - return (do_ims ? F_STP_CONDFETCH : F_STP_FETCH); if (wrk->handling == VCL_RET_RETRY) { - assert(bo->state == BOS_REQ_DONE); bo->retries++; if (bo->retries <= cache_param->max_retries) { VDI_CloseFd(&bo->vbc); return (F_STP_STARTFETCH); } - // XXX: wrk->handling = VCL_RET_SYNTH; + INCOMPL(); } - INCOMPL(); + if (bo->state == BOS_REQ_DONE) + VBO_setstate(bo, BOS_COMITTED); + + if (bo->do_esi) + bo->do_stream = 0; + if (bo->do_pass) + bo->fetch_objcore->flags |= OC_F_PASS; + + assert(wrk->handling == VCL_RET_DELIVER); + return (do_ims ? F_STP_CONDFETCH : F_STP_FETCH); } /*-------------------------------------------------------------------- @@ -454,7 +455,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) if (bo->do_stream) HSH_Unbusy(&wrk->stats, obj->objcore); - if (bo->state == BOS_REQ_DONE) + if (bo->state == BOS_COMITTED) VBO_setstate(bo, BOS_FETCHING); else if (bo->state != BOS_FAILED) WRONG("Wrong bo->state"); From phk at FreeBSD.org Thu Jan 16 13:47:40 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 14:47:40 +0100 Subject: [master] 9c599ba Gah! spell "committed" right. Message-ID: commit 9c599baa245fc2705c10c17a1193ce218c36cace Author: Poul-Henning Kamp Date: Thu Jan 16 12:52:15 2014 +0000 Gah! spell "committed" right. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 1c0a203..baf09a1 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -502,7 +502,7 @@ oc_getlru(const struct objcore *oc) enum busyobj_state_e { BOS_INVALID = 0, /* don't touch (yet) */ BOS_REQ_DONE, /* beresp.* can be examined */ - BOS_COMITTED, /* beresp.* can be examined */ + BOS_COMMITTED, /* beresp.* can be examined */ BOS_FETCHING, /* beresp.* can be examined */ BOS_FINISHED, /* object is complete */ BOS_FAILED, /* something went wrong */ diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index defba02..a1aafcd 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -248,7 +248,7 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) } if (bo->state == BOS_REQ_DONE) - VBO_setstate(bo, BOS_COMITTED); + VBO_setstate(bo, BOS_COMMITTED); if (bo->do_esi) bo->do_stream = 0; @@ -455,7 +455,7 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) if (bo->do_stream) HSH_Unbusy(&wrk->stats, obj->objcore); - if (bo->state == BOS_COMITTED) + if (bo->state == BOS_COMMITTED) VBO_setstate(bo, BOS_FETCHING); else if (bo->state != BOS_FAILED) WRONG("Wrong bo->state"); From phk at FreeBSD.org Thu Jan 16 13:47:40 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 14:47:40 +0100 Subject: [master] c717cf0 Fix double-logging of synth 503 beresp. Message-ID: commit c717cf00dd934123dae12ec1ad4ba65e23bf5476 Author: Poul-Henning Kamp Date: Thu Jan 16 12:57:38 2014 +0000 Fix double-logging of synth 503 beresp. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index a1aafcd..af4d286 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -145,7 +145,6 @@ make_it_503(struct busyobj *bo) { HTTP_Setup(bo->beresp, bo->ws, bo->vsl, SLT_BerespMethod); - http_SetH(bo->beresp, HTTP_HDR_PROTO, "HTTP/1.1"); http_SetResp(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed"); http_SetHeader(bo->beresp, "Content-Length: 0"); http_SetHeader(bo->beresp, "Connection: close"); @@ -193,9 +192,9 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) make_it_503(bo); } else { AN(bo->vbc); + http_VSL_log(bo->beresp); } - http_VSL_log(bo->beresp); /* * These two headers can be spread over multiple actual headers @@ -248,7 +247,7 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) } if (bo->state == BOS_REQ_DONE) - VBO_setstate(bo, BOS_COMMITTED); + VBO_setstate(bo, BOS_COMMITTED); if (bo->do_esi) bo->do_stream = 0; From phk at FreeBSD.org Thu Jan 16 15:15:11 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 16:15:11 +0100 Subject: [master] 2b6f327 Turn the confusion of busyobj flags into a #include table. Message-ID: commit 2b6f3276a105cff0f3c79558ca11b46ceafb0bdb Author: Poul-Henning Kamp Date: Thu Jan 16 15:14:35 2014 +0000 Turn the confusion of busyobj flags into a #include table. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index baf09a1..4f1c550 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -527,8 +527,6 @@ struct busyobj { struct req *req; uint8_t *vary; - unsigned is_gzip; - unsigned is_gunzip; #define N_VFPS 5 vfp_pull_f *vfps[N_VFPS]; @@ -551,18 +549,11 @@ struct busyobj { struct pool_task fetch_task; - unsigned should_close; char *h_content_length; - unsigned do_esi; - unsigned do_gzip; - unsigned do_gunzip; - unsigned do_stream; - - /* do_pass is our intent, uncacheable is the result */ - unsigned do_pass; - unsigned uncacheable; - unsigned abandon; +#define BO_FLAG(l, r, w, d) unsigned l:1; +#include "tbl/bo_flags.h" +#undef BO_FLAG /* Timeouts */ double connect_timeout; diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 8f8f8fd..21dac0b 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -267,13 +267,10 @@ pan_busyobj(const struct busyobj *bo) VSB_printf(pan_vsp, " busyobj = %p {\n", bo); pan_ws(bo->ws, 4); - if (bo->is_gzip) VSB_printf(pan_vsp, " is_gzip\n"); - if (bo->is_gunzip) VSB_printf(pan_vsp, " is_gunzip\n"); - if (bo->do_gzip) VSB_printf(pan_vsp, " do_gzip\n"); - if (bo->do_gunzip) VSB_printf(pan_vsp, " do_gunzip\n"); - if (bo->do_esi) VSB_printf(pan_vsp, " do_esi\n"); - if (bo->do_stream) VSB_printf(pan_vsp, " do_stream\n"); - if (bo->should_close) VSB_printf(pan_vsp, " should_close\n"); +#define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, " is_" #l "\n"); +#include "tbl/bo_flags.h" +#undef BO_FLAG + VSB_printf(pan_vsp, " bodystatus = %d (%s),\n", bo->htc.body_status, body_status_2str(bo->htc.body_status)); VSB_printf(pan_vsp, " },\n"); diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index cb0d42e..607c6f1 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -121,27 +121,31 @@ VRT_DO_STATUS(beresp) /*--------------------------------------------------------------------*/ -#define VBERESP(dir, type, onm, field) \ +#define VBERESPW0(field) +#define VBERESPW1(field) \ void \ -VRT_l_##dir##_##onm(const struct vrt_ctx *ctx, type a) \ +VRT_l_beresp_##field(const struct vrt_ctx *ctx, unsigned a) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ - ctx->bo->field = a; \ -} \ - \ -type \ -VRT_r_##dir##_##onm(const struct vrt_ctx *ctx) \ + ctx->bo->field = a ? 1 : 0; \ +} + +#define VBERESPR0(field) +#define VBERESPR1(field) \ +unsigned \ +VRT_r_beresp_##field(const struct vrt_ctx *ctx) \ { \ CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \ CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC); \ return (ctx->bo->field); \ } -VBERESP(beresp, unsigned, do_esi, do_esi) -VBERESP(beresp, unsigned, do_gzip, do_gzip) -VBERESP(beresp, unsigned, do_gunzip, do_gunzip) -VBERESP(beresp, unsigned, do_stream, do_stream) +#define BO_FLAG(l, r, w, d) \ + VBERESPR##r(l) \ + VBERESPW##r(l) +#include "tbl/bo_flags.h" +#undef BO_FLAG /*--------------------------------------------------------------------*/ diff --git a/include/Makefile.am b/include/Makefile.am index 17633ce..3813836 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -5,6 +5,7 @@ nobase_pkginclude_HEADERS = \ tbl/acct_fields.h \ tbl/backend_poll.h \ tbl/ban_vars.h \ + tbl/bo_flags.h \ tbl/body_status.h \ tbl/debug_bits.h \ tbl/feature_bits.h \ diff --git a/include/tbl/bo_flags.h b/include/tbl/bo_flags.h new file mode 100644 index 0000000..ac52ef7 --- /dev/null +++ b/include/tbl/bo_flags.h @@ -0,0 +1,44 @@ +/*- + * Copyright (c) 2014 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. + * + */ + +/*lint -save -e525 -e539 */ + +/* lower, vcl_r, vcl_w, doc */ +BO_FLAG(do_esi, 1, 1, "") +BO_FLAG(do_gzip, 1, 1, "") +BO_FLAG(do_gunzip, 1, 1, "") +BO_FLAG(do_stream, 1, 1, "") +BO_FLAG(do_pass, 0, 0, "") +BO_FLAG(uncacheable, 0, 0, "") +BO_FLAG(abandon, 0, 0, "") +BO_FLAG(is_gzip, 0, 0, "") +BO_FLAG(is_gunzip, 0, 0, "") +BO_FLAG(should_close, 0, 0, "") + +/*lint -restore */ From phk at FreeBSD.org Thu Jan 16 15:38:49 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 16:38:49 +0100 Subject: [master] a916637 Get a new bereq XID if we retry a fetch Message-ID: commit a91663748a430bba4365aa7fb8f18680b02dea27 Author: Poul-Henning Kamp Date: Thu Jan 16 15:38:27 2014 +0000 Get a new bereq XID if we retry a fetch diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index af4d286..1bdca51 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -157,6 +157,7 @@ static enum fetch_step vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) { int i, do_ims; + unsigned owid, wid; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); @@ -240,6 +241,14 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) if (wrk->handling == VCL_RET_RETRY) { bo->retries++; if (bo->retries <= cache_param->max_retries) { + // XXX: BereqEnd + BereqAcct ? + wid = VXID_Get(&wrk->vxid_pool); + VSLb(bo->vsl, SLT_Link, "bereq %u retry", wid); + VSLb(bo->vsl, SLT_End, "%s", ""); + VSL_Flush(bo->vsl, 0); + owid = bo->vsl->wid & VSL_IDENTMASK; + bo->vsl->wid = wid | VSL_BACKENDMARKER; + VSLb(bo->vsl, SLT_Begin, "bereq %u retry", owid); VDI_CloseFd(&bo->vbc); return (F_STP_STARTFETCH); } From phk at FreeBSD.org Thu Jan 16 17:09:40 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 16 Jan 2014 18:09:40 +0100 Subject: [master] 4b573e1 VFP_Error() is only for use after vcl_backend_response{} has run. Message-ID: commit 4b573e1e62bd7cc1bde50f5c8722b30fcf9c30ef Author: Poul-Henning Kamp Date: Thu Jan 16 17:09:03 2014 +0000 VFP_Error() is only for use after vcl_backend_response{} has run. diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 1bdca51..afc3cce 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -130,7 +130,8 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo) if (wrk->handling == VCL_RET_ABANDON) { if (bo->req != NULL) vbf_release_req(bo); - (void)VFP_Error(bo, "Abandoned in vcl_backend_fetch"); + HSH_Fail(bo->fetch_objcore); + VBO_setstate(bo, BOS_FAILED); return (F_STP_DONE); } assert (wrk->handling == VCL_RET_FETCH); @@ -148,6 +149,9 @@ make_it_503(struct busyobj *bo) http_SetResp(bo->beresp, "HTTP/1.1", 503, "Backend fetch failed"); http_SetHeader(bo->beresp, "Content-Length: 0"); http_SetHeader(bo->beresp, "Connection: close"); + bo->exp.ttl = 0; + bo->exp.grace = 0; + bo->exp.keep = 0; } /*-------------------------------------------------------------------- @@ -156,7 +160,7 @@ make_it_503(struct busyobj *bo) static enum fetch_step vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) { - int i, do_ims; + int i, do_ims, fail; unsigned owid, wid; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); @@ -189,11 +193,12 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) if (i) { AZ(bo->vbc); - (void)VFP_Error(bo, "Failed to fetch object headers"); make_it_503(bo); + fail = 1; } else { AN(bo->vbc); http_VSL_log(bo->beresp); + fail = 0; } @@ -255,8 +260,10 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) INCOMPL(); } - if (bo->state == BOS_REQ_DONE) - VBO_setstate(bo, BOS_COMMITTED); + assert(bo->state == BOS_REQ_DONE); + VBO_setstate(bo, BOS_COMMITTED); + if (fail) + (void)VFP_Error(bo, "Fetch failed"); if (bo->do_esi) bo->do_stream = 0; diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c index 006768d..f104646 100644 --- a/bin/varnishd/cache/cache_fetch_proc.c +++ b/bin/varnishd/cache/cache_fetch_proc.c @@ -61,12 +61,12 @@ VFP_Error(struct busyobj *bo, const char *fmt, ...) va_list ap; CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + assert(bo->state >= BOS_COMMITTED); if (bo->state < BOS_FAILED) { va_start(ap, fmt); VSLbv(bo->vsl, SLT_FetchError, fmt, ap); va_end(ap); - if (bo->fetch_objcore != NULL) - HSH_Fail(bo->fetch_objcore); + HSH_Fail(bo->fetch_objcore); VBO_setstate(bo, BOS_FAILED); } return (VFP_ERROR); From phk at FreeBSD.org Fri Jan 17 10:58:26 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 17 Jan 2014 11:58:26 +0100 Subject: [master] fe85c10 Handle the case where too many retries are attempted, by returning a 503 reply. Message-ID: commit fe85c10c5d2c85a3f8efcfc41d4f57c539cae2d9 Author: Poul-Henning Kamp Date: Fri Jan 17 10:57:56 2014 +0000 Handle the case where too many retries are attempted, by returning a 503 reply. Fixes #1401 diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index afc3cce..f461fa5 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -244,6 +244,8 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) VCL_backend_response_method(bo->vcl, wrk, NULL, bo, bo->beresp->ws); if (wrk->handling == VCL_RET_RETRY) { + if (bo->vbc) + VDI_CloseFd(&bo->vbc); bo->retries++; if (bo->retries <= cache_param->max_retries) { // XXX: BereqEnd + BereqAcct ? @@ -254,10 +256,12 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo) owid = bo->vsl->wid & VSL_IDENTMASK; bo->vsl->wid = wid | VSL_BACKENDMARKER; VSLb(bo->vsl, SLT_Begin, "bereq %u retry", owid); - VDI_CloseFd(&bo->vbc); return (F_STP_STARTFETCH); } - INCOMPL(); + VSLb(bo->vsl, SLT_VCL_Error, + "Too many retries, delivering 503"); + make_it_503(bo); + wrk->handling = VCL_RET_DELIVER; } assert(bo->state == BOS_REQ_DONE); diff --git a/bin/varnishtest/tests/r01401.vtc b/bin/varnishtest/tests/r01401.vtc new file mode 100644 index 0000000..066974d --- /dev/null +++ b/bin/varnishtest/tests/r01401.vtc @@ -0,0 +1,61 @@ +varnishtest "too many retries" + +server s1 { + rxreq + expect req.url == /1 + txresp -hdr "foo: bar" -bodylen 5 + + accept + rxreq + expect req.url == /1 + txresp -hdr "foo: foof" -hdr "Connection: close" -bodylen 7 + + accept + rxreq + expect req.url == /2 + txresp -hdr "foo: bar" -bodylen 10 + + accept + rxreq + expect req.url == /2 + txresp -hdr "foo: bar" -bodylen 11 + + accept + rxreq + expect req.url == /2 + txresp -hdr "foo: bar" -bodylen 12 + + accept + rxreq + expect req.url == /2 + txresp -hdr "foo: bar" -bodylen 13 + + accept + rxreq + expect req.url == /2 + txresp -hdr "foo: bar" -bodylen 4 + +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (beresp.http.foo == "bar") { + return (retry); + } + } +} -start + +client c1 { + txreq -url /1 + rxresp + expect resp.http.foo == foof + expect resp.bodylen == 7 +} -run + +delay .1 + +client c1 { + txreq -url /2 + rxresp + expect resp.status == 503 +} -run From fgsch at lodoss.net Mon Jan 20 12:56:45 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 20 Jan 2014 13:56:45 +0100 Subject: [master] c4e6da1 Fix some typos Message-ID: commit c4e6da14857a2a81842e4e5a3e7a78252255047d Author: Federico G. Schwindt Date: Mon Jan 20 12:53:28 2014 +0000 Fix some typos diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 3b643fc..6cdf3d0 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -203,7 +203,7 @@ vbe_CheckFd(int fd) /*-------------------------------------------------------------------- * Manage a pool of vbc structures. - * XXX: as an experiment, make this caching controled by a parameter + * XXX: as an experiment, make this caching controlled by a parameter * XXX: so we can see if it has any effect. */ diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c index f104646..5f33394 100644 --- a/bin/varnishd/cache/cache_fetch_proc.c +++ b/bin/varnishd/cache/cache_fetch_proc.c @@ -209,7 +209,7 @@ VFP_Fetch_Body(struct busyobj *bo, ssize_t est) */ AN(bo->fetch_objcore->flags & OC_F_PASS); VSLb(bo->vsl, SLT_FetchError, - "Pass delivery abandonned"); + "Pass delivery abandoned"); vfps = VFP_END; bo->should_close = 1; break; diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 11c5c84..42ed08c 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -157,7 +157,7 @@ cnt_deliver(struct worker *wrk, struct req *req) /* * No point in saving the body if it is hit-for-pass, * but we can't yank it until the fetching thread has - * finished/abandonned also. + * finished/abandoned also. */ while (req->obj->objcore->busyobj != NULL) (void)usleep(100000); diff --git a/bin/varnishd/cache/cache_vary.c b/bin/varnishd/cache/cache_vary.c index bfc8686..4402273 100644 --- a/bin/varnishd/cache/cache_vary.c +++ b/bin/varnishd/cache/cache_vary.c @@ -239,7 +239,7 @@ VRY_Prep(struct req *req) } /********************************************************************** - * Finish predictive vary procssing + * Finish predictive vary processing */ void @@ -330,7 +330,7 @@ VRY_Match(struct req *req, const uint8_t *vary) assert(i == 0 || i == 2); } if (i == 0) { - /* Same header, same contents*/ + /* Same header, same contents */ vsp += VRY_Len(vsp); vary += VRY_Len(vary); } else if (i == 2) { From lkarsten at varnish-software.com Tue Jan 21 13:08:04 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 21 Jan 2014 14:08:04 +0100 Subject: [master] b1b777d Ensure present dependency on vsc_fields.h Message-ID: commit b1b777dd4e5b12ff683b9d78cef87fb84f61b470 Author: Lasse Karstensen Date: Tue Jan 21 14:06:50 2014 +0100 Ensure present dependency on vsc_fields.h Patch by: Federico Schwindt diff --git a/man/Makefile.am b/man/Makefile.am index 56b0a52..c4a30ea 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -32,11 +32,11 @@ else @false endif + +varnish-counters.7: vsc2rst $(top_srcdir)/include/tbl/vsc_fields.h if HAVE_RST2MAN -varnish-counters.7: vsc2rst ./vsc2rst | ${RST2MAN} - $@ else -varnish-counters.7: $(top_srcdir)/include/tbl/vsc_fields.h @echo "========================================" @echo "You need rst2man installed to make dist" @echo "========================================" From lkarsten at varnish-software.com Tue Jan 21 15:11:36 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 21 Jan 2014 16:11:36 +0100 Subject: [master] 1f5dded Reflect reality of generated files Message-ID: commit 1f5ddedcd3d6c69cea5d4299378ca1c1d3259c2d Author: Lasse Karstensen Date: Tue Jan 21 16:11:31 2014 +0100 Reflect reality of generated files diff --git a/.gitignore b/.gitignore index cc3ac5c..de715aa 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,8 @@ Makefile.in *.lo *.la *~ +*.sw[op] + # Various auto-tools artifacts /aclocal.m4 @@ -35,8 +37,11 @@ Makefile.in /missing /stamp-h1 /varnishapi.pc +/build-aux TAGS cscope.*out +# +varnishapi-uninstalled.pc # Default vcl made from bin/varnishd/default.vcl /bin/varnishd/default_vcl.h @@ -44,22 +49,37 @@ cscope.*out # Various auto-generated code snippets /include/vcl.h -/include/tbl/vcl_returns.h /include/vrt_obj.h +/include/vmod_abi.h +/include/tbl/vcl_returns.h /include/tbl/vrt_stv_var.h /include/tbl/vcc_types.h /include/vcs_version.h -/lib/libvcl/vcc_fixed_token.c -/lib/libvcl/vcc_obj.c -/lib/libvcl/vcc_token_defs.h -/lib/libvmod_std/vcc_if.c -/lib/libvmod_std/vcc_if.h +/lib/libvcc/vcc_fixed_token.c +/lib/libvcc/vcc_obj.c +/lib/libvcc/vcc_token_defs.h +/lib/libvarnish/vnum_c_test +/lib/libvarnishapi/vxp_fixed_token.c +/lib/libvarnishapi/vxp_tokens.h +/lib/libvarnishapi/vsl2rst +/lib/libvarnishapi/vsl-tags.rst + + +# Misc. generated files for included vmods. +/lib/libvmod_*/vcc_if.c +/lib/libvmod_*/vcc_if.h +/lib/libvmod_*/vmod_*.3 +/lib/libvmod_*/vmod_*.rst + # Man-files and binaries /man/vsc2rst /man/vcl.7 +/man/vsl.7 +/man/vsl-query.7 /man/varnish-cli.7 /man/varnish-counters.7 +/bin/varnish*/varnish*_opt2rst /bin/varnishadm/varnishadm /bin/varnishadm/varnishadm.1 /bin/varnishd/varnishd @@ -68,8 +88,10 @@ cscope.*out /bin/varnishhist/varnishhist.1 /bin/varnishlog/varnishlog /bin/varnishlog/varnishlog.1 +/bin/varnishlog/varnishlog_*.rst /bin/varnishncsa/varnishncsa /bin/varnishncsa/varnishncsa.1 +/bin/varnishncsa/varnishncsa_*.rst /bin/varnishreplay/varnishreplay /bin/varnishreplay/varnishreplay.1 /bin/varnishstat/varnishstat @@ -78,12 +100,12 @@ cscope.*out /bin/varnishtest/varnishtest.1 /bin/varnishtop/varnishtop /bin/varnishtop/varnishtop.1 -/lib/libvmod_std/vmod_std.3 # Doc-stuff generated from xml /doc/*.html /doc/sphinx/=build/ /doc/sphinx/conf.py +/doc/sphinx/reference/vcl_var.rst # NetBeans insists on this /nbproject/private/ From lkarsten at varnish-software.com Tue Jan 21 16:40:11 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 21 Jan 2014 17:40:11 +0100 Subject: [master] d443c4e Update copyright notice Message-ID: commit d443c4e53da1100ac36ba4c24bbb7b1336657f8f Author: Lasse Karstensen Date: Tue Jan 21 17:40:05 2014 +0100 Update copyright notice diff --git a/bin/varnishadm/varnishadm.c b/bin/varnishadm/varnishadm.c index 982fbc2..e1686ad 100644 --- a/bin/varnishadm/varnishadm.c +++ b/bin/varnishadm/varnishadm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Cecilie Fritzvold diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 4f1c550..24c6eab 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c index e56750f..bad4ed9 100644 --- a/bin/varnishd/cache/cache_acceptor.c +++ b/bin/varnishd/cache/cache_acceptor.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 6cdf3d0..3725e89 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h index 9324dfb..c339563 100644 --- a/bin/varnishd/cache/cache_backend.h +++ b/bin/varnishd/cache/cache_backend.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index 63ab402..e5f3198 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_dir.c b/bin/varnishd/cache/cache_dir.c index 5ac4e76..94ef47d 100644 --- a/bin/varnishd/cache/cache_dir.c +++ b/bin/varnishd/cache/cache_dir.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index f461fa5..ebbff7e 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_fetch_proc.c b/bin/varnishd/cache/cache_fetch_proc.c index 5f33394..ea928e4 100644 --- a/bin/varnishd/cache/cache_fetch_proc.c +++ b/bin/varnishd/cache/cache_fetch_proc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 e6f1dc4..e9904b2 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 93d60a9..6c3abbc 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_http1_deliver.c b/bin/varnishd/cache/cache_http1_deliver.c index 974202d..66982b2 100644 --- a/bin/varnishd/cache/cache_http1_deliver.c +++ b/bin/varnishd/cache/cache_http1_deliver.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c index 3adcdc2..89e858b 100644 --- a/bin/varnishd/cache/cache_http1_fetch.c +++ b/bin/varnishd/cache/cache_http1_fetch.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_http1_fsm.c b/bin/varnishd/cache/cache_http1_fsm.c index 46cddb7..3389f6d 100644 --- a/bin/varnishd/cache/cache_http1_fsm.c +++ b/bin/varnishd/cache/cache_http1_fsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c index ef1043e..12a4ba6 100644 --- a/bin/varnishd/cache/cache_http1_proto.c +++ b/bin/varnishd/cache/cache_http1_proto.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 21dac0b..49c6712 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Sm?rgrav diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 42ed08c..ec7713a 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 1a05479..81f5a03 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 4402273..4baa65a 100644 --- a/bin/varnishd/cache/cache_vary.c +++ b/bin/varnishd/cache/cache_vary.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vcl.c b/bin/varnishd/cache/cache_vcl.c index 97e760d..0018095 100644 --- a/bin/varnishd/cache/cache_vcl.c +++ b/bin/varnishd/cache/cache_vcl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 617ef4c..7138da5 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 1248114..d0ecb78 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index 607c6f1..fb2d481 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c index 61e0bd0..70b8d95 100644 --- a/bin/varnishd/cache/cache_vrt_vmod.c +++ b/bin/varnishd/cache/cache_vrt_vmod.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/common/common_vsc.c b/bin/varnishd/common/common_vsc.c index acc8fdd..6981ef1 100644 --- a/bin/varnishd/common/common_vsc.c +++ b/bin/varnishd/common/common_vsc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl index 5240164..676fe2c 100644 --- a/bin/varnishd/default.vcl +++ b/bin/varnishd/default.vcl @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 a72e425..a14e6b2 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 6d58eeb..3c739f1 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 de8d1d8..578bd85 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 8c639b3..5ef6b94 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 70b2dd2..e1cc3c8 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2007-2013 Varnish Software AS + * Copyright (c) 2007-2014 Varnish Software AS * All rights reserved. * * Author: Dag-Erling Sm?rgav diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c index d3d97dc..d14e21b 100644 --- a/bin/varnishd/waiter/cache_waiter.c +++ b/bin/varnishd/waiter/cache_waiter.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishlog/varnishlog.c b/bin/varnishlog/varnishlog.c index 3f6bf9f..259094e 100644 --- a/bin/varnishlog/varnishlog.c +++ b/bin/varnishlog/varnishlog.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishlog/varnishlog_options.c b/bin/varnishlog/varnishlog_options.c index 4b5037d..b12d3e4 100644 --- a/bin/varnishlog/varnishlog_options.c +++ b/bin/varnishlog/varnishlog_options.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishlog/varnishlog_options.h b/bin/varnishlog/varnishlog_options.h index a70793b..aa3bdff 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index 1a69003..f6a5c87 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Anders Berg diff --git a/bin/varnishstat/varnishstat.c b/bin/varnishstat/varnishstat.c index 543b0e3..0971c10 100644 --- a/bin/varnishstat/varnishstat.c +++ b/bin/varnishstat/varnishstat.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishstat/varnishstat.h b/bin/varnishstat/varnishstat.h index 2640fbd..89dee92 100644 --- a/bin/varnishstat/varnishstat.h +++ b/bin/varnishstat/varnishstat.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c index 5cf30a5..2b0137d 100644 --- a/bin/varnishstat/varnishstat_curses.c +++ b/bin/varnishstat/varnishstat_curses.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index 6a0db8f..271540b 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2013 Varnish Software AS + * Copyright (c) 2008-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index cbee6c0..5b18f0b 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2013 Varnish Software AS + * Copyright (c) 2008-2014 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 7eb5cdf..d00ec7c 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2013 Varnish Software AS + * Copyright (c) 2008-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/configure.ac b/configure.ac index 26d58a9..a4e7ec0 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-2013 Varnish Software AS]) +Copyright (c) 2006-2014 Varnish Software AS]) AC_REVISION([$Id$]) AC_INIT([Varnish], [4.0.0-tp1], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst index f4cb33c..fc186cc 100644 --- a/doc/sphinx/reference/varnishlog.rst +++ b/doc/sphinx/reference/varnishlog.rst @@ -80,4 +80,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-2013 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index 3c7aa12..f3b1f50 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -149,4 +149,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-2013 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index cbb06fd..a3a82f2 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -1,4 +1,4 @@ -# Copyright (c) 2012-2013 Varnish Software AS +# Copyright (c) 2012-2014 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/steps.h b/include/tbl/steps.h index e18b7f3..d99738c 100644 --- a/include/tbl/steps.h +++ b/include/tbl/steps.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/symbol_kind.h b/include/tbl/symbol_kind.h index 0a67e12..36f19e5 100644 --- a/include/tbl/symbol_kind.h +++ b/include/tbl/symbol_kind.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 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 927e0fb..53843c6 100644 --- a/include/tbl/vsc_all.h +++ b/include/tbl/vsc_all.h @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h index 32e3a62..9d7da8c 100644 --- a/include/tbl/vsc_f_main.h +++ b/include/tbl/vsc_f_main.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_fields.h b/include/tbl/vsc_fields.h index a523c24..c05d428 100644 --- a/include/tbl/vsc_fields.h +++ b/include/tbl/vsc_fields.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/tbl/vsc_levels.h b/include/tbl/vsc_levels.h index 7e235ca..4a41cfe 100644 --- a/include/tbl/vsc_levels.h +++ b/include/tbl/vsc_levels.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/tbl/vsc_types.h b/include/tbl/vsc_types.h index 9c9d215..22bc127 100644 --- a/include/tbl/vsc_types.h +++ b/include/tbl/vsc_types.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index 7fc8c77..0f4829b 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vapi_options.h b/include/vapi/vapi_options.h index c3cbaa6..46f826f 100644 --- a/include/vapi/vapi_options.h +++ b/include/vapi/vapi_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vapi/voptget.h b/include/vapi/voptget.h index 4f30848..cf39a48 100644 --- a/include/vapi/voptget.h +++ b/include/vapi/voptget.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h index 8ad7057..d0904eb 100644 --- a/include/vapi/vsc.h +++ b/include/vapi/vsc.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 eaee691..dacb2f4 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsl.h b/include/vapi/vsl.h index a01360f..d9a513c 100644 --- a/include/vapi/vsl.h +++ b/include/vapi/vsl.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 1a6f15a..30692ba 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h index 04679b5..d92ab85 100644 --- a/include/vapi/vsm.h +++ b/include/vapi/vsm.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 9305547..11c40e4 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vdef.h b/include/vdef.h index 8fef2b1..5845e2d 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vrt.h b/include/vrt.h index ecf0831..3d465c6 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/include/vut.h b/include/vut.h index 4def288..ba109f4 100644 --- a/include/vut.h +++ b/include/vut.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/include/vut_options.h b/include/vut_options.h index 1d942ed..1f19024 100644 --- a/include/vut_options.h +++ b/include/vut_options.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnish/vtcp.c b/lib/libvarnish/vtcp.c index 989c4c0..2109f20 100644 --- a/lib/libvarnish/vtcp.c +++ b/lib/libvarnish/vtcp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/generate.py b/lib/libvarnishapi/generate.py index 60ec07b..f8cc671 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-2013 Varnish Software AS +# Copyright (c) 2006-2014 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/libvarnishapi.map b/lib/libvarnishapi/libvarnishapi.map index 9c3ba18..0d9bb8d 100644 --- a/lib/libvarnishapi/libvarnishapi.map +++ b/lib/libvarnishapi/libvarnishapi.map @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2013 Varnish Software AS + * Copyright (c) 2011-2014 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen diff --git a/lib/libvarnishapi/vsc.c b/lib/libvarnishapi/vsc.c index 5cce3e9..cd8bdc0 100644 --- a/lib/libvarnishapi/vsc.c +++ b/lib/libvarnishapi/vsc.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 3d659f5..b9455db 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vsl2rst.c b/lib/libvarnishapi/vsl2rst.c index 6992420..c049fab 100644 --- a/lib/libvarnishapi/vsl2rst.c +++ b/lib/libvarnishapi/vsl2rst.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2013 Varnish Software AS + * Copyright (c) 2011-2014 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 b3199bb..6dacff3 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 880ac44..376b056 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 ea9633c..7dcd7d5 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 b4fdc59..5ff57e3 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 495e00b..6136115 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c index c62858d..f036d99 100644 --- a/lib/libvarnishapi/vsm.c +++ b/lib/libvarnishapi/vsm.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 7431eed..dc1430b 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c index b1c8c2f..c16de97 100644 --- a/lib/libvarnishapi/vxp.c +++ b/lib/libvarnishapi/vxp.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishapi/vxp.h b/lib/libvarnishapi/vxp.h index 1e773a5..eb21031 100644 --- a/lib/libvarnishapi/vxp.h +++ b/lib/libvarnishapi/vxp.h @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 076edaa..cb2bff9 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 6fc726b..3b9e1d0 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishtools/opt2rst.c b/lib/libvarnishtools/opt2rst.c index 68d5200..efaf10c 100644 --- a/lib/libvarnishtools/opt2rst.c +++ b/lib/libvarnishtools/opt2rst.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c index 708f46f..4ca7fbc 100644 --- a/lib/libvarnishtools/vut.c +++ b/lib/libvarnishtools/vut.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2013 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Martin Blix Grydeland diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py index d7b0de9..dbffe99 100755 --- a/lib/libvcc/generate.py +++ b/lib/libvcc/generate.py @@ -1,7 +1,7 @@ #!/usr/local/bin/python3.1 #- # Copyright (c) 2006 Verdens Gang AS -# Copyright (c) 2006-2013 Varnish Software AS +# Copyright (c) 2006-2014 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c index 99f97eb..7e9bf2e 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 ab0d8b2..7c079a9 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 7fa31aa..91ea4c9 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 07dbbf3..bdfda05 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 500f87e..dab1131 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 4f2b99b..bfcc2d5 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-2013 Varnish Software AS + * Copyright (c) 2006-2014 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 98ffeb2..ac88b59 100644 --- a/lib/libvcc/vcc_vmod.c +++ b/lib/libvcc/vcc_vmod.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 6249b36..4c00c32 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -1,6 +1,6 @@ #!/usr/bin/env python #- -# Copyright (c) 2010-2013 Varnish Software AS +# Copyright (c) 2010-2014 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index f24c302..8d2919e 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -1,5 +1,5 @@ # -# Copyright (c) 2010-2013 Varnish Software AS +# Copyright (c) 2010-2014 Varnish Software AS # All rights reserved. # # Author: Poul-Henning Kamp diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 4031e6e..46811d6 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2012-2013 Varnish Software AS + * Copyright (c) 2012-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/lib/libvmod_std/vmod.vcc b/lib/libvmod_std/vmod.vcc index 31d25e5..1a66dbd 100644 --- a/lib/libvmod_std/vmod.vcc +++ b/lib/libvmod_std/vmod.vcc @@ -1,5 +1,5 @@ #- -# Copyright (c) 2010-2013 Varnish Software AS +# Copyright (c) 2010-2014 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 d0ec3d3..7301559 100644 --- a/lib/libvmod_std/vmod_std.c +++ b/lib/libvmod_std/vmod_std.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 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 822bb75..f9cba84 100644 --- a/lib/libvmod_std/vmod_std_conversions.c +++ b/lib/libvmod_std/vmod_std_conversions.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010-2013 Varnish Software AS + * Copyright (c) 2010-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/man/vsc2rst.c b/man/vsc2rst.c index 62b8131..96500bf 100644 --- a/man/vsc2rst.c +++ b/man/vsc2rst.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011-2013 Varnish Software AS + * Copyright (c) 2011-2014 Varnish Software AS * All rights reserved. * * Author: Tollef Fog Heen From lkarsten at varnish-software.com Tue Jan 21 16:47:31 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 21 Jan 2014 17:47:31 +0100 Subject: [master] 35a0024 Only match this on the root Message-ID: commit 35a0024022ade8b7c4a7b86980ee1f6355cc7516 Author: Lasse Karstensen Date: Tue Jan 21 17:47:29 2014 +0100 Only match this on the root diff --git a/.gitignore b/.gitignore index de715aa..052b411 100644 --- a/.gitignore +++ b/.gitignore @@ -41,7 +41,7 @@ Makefile.in TAGS cscope.*out # -varnishapi-uninstalled.pc +/varnishapi-uninstalled.pc # Default vcl made from bin/varnishd/default.vcl /bin/varnishd/default_vcl.h From tfheen at varnish-software.com Wed Jan 22 09:41:39 2014 From: tfheen at varnish-software.com (Tollef Fog Heen) Date: Wed, 22 Jan 2014 10:41:39 +0100 Subject: [master] b2fb19f Document changes for 3.0.5 rc Message-ID: commit b2fb19f5fb23430f2bf821c72d80c774aea32f1b Author: Tollef Fog Heen Date: Fri Nov 15 11:22:58 2013 +0100 Document changes for 3.0.5 rc diff --git a/doc/changes.rst b/doc/changes.rst index b16afc6..04eaecc 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,4 +1,41 @@ ================================ +Changes from 3.0.4 to 3.0.5 rc 1 +================================ + +varnishd +-------- + +- Stop printing error messages on ESI parse errors +- Fix a problem where Varnish would segfault if the first part of a + synthetic page was NULL. `Bug #1287` +- If streaming was used, you could in some cases end up with duplicate + content headers being sent to clients. `Bug #1272` +- If we receive a completely garbled request, don't pass through + vcl_error, since we could then end up in vcl_recv through a restart + and things would go downhill from there. `Bug #1367` +- Prettify backtraces on panic slightly. + +.. _bug #1287: http://varnish-cache.org/trac/ticket/1287 +.. _bug #1272: http://varnish-cache.org/trac/ticket/1272 +.. _bug #1367: http://varnish-cache.org/trac/ticket/1367 + +varnishlog +---------- + +- Correct an error where -m, -c and -b would interact badly, leading + to lack of matches. Also, emit BackendXID to signify the start of a + transaction. `Bug #1325` + +.. _bug #1325: http://varnish-cache.org/trac/ticket/1325 + +varnishadm +---------- + +- Handle input from stdin properly. `Bug #1314` + +.. _bug #1314: http://varnish-cache.org/trac/ticket/1314 + +================================ Changes from 3.0.4 rc 1 to 3.0.4 ================================ From tfheen at varnish-software.com Wed Jan 22 09:41:39 2014 From: tfheen at varnish-software.com (Tollef Fog Heen) Date: Wed, 22 Jan 2014 10:41:39 +0100 Subject: [master] b71bdbb Changes for 3.0.5 Message-ID: commit b71bdbbe344ec5e86cfa7af06f3049b35023df3e Author: Tollef Fog Heen Date: Mon Dec 2 09:01:15 2013 +0100 Changes for 3.0.5 diff --git a/doc/changes.rst b/doc/changes.rst index 04eaecc..0261772 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,4 +1,16 @@ ================================ +Changes from 3.0.5 rc 1 to 3.0.5 +================================ + +varnishd +-------- + +- Always check the local address of a socket. This avoids a crash if + server.ip is accessed after a client has closed the connection. `Bug #1376` + +.. _bug #1376: http://varnish-cache.org/trac/ticket/1376 + +================================ Changes from 3.0.4 to 3.0.5 rc 1 ================================ From fgsch at lodoss.net Wed Jan 22 09:53:29 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 22 Jan 2014 10:53:29 +0100 Subject: [master] e2e7e3a Add missing dependency on rt Message-ID: commit e2e7e3a23ce035bb8b5f6a670d2f92b400839d7e Author: Federico G. Schwindt Date: Wed Jan 22 09:50:30 2014 +0000 Add missing dependency on rt diff --git a/lib/libvarnishapi/Makefile.am b/lib/libvarnishapi/Makefile.am index fce096d..9c96d39 100644 --- a/lib/libvarnishapi/Makefile.am +++ b/lib/libvarnishapi/Makefile.am @@ -42,7 +42,7 @@ libvarnishapi_la_SOURCES = \ libvarnishapi_la_CFLAGS = \ -DVARNISH_STATE_DIR='"${VARNISH_STATE_DIR}"' -libvarnishapi_la_LIBADD = @PCRE_LIBS@ +libvarnishapi_la_LIBADD = @PCRE_LIBS@ @RT_LIBS@ if HAVE_LD_VERSION_SCRIPT libvarnishapi_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libvarnishapi.map From lkarsten at varnish-software.com Wed Jan 22 11:40:46 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 22 Jan 2014 12:40:46 +0100 Subject: [master] 41488c0 Clarify that this output isn't build critical Message-ID: commit 41488c083b5acdf8724c15be06a3177735152e03 Author: Lasse Karstensen Date: Wed Jan 22 12:40:15 2014 +0100 Clarify that this output isn't build critical diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 4c00c32..5b8672a 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -668,7 +668,7 @@ class file_section(object): raise Exception("Unknown keyword: " + t.str) assert len(self.tl) == 0 if o == None: - print("NB:") + print("Warning:") print("%s description is not included in .rst:" %t0) for ln,i in self.l: print("\t", i) From lkarsten at varnish-software.com Wed Jan 22 13:09:39 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 22 Jan 2014 14:09:39 +0100 Subject: [master] 0d7ca45 Some additional files from make check Message-ID: commit 0d7ca453ae84019596140a934e7d8a126239a3c7 Author: Lasse Karstensen Date: Wed Jan 22 14:09:11 2014 +0100 Some additional files from make check diff --git a/.gitignore b/.gitignore index 052b411..f545294 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,8 @@ cscope.*out /lib/libvcc/vcc_obj.c /lib/libvcc/vcc_token_defs.h /lib/libvarnish/vnum_c_test +/lib/libvarnish/vnum_c_test.log +/lib/libvarnish/test-suite.log /lib/libvarnishapi/vxp_fixed_token.c /lib/libvarnishapi/vxp_tokens.h /lib/libvarnishapi/vsl2rst @@ -111,6 +113,6 @@ cscope.*out /nbproject/private/ # Test droppings -bin/varnishtest/tests/*.log -bin/varnishtest/tests/*.log-t -bin/varnishtest/test-suite.log +/bin/varnishtest/tests/*.log +/bin/varnishtest/tests/*.log-t +/bin/varnishtest/test-suite.log From lkarsten at varnish-software.com Wed Jan 22 13:09:39 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 22 Jan 2014 14:09:39 +0100 Subject: [master] 8d5b61a Prepare for a 4.0-TP2 release Message-ID: commit 8d5b61abb75b402d492c5cac25b01410d7f79614 Author: Lasse Karstensen Date: Wed Jan 22 14:09:36 2014 +0100 Prepare for a 4.0-TP2 release diff --git a/configure.ac b/configure.ac index a4e7ec0..e22fc4e 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.0.0-tp1], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.0.0-tp2], [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 26e7450..8d7a1df 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -1,4 +1,4 @@ -%define v_rc tp1 +%define v_rc tp2 %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 From lkarsten at varnish-software.com Wed Jan 22 14:13:51 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 22 Jan 2014 15:13:51 +0100 Subject: [master] d617d9f Add VCL 4.0 marker in default.vcl. Message-ID: commit d617d9f8d8244843cd9f48e9bd1da04c0b796119 Author: Lasse Karstensen Date: Wed Jan 22 15:11:20 2014 +0100 Add VCL 4.0 marker in default.vcl. Fixes: #1413 diff --git a/etc/Makefile.am b/etc/Makefile.am index e724822..f1db501 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -6,7 +6,7 @@ DISTCLEANFILES = default.vcl dist_varnishconf_DATA = default.vcl default.vcl: $(top_srcdir)/bin/varnishd/default.vcl - ( printf "This is a basic VCL configuration file for varnish. See the vcl(7)\n\ + ( printf "vcl 4.0;\nThis is a basic VCL configuration file for varnish. See the vcl(7)\n\ man page for details on VCL syntax and semantics.\n\ \n\ Default backend definition. Set this to point to your content\n\ From lkarsten at varnish-software.com Wed Jan 22 16:27:21 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 22 Jan 2014 17:27:21 +0100 Subject: [master] b61f3ab Add changes 4.0.0TP1->TP2 Message-ID: commit b61f3ab88756ee235e712c71063a9450a2dc07d2 Author: Lasse Karstensen Date: Wed Jan 22 15:32:25 2014 +0100 Add changes 4.0.0TP1->TP2 diff --git a/doc/changes.rst b/doc/changes.rst index 0261772..a54bae0 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,3 +1,58 @@ +=================================== +Changes from 4.0.0 TP1 to 4.0.0 TP2 +=================================== + +New since from 4.0.0 TP1 +------------------------ + +- New VCL_BLOB type to pass binary data between VMODs. +- New format for VMOD description files. (.vcc) + +Bugs fixed +---------- +* 1404_ - Don't send Content-Length on 304 Not Modified responses. +* 1401_ - Varnish would crash when retrying a backend fetch too many times. +* 1399_ - Memory get freed while in use by another thread/object +* 1398_ - Fix NULL deref related to a backend we don't know any more. +* 1397_ - Crash on backend fetch while LRUing. (scoof: please add details if you have them) +* 1395_ - End up in vcl_error also if fetch fails vcl_backend_response. +* 1391_ - Client abort and retry during a streaming fetch would make Varnish assert. +* 1390_ - Fix assert if the ban lurker is overtaken by new duplicate bans. +* 1385_ - ban lurker doesn't remove (G)one bans +* 1383_ - varnishncsa logs requests for localhost regardless of host header. +* 1382_ - varnishncsa prints nulls as part of request string. +* 1381_ - Ensure vmod_director is installed +* 1323_ - Add a missing boundary check for Range requests +* 1268_ - shortlived parameter now uses TTL+grace+keep instead of just TTL. + +* Fix build error on OpenBSD (TCP_KEEP) +* n_object wasn't being decremented correctly on object expire. +* Example default.vcl in distribution is now 4.0-ready. + +Open issues +----------- + +* 1405_ - Ban lurker does not always evict all objects. + + +.. _1405: https://www.varnish-cache.org/trac/ticket/1405 +.. _1404: https://www.varnish-cache.org/trac/ticket/1404 +.. _1401: https://www.varnish-cache.org/trac/ticket/1401 +.. _1399: https://www.varnish-cache.org/trac/ticket/1399 +.. _1398: https://www.varnish-cache.org/trac/ticket/1398 +.. _1397: https://www.varnish-cache.org/trac/ticket/1397 +.. _1395: https://www.varnish-cache.org/trac/ticket/1395 +.. _1391: https://www.varnish-cache.org/trac/ticket/1391 +.. _1390: https://www.varnish-cache.org/trac/ticket/1390 +.. _1385: https://www.varnish-cache.org/trac/ticket/1385 +.. _1383: https://www.varnish-cache.org/trac/ticket/1383 +.. _1382: https://www.varnish-cache.org/trac/ticket/1382 +.. _1381: https://www.varnish-cache.org/trac/ticket/1381 +.. _1323: https://www.varnish-cache.org/trac/ticket/1323 +.. _1268: https://www.varnish-cache.org/trac/ticket/1268 +.. _1268: https://www.varnish-cache.org/trac/ticket/1268 + + ================================ Changes from 3.0.5 rc 1 to 3.0.5 ================================ From fgsch at lodoss.net Wed Jan 22 18:23:49 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 22 Jan 2014 19:23:49 +0100 Subject: [master] acd951d Revert "Ensure present dependency on vsc_fields.h" Message-ID: commit acd951d2e1fbf76ee36303e31b242811b56b6679 Author: Federico G. Schwindt Date: Wed Jan 22 18:15:42 2014 +0000 Revert "Ensure present dependency on vsc_fields.h" The dependency is defined as part of vsc2rst_SOURCES. This reverts commit b1b777d. diff --git a/man/Makefile.am b/man/Makefile.am index c4a30ea..56b0a52 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -32,11 +32,11 @@ else @false endif - -varnish-counters.7: vsc2rst $(top_srcdir)/include/tbl/vsc_fields.h if HAVE_RST2MAN +varnish-counters.7: vsc2rst ./vsc2rst | ${RST2MAN} - $@ else +varnish-counters.7: $(top_srcdir)/include/tbl/vsc_fields.h @echo "========================================" @echo "You need rst2man installed to make dist" @echo "========================================" From fgsch at lodoss.net Wed Jan 22 20:02:56 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 22 Jan 2014 21:02:56 +0100 Subject: [master] b95b418 obj.lastuse has been renamed to obj.last_use Message-ID: commit b95b41888e18ec85bd3b8ee8769d8402105ead1f Author: Federico G. Schwindt Date: Wed Jan 22 20:00:20 2014 +0000 obj.lastuse has been renamed to obj.last_use Update vcl(7) and default.vcl diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl index 676fe2c..8e8fa26 100644 --- a/bin/varnishd/default.vcl +++ b/bin/varnishd/default.vcl @@ -144,7 +144,7 @@ sub vcl_deliver { * Enable them only if you need them. * * set obj.hits = obj.hits + 1; - * set obj.lastuse = now; + * set obj.last_use = now; */ return (deliver); } diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index a99f2eb..8a3ee2c 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -824,7 +824,7 @@ obj.response obj.ttl The object's remaining time to live, in seconds. obj.ttl is writable. -obj.lastuse +obj.last_use The approximate time elapsed since the object was last requests, in seconds. This variable is also available in vcl_deliver. From lkarsten at varnish-software.com Thu Jan 23 09:30:12 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 10:30:12 +0100 Subject: [master] df50277 Remove comment that never should have been commited Message-ID: commit df50277d1ac0af9ba1b0e03269e81dd1acaae06e Author: Lasse Karstensen Date: Thu Jan 23 10:29:22 2014 +0100 Remove comment that never should have been commited diff --git a/doc/changes.rst b/doc/changes.rst index a54bae0..25d655a 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -14,7 +14,7 @@ Bugs fixed * 1401_ - Varnish would crash when retrying a backend fetch too many times. * 1399_ - Memory get freed while in use by another thread/object * 1398_ - Fix NULL deref related to a backend we don't know any more. -* 1397_ - Crash on backend fetch while LRUing. (scoof: please add details if you have them) +* 1397_ - Crash on backend fetch while LRUing. * 1395_ - End up in vcl_error also if fetch fails vcl_backend_response. * 1391_ - Client abort and retry during a streaming fetch would make Varnish assert. * 1390_ - Fix assert if the ban lurker is overtaken by new duplicate bans. From lkarsten at varnish-software.com Thu Jan 23 09:30:12 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 10:30:12 +0100 Subject: [master] 91518ad Import fresh devicedetect.vcl Message-ID: commit 91518ade7438da61c393e8b7cf215ffb0c40b4c7 Author: Lasse Karstensen Date: Thu Jan 23 10:30:06 2014 +0100 Import fresh devicedetect.vcl diff --git a/etc/devicedetect.vcl b/etc/devicedetect.vcl index a3a82f2..1606628 100644 --- a/etc/devicedetect.vcl +++ b/etc/devicedetect.vcl @@ -51,15 +51,21 @@ 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/ */ + 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 ~ "Mobile.+Firefox") { set req.http.X-UA-Device = "mobile-firefoxos"; } elsif (req.http.User-Agent ~ "^HTC" || req.http.User-Agent ~ "Fennec" || req.http.User-Agent ~ "IEMobile" || req.http.User-Agent ~ "BlackBerry" || - req.http.User-Agent ~ "SymbianOS.*AppleWebKit" || - req.http.User-Agent ~ "Opera Mobi") { + req.http.User-Agent ~ "BB10.*Mobile" || + req.http.User-Agent ~ "GT-.*Build/GINGERBREAD" || + req.http.User-Agent ~ "SymbianOS.*AppleWebKit") { set req.http.X-UA-Device = "mobile-smartphone"; } elsif (req.http.User-Agent ~ "(?i)symbian" || From lkarsten at varnish-software.com Thu Jan 23 10:25:20 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 11:25:20 +0100 Subject: [master] b0d9950 Remove Zope/Plone example VCL Message-ID: commit b0d9950b4151871877542ba28460f43bd243fd86 Author: Lasse Karstensen Date: Thu Jan 23 11:22:21 2014 +0100 Remove Zope/Plone example VCL We don't have a maintainer for this, and it hasn't been updated for a while. In general we use the Wiki for linking to or referencing backend-specific configuration. diff --git a/etc/zope-plone.vcl b/etc/zope-plone.vcl deleted file mode 100644 index de599dd..0000000 --- a/etc/zope-plone.vcl +++ /dev/null @@ -1,97 +0,0 @@ -# -# This is an example VCL configuration file for varnish, meant for the -# Plone CMS running within Zope. It defines a "default" backend for -# serving static content from a normal web server, and a "zope" -# backend for requests to the Zope CMS -# -# See the vcl(7) man page for details on VCL syntax and semantics. -# -# $Id$ -# - -# Default backend definition. Set this to point to your content -# server. - -# Default backend is the Zope CMS -backend default { - .host = "127.0.0.1"; - .port = "9673"; -} - -acl purge { - "localhost"; - "192.0.2.0"/24; -} - -sub vcl_recv { - - # Normalize host headers, and do rewriting for the zope sites. Reject - # requests for unknown hosts - if (req.http.host ~ "(www.)?example.com") { - set req.http.host = "example.com"; - set req.url = "/VirtualHostBase/http/example.com:80/example.com/VirtualHostRoot" + req.url; - } elsif (req.http.host ~ "(www.)?example.org") { - set req.http.host = "example.org"; - set req.url = "/VirtualHostBase/http/example.org:80/example.org/VirtualHostRoot" + req.url; - } else { - error 404 "Unknown virtual host."; - } - - # Handle special requests - if (req.method != "GET" && req.method != "HEAD") { - - # POST - Logins and edits - if (req.method == "POST") { - return(pass); - } - - # PURGE - The CacheFu product can invalidate updated URLs - if (req.method == "PURGE") { - if (!client.ip ~ purge) { - error 405 "Not allowed."; - } - return(lookup); - } - - # Do not cache the creation of objects in Plone - if (req.url ~ "createObject"){ - return(pass); - } - } - - # Don't cache authenticated requests - if (req.http.Cookie && req.http.Cookie ~ "__ac(|_(name|password|persistent))=") { - - # Force lookup of specific urls unlikely to need protection - if (req.url ~ "\.(js|css|kss)") { - remove req.http.cookie; - return(lookup); - } - return(pass); - } - - # The default vcl_recv is used from here. - } - -# Do the PURGE thing -sub vcl_hit { - if (req.method == "PURGE") { - purge; - error 200 "Purged"; - } -} -sub vcl_miss { - if (req.method == "PURGE") { - purge; - error 200 "Purged"; - } -} - -# Enforce a minimum TTL, since we can PURGE changed objects actively -# from Zope by using the CacheFu product - -sub vcl_response { - if (beresp.ttl < 3600s) { - set beresp.ttl = 3600s; - } -} From lkarsten at varnish-software.com Thu Jan 23 12:20:00 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 13:20:00 +0100 Subject: [master] 47dd3c6 Forgotten references to (deleted) zope-plone.vcl Message-ID: commit 47dd3c6706a514927436ff4e0082dab904ee8870 Author: Lasse Karstensen Date: Thu Jan 23 13:18:28 2014 +0100 Forgotten references to (deleted) zope-plone.vcl Initial commit in b0d9950. Thanks to Federico Schwindt for pointing this out. diff --git a/etc/Makefile.am b/etc/Makefile.am index f1db501..2fb4d38 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,6 +1,5 @@ # -EXTRA_DIST = zope-plone.vcl DISTCLEANFILES = default.vcl dist_varnishconf_DATA = default.vcl diff --git a/redhat/varnish.spec b/redhat/varnish.spec index 8d7a1df..eaf92f3 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -87,7 +87,7 @@ Documentation files for %name #%setup -q -n varnish-trunk mkdir examples -cp bin/varnishd/default.vcl etc/zope-plone.vcl examples +cp bin/varnishd/default.vcl examples %build # No pkgconfig/libpcre.pc in rhel4 From lkarsten at varnish-software.com Thu Jan 23 12:58:34 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 13:58:34 +0100 Subject: [master] 7653bfc Disabling flaky test for now. Message-ID: commit 7653bfc703436fd374d91353651e7451f4e1ba5f Author: Lasse Karstensen Date: Thu Jan 23 13:57:46 2014 +0100 Disabling flaky test for now. Filed bug report #1414 on it. diff --git a/bin/varnishtest/tests.disabled/r01391.vtc b/bin/varnishtest/tests.disabled/r01391.vtc new file mode 100644 index 0000000..4b98fda --- /dev/null +++ b/bin/varnishtest/tests.disabled/r01391.vtc @@ -0,0 +1,39 @@ +varnishtest "client abandoning hit-for-pass" + + +server s1 { + rxreq + txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Set-Cookie: foo=bar" + chunked "foo" + sema r1 sync 2 + chunked "bar" + delay .1 + chunkedlen 64 + delay .1 + chunkedlen 64 + chunkedlen 0 +} -start + +varnish v1 -vcl+backend { +} -start + + +client c1 { + txreq + rxhdrs + rxchunk + sema r1 sync 2 +} -run + +delay 2 + +server s1 { + rxreq + txresp +} -start + +client c1 { + txreq + rxresp + expect resp.status == 200 +} -run diff --git a/bin/varnishtest/tests/r01391.vtc b/bin/varnishtest/tests/r01391.vtc deleted file mode 100644 index 4b98fda..0000000 --- a/bin/varnishtest/tests/r01391.vtc +++ /dev/null @@ -1,39 +0,0 @@ -varnishtest "client abandoning hit-for-pass" - - -server s1 { - rxreq - txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Set-Cookie: foo=bar" - chunked "foo" - sema r1 sync 2 - chunked "bar" - delay .1 - chunkedlen 64 - delay .1 - chunkedlen 64 - chunkedlen 0 -} -start - -varnish v1 -vcl+backend { -} -start - - -client c1 { - txreq - rxhdrs - rxchunk - sema r1 sync 2 -} -run - -delay 2 - -server s1 { - rxreq - txresp -} -start - -client c1 { - txreq - rxresp - expect resp.status == 200 -} -run From lkarsten at varnish-software.com Thu Jan 23 13:21:19 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 23 Jan 2014 14:21:19 +0100 Subject: [master] a455f84 This file is gone from upstream Message-ID: commit a455f84ba605b81c801df5697fc9e6063058a308 Author: Lasse Karstensen Date: Thu Jan 23 14:20:18 2014 +0100 This file is gone from upstream diff --git a/varnish.examples b/varnish.examples index caae8a5..5dd46eb 100644 --- a/varnish.examples +++ b/varnish.examples @@ -1,2 +1 @@ -etc/zope-plone.vcl bin/varnishd/default.vcl From phk at FreeBSD.org Thu Jan 23 22:23:45 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 23 Jan 2014 23:23:45 +0100 Subject: [master] d9cc0a7 Fix a improbable memory leak. Message-ID: commit d9cc0a700b9777b2a8ea192df1063c33e59caef5 Author: Poul-Henning Kamp Date: Thu Jan 23 22:23:26 2014 +0000 Fix a improbable memory leak. diff --git a/bin/varnishd/mgt/mgt_param_tcp.c b/bin/varnishd/mgt/mgt_param_tcp.c index 5ef6b94..8f107e3 100644 --- a/bin/varnishd/mgt/mgt_param_tcp.c +++ b/bin/varnishd/mgt/mgt_param_tcp.c @@ -106,13 +106,12 @@ tcp_keep_probes(void) return; // XXX: log assert (i > 0); s = VSS_listen(ta[0], 10); - if (s < 0) - return; // XXX: log - - tcp_probe(s, TCP_KEEPIDLE, "tcp_keepalive_time", 600); - tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes", 5); - tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl", 5); - AZ(close(s)); + if (s >= 0) { + tcp_probe(s, TCP_KEEPIDLE, "tcp_keepalive_time", 600); + tcp_probe(s, TCP_KEEPCNT, "tcp_keepalive_probes", 5); + tcp_probe(s, TCP_KEEPINTVL, "tcp_keepalive_intvl", 5); + AZ(close(s)); + } free(ta); } #endif From lkarsten at varnish-software.com Mon Jan 27 11:07:05 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:07:05 +0100 Subject: [master] 3a308c3 Rename default.vcl to builtin.vcl. Message-ID: commit 3a308c36d471f38e338502253e198bac98128774 Author: Lasse Karstensen Date: Mon Jan 27 11:20:23 2014 +0100 Rename default.vcl to builtin.vcl. The default.vcl name was thought up in 2007 and have been a point of confusion since. New users take the old default VCL, uncomment what they think makes sense, and always end with return(lookup) because that seems to be needed. But it isn't, and the defaults in the built-in VCL are much better at handling all things they haven't learned about yet. diff --git a/.gitignore b/.gitignore index f545294..78cdba5 100644 --- a/.gitignore +++ b/.gitignore @@ -44,8 +44,8 @@ cscope.*out /varnishapi-uninstalled.pc # Default vcl made from bin/varnishd/default.vcl -/bin/varnishd/default_vcl.h -/etc/default.vcl +/bin/varnishd/builtin_vcl.h +/etc/builtin.vcl # Various auto-generated code snippets /include/vcl.h diff --git a/bin/varnishd/Makefile.am b/bin/varnishd/Makefile.am index 9d281f1..e0a8461 100644 --- a/bin/varnishd/Makefile.am +++ b/bin/varnishd/Makefile.am @@ -93,7 +93,7 @@ noinst_HEADERS = \ cache/cache_backend.h \ cache/cache_esi.h \ common/heritage.h \ - default_vcl.h \ + builtin_vcl.h \ hash/hash_slinger.h \ mgt/mgt.h \ mgt/mgt_cli.h \ @@ -126,26 +126,26 @@ varnishd_LDADD = \ @PCRE_LIBS@ \ ${DL_LIBS} ${PTHREAD_LIBS} ${NET_LIBS} ${LIBM} ${LIBUMEM} -EXTRA_DIST = default.vcl -DISTCLEANFILES = default_vcl.h +EXTRA_DIST = builtin.vcl +DISTCLEANFILES = builtin_vcl.h # -# Turn the default.vcl file into a C-string we can include in the program. +# Turn the builtin.vcl file into a C-string we can include in the program. # -default_vcl.h: default.vcl +builtin_vcl.h: builtin.vcl echo '/*' > $@ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@ echo ' *' >> $@ - echo ' * Edit default.vcl instead and run make' >> $@ + echo ' * Edit builtin.vcl instead and run make' >> $@ echo ' *' >> $@ echo ' */' >> $@ echo '' >> $@ sed -e 's/"/\\"/g' \ -e 's/$$/\\n"/' \ - -e 's/^/ "/' $(srcdir)/default.vcl >> $@ + -e 's/^/ "/' $(srcdir)/builtin.vcl >> $@ # Explicitly record dependency -mgt/mgt_vcc.c: default_vcl.h +mgt/mgt_vcc.c: builtin_vcl.h varnishd.1: $(top_srcdir)/doc/sphinx/reference/varnishd.rst if HAVE_RST2MAN diff --git a/bin/varnishd/Makefile.phk b/bin/varnishd/Makefile.phk index d0ee858..1cbd5c2 100644 --- a/bin/varnishd/Makefile.phk +++ b/bin/varnishd/Makefile.phk @@ -95,7 +95,7 @@ LD_ADD += -lm RST_MAN += $(TOPDIR)/doc/sphinx/reference/varnishd.rst -MADE_FILES += default_vcl.h +MADE_FILES += builtin_vcl.h TODO_INSTALL += install_etc @@ -103,20 +103,20 @@ TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk # -# Turn the default.vcl file into a C-string we can include in the program. +# Turn the builtin.vcl file into a C-string we can include in the program. # -default_vcl.h: default.vcl +builtint_vcl.h: builtin.vcl echo '/*' > $@ echo ' * NB: This file is machine generated, DO NOT EDIT!' >> $@ echo ' *' >> $@ - echo ' * Edit default.vcl instead and run make' >> $@ + echo ' * Edit builtin.vcl instead and run make' >> $@ echo ' *' >> $@ echo ' */' >> $@ echo '' >> $@ sed -e 's/"/\\"/g' \ -e 's/$$/\\n"/' \ - -e 's/^/ "/' default.vcl >> $@ + -e 's/^/ "/' builtin.vcl >> $@ .PHONY: install_etc -install_etc: default_vcl.h - @cp default_vcl.h $(INSTALL_BASE)/etc/ +install_etc: builtin_vcl.h + @cp builtin_vcl.h $(INSTALL_BASE)/etc/ diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl new file mode 100644 index 0000000..3a723e3 --- /dev/null +++ b/bin/varnishd/builtin.vcl @@ -0,0 +1,185 @@ +/*- + * Copyright (c) 2006 Verdens Gang AS + * Copyright (c) 2006-2014 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. + * + + * + * The built-in (previously called default) VCL code. + * + * NB! You do NOT need to copy & paste all of these functions into your + * own vcl code, if you do not provide a definition of one of these + * functions, the compiler will automatically fall back to the default + * code from this file. + * + * This code will be prefixed with a backend declaration built from the + * -b argument. + */ + +vcl 4.0; + +sub vcl_recv { + if (req.restarts == 0) { + if (req.http.x-forwarded-for) { + set req.http.X-Forwarded-For = + req.http.X-Forwarded-For + ", " + client.ip; + } else { + set req.http.X-Forwarded-For = client.ip; + } + } + if (req.method != "GET" && + req.method != "HEAD" && + req.method != "PUT" && + req.method != "POST" && + req.method != "TRACE" && + req.method != "OPTIONS" && + req.method != "DELETE") { + /* Non-RFC2616 or CONNECT which is weird. */ + return (pipe); + } + if (req.method != "GET" && req.method != "HEAD") { + /* We only deal with GET and HEAD by default */ + return (pass); + } + if (req.http.Authorization || req.http.Cookie) { + /* Not cacheable by default */ + return (pass); + } + return (hash); +} + +sub vcl_pipe { + # Note that only the first request to the backend will have + # X-Forwarded-For set. If you use X-Forwarded-For and want to + # have it set for all requests, make sure to have: + # set bereq.http.connection = "close"; + # here. It is not set by default as it might break some broken web + # applications, like IIS with NTLM authentication. + return (pipe); +} + +sub vcl_pass { + return (fetch); +} + +sub vcl_hash { + hash_data(req.url); + if (req.http.host) { + hash_data(req.http.host); + } else { + hash_data(server.ip); + } + return (lookup); +} + +sub vcl_purge { + return (error(200, "Purged")); +} + +sub vcl_hit { + if (obj.ttl >= 0s) { + // A pure unadultered hit, deliver it + return (deliver); + } + if (obj.ttl + obj.grace > 0s) { + // Object is in grace, delive it + // Automatically triggers a background fetch + return (deliver); + } + // fetch & deliver once we get the result + return (fetch); +} + +sub vcl_miss { + return (fetch); +} + + +sub vcl_backend_fetch { + return (fetch); +} + +sub vcl_backend_response { + if (beresp.ttl <= 0s || + beresp.http.Set-Cookie || + beresp.http.Surrogate-control ~ "no-store" || + (!beresp.http.Surrogate-Control && + beresp.http.Cache-Control ~ "no-cache|no-store|private") || + beresp.http.Vary == "*") { + /* + * Mark as "Hit-For-Pass" for the next 2 minutes + */ + set beresp.ttl = 120 s; + set beresp.uncacheable = true; + } + return (deliver); +} + +sub vcl_deliver { + /* + * These two write to the stored object causing extra page faults + * Enable them only if you need them. + * + * set obj.hits = obj.hits + 1; + * set obj.last_use = now; + */ + return (deliver); +} + +/* + * We can come here "invisibly" with the following errors: 413, 417 & 503 + */ +sub vcl_error { + set obj.http.Content-Type = "text/html; charset=utf-8"; + set obj.http.Retry-After = "5"; + synthetic {" + + + + + "} + obj.status + " " + obj.response + {" + + +

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

+

"} + obj.response + {"

+

Guru Meditation:

+

XID: "} + req.xid + {"

+
+

Varnish cache server

+ + +"}; + return (deliver); +} + +sub vcl_init { + return (ok); +} + +sub vcl_fini { + return (ok); +} diff --git a/bin/varnishd/default.vcl b/bin/varnishd/default.vcl deleted file mode 100644 index 8e8fa26..0000000 --- a/bin/varnishd/default.vcl +++ /dev/null @@ -1,185 +0,0 @@ -/*- - * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2014 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. - * - - * - * The default VCL code. - * - * NB! You do NOT need to copy & paste all of these functions into your - * own vcl code, if you do not provide a definition of one of these - * functions, the compiler will automatically fall back to the default - * code from this file. - * - * This code will be prefixed with a backend declaration built from the - * -b argument. - */ - -vcl 4.0; - -sub vcl_recv { - if (req.restarts == 0) { - if (req.http.x-forwarded-for) { - set req.http.X-Forwarded-For = - req.http.X-Forwarded-For + ", " + client.ip; - } else { - set req.http.X-Forwarded-For = client.ip; - } - } - if (req.method != "GET" && - req.method != "HEAD" && - req.method != "PUT" && - req.method != "POST" && - req.method != "TRACE" && - req.method != "OPTIONS" && - req.method != "DELETE") { - /* Non-RFC2616 or CONNECT which is weird. */ - return (pipe); - } - if (req.method != "GET" && req.method != "HEAD") { - /* We only deal with GET and HEAD by default */ - return (pass); - } - if (req.http.Authorization || req.http.Cookie) { - /* Not cacheable by default */ - return (pass); - } - return (hash); -} - -sub vcl_pipe { - # Note that only the first request to the backend will have - # X-Forwarded-For set. If you use X-Forwarded-For and want to - # have it set for all requests, make sure to have: - # set bereq.http.connection = "close"; - # here. It is not set by default as it might break some broken web - # applications, like IIS with NTLM authentication. - return (pipe); -} - -sub vcl_pass { - return (fetch); -} - -sub vcl_hash { - hash_data(req.url); - if (req.http.host) { - hash_data(req.http.host); - } else { - hash_data(server.ip); - } - return (lookup); -} - -sub vcl_purge { - return (error(200, "Purged")); -} - -sub vcl_hit { - if (obj.ttl >= 0s) { - // A pure unadultered hit, deliver it - return (deliver); - } - if (obj.ttl + obj.grace > 0s) { - // Object is in grace, delive it - // Automatically triggers a background fetch - return (deliver); - } - // fetch & deliver once we get the result - return (fetch); -} - -sub vcl_miss { - return (fetch); -} - - -sub vcl_backend_fetch { - return (fetch); -} - -sub vcl_backend_response { - if (beresp.ttl <= 0s || - beresp.http.Set-Cookie || - beresp.http.Surrogate-control ~ "no-store" || - (!beresp.http.Surrogate-Control && - beresp.http.Cache-Control ~ "no-cache|no-store|private") || - beresp.http.Vary == "*") { - /* - * Mark as "Hit-For-Pass" for the next 2 minutes - */ - set beresp.ttl = 120 s; - set beresp.uncacheable = true; - } - return (deliver); -} - -sub vcl_deliver { - /* - * These two write to the stored object causing extra page faults - * Enable them only if you need them. - * - * set obj.hits = obj.hits + 1; - * set obj.last_use = now; - */ - return (deliver); -} - -/* - * We can come here "invisibly" with the following errors: 413, 417 & 503 - */ -sub vcl_error { - set obj.http.Content-Type = "text/html; charset=utf-8"; - set obj.http.Retry-After = "5"; - synthetic {" - - - - - "} + obj.status + " " + obj.response + {" - - -

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

-

"} + obj.response + {"

-

Guru Meditation:

-

XID: "} + req.xid + {"

-
-

Varnish cache server

- - -"}; - return (deliver); -} - -sub vcl_init { - return (ok); -} - -sub vcl_fini { - return (ok); -} diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c index d3e81de..09e4eb4 100644 --- a/bin/varnishd/mgt/mgt_vcc.c +++ b/bin/varnishd/mgt/mgt_vcc.c @@ -71,8 +71,8 @@ static struct vcc *vcc; /*--------------------------------------------------------------------*/ -static const char * const default_vcl = -#include "default_vcl.h" +static const char * const builtin_vcl = +#include "builtin_vcl.h" "" ; /*-------------------------------------------------------------------- @@ -488,7 +488,7 @@ mgt_vcc_init(void) vcc = VCC_New(); AN(vcc); - VCC_Default_VCL(vcc, default_vcl); + VCC_Default_VCL(vcc, builtin_vcl); AZ(atexit(mgt_vcc_atexit)); } diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index 8a3ee2c..d769e81 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -922,7 +922,7 @@ specified: .port = "http"; } -.. include:: ../../../bin/varnishd/default.vcl +.. include:: ../../../bin/varnishd/builtin.vcl :literal: The following example shows how to support multiple sites running on diff --git a/etc/Makefile.am b/etc/Makefile.am index 2fb4d38..af964e9 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -1,23 +1,11 @@ # -DISTCLEANFILES = default.vcl +DISTCLEANFILES = builtin.vcl -dist_varnishconf_DATA = default.vcl +dist_varnishconf_DATA = builtin.vcl -default.vcl: $(top_srcdir)/bin/varnishd/default.vcl - ( printf "vcl 4.0;\nThis is a basic VCL configuration file for varnish. See the vcl(7)\n\ -man page for details on VCL syntax and semantics.\n\ -\n\ -Default backend definition. Set this to point to your content\n\ -server.\n\ -\n\ -backend default {\n\ - .host = \"127.0.0.1\";\n\ - .port = \"8080\";\n\ -}\n\ -\n\ -Below is a commented-out copy of the default VCL logic. If you\n\ -redefine any of these subroutines, the built-in logic will be\n\ -appended to your code.\n" ; \ - sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/default.vcl ) | \ - sed 's/^\(.*\)$$/# \1/' > default.vcl +builtin.vcl: $(top_srcdir)/bin/varnishd/builtin.vcl + ( printf "This is the VCL configuration Varnish will automatically append to your VCL\nfile during compilation/loading. See the vcl(7) man page for details on syntax\nand semantics.\n\ +New users is recommended to use the example.vcl file as a starting point.\n\n";\ + sed -n '/vcl_recv/,$$p' $(top_srcdir)/bin/varnishd/builtin.vcl ) | \ + sed 's/^\(.*\)$$/# \1/' > builtin.vcl diff --git a/man/Makefile.am b/man/Makefile.am index 56b0a52..1ed3a5d 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -12,7 +12,7 @@ dist_man_MANS = vcl.7 varnish-cli.7 varnish-counters.7 vsl.7 vsl-query.7 MAINTAINERCLEANFILES = $(dist_man_MANS) vcl.7: $(top_srcdir)/doc/sphinx/reference/vcl.rst \ - $(top_srcdir)/bin/varnishd/default.vcl + $(top_srcdir)/bin/varnishd/builtin.vcl if HAVE_RST2MAN ${RST2MAN} $(top_srcdir)/doc/sphinx/reference/vcl.rst $@ else From lkarsten at varnish-software.com Mon Jan 27 11:07:05 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:07:05 +0100 Subject: [master] e631d31 Add a skeleton VCL file to help new users along. Message-ID: commit e631d319167d1f8a576bebc91e3b2b4f999ef15c Author: Lasse Karstensen Date: Mon Jan 27 11:32:13 2014 +0100 Add a skeleton VCL file to help new users along. diff --git a/etc/example.vcl b/etc/example.vcl new file mode 100644 index 0000000..8122340 --- /dev/null +++ b/etc/example.vcl @@ -0,0 +1,36 @@ +# +# This is an example VCL file for Varnish. +# It does not do anything by default, delegating control to the builtin vcl. +# The builtin VCL is called when there is no explicit explicit return +# statement. + +# See the VCL tutorial at https://www.varnish-cache.org/docs/trunk/tutorial/ +# See http://varnish-cache.org/trac/wiki/VCLExamples for more examples. + +# Marker to tell the VCL compiler that this VCL has been adapted to the new 4.0 +# format. +vcl 4.0; + +# Default backend definition. Set this to point to your content server. +backend default { + .host = "127.0.0.1"; + .port = "8080"; +} + +sub vcl_recv { + # Happens before we check if we have this in cache already. + # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_recv +} + +sub vcl_fetch { + # Happens after we have read the response headers from the backend. + # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_fetch +# +} + +sub vcl_deliver { + # Happens when we have all the pieces we need, and are about to send the + # response to the client. + # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_fetch +} + From lkarsten at varnish-software.com Mon Jan 27 11:52:54 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:52:54 +0100 Subject: [master] c93b3ee Fix incorrect VCL in example.vcl. Message-ID: commit c93b3eebf9a05d9afdb5aa86c56627ee6a84d7c3 Author: Lasse Karstensen Date: Mon Jan 27 12:51:02 2014 +0100 Fix incorrect VCL in example.vcl. Old habits die hard. Thanks to Federico Schwindt for pointing this out. diff --git a/etc/example.vcl b/etc/example.vcl index 8122340..c9b9aad 100644 --- a/etc/example.vcl +++ b/etc/example.vcl @@ -22,7 +22,7 @@ sub vcl_recv { # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_recv } -sub vcl_fetch { +sub vcl_backend_response { # Happens after we have read the response headers from the backend. # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_fetch # From lasse at varnish-software.com Mon Jan 27 11:53:37 2014 From: lasse at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 897cc56 Fix typo in comment Message-ID: commit 897cc566dc757075093e270f947a424cfcb3391d Author: Lasse Karstensen Date: Fri Apr 26 09:43:57 2013 +0200 Fix typo in comment diff --git a/bin/varnishd/cache_httpconn.c b/bin/varnishd/cache_httpconn.c index f185520..839d1f9 100644 --- a/bin/varnishd/cache_httpconn.c +++ b/bin/varnishd/cache_httpconn.c @@ -136,7 +136,7 @@ HTC_Reinit(struct http_conn *htc) } /*-------------------------------------------------------------------- - * Return 1 if we have a complete HTTP procol header + * Return 1 if we have a complete HTTP protocol header */ int From lasse at varnish-software.com Mon Jan 27 11:53:37 2014 From: lasse at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 1af38b3 Merge branch '3.0' of ssh://git.varnish-cache.org/git/varnish-cache into 3.0 Message-ID: commit 1af38b3ff1fbfc6cb9b212b4ba09eca9a9ac8a44 Merge: 897cc56 9f83e8f Author: Lasse Karstensen Date: Mon Jun 17 15:53:28 2013 +0200 Merge branch '3.0' of ssh://git.varnish-cache.org/git/varnish-cache into 3.0 From lkarsten at varnish-software.com Mon Jan 27 11:53:37 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 421baf4 Merge branch '3.0' of ssh://git.varnish-cache.org/git/varnish-cache into 3.0 Message-ID: commit 421baf413381b791bf43bd05ed1d06911c32cc27 Merge: 1af38b3 6672d25 Author: Lasse Karstensen Date: Mon Jul 22 16:07:44 2013 +0200 Merge branch '3.0' of ssh://git.varnish-cache.org/git/varnish-cache into 3.0 From lkarsten at varnish-software.com Mon Jan 27 11:53:37 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 81c7e66 Merge remote-tracking branch 'origin/3.0' into 3.0 Message-ID: commit 81c7e6659651a654f105d9ee80fcde59f4c50d71 Merge: 421baf4 34bfadb Author: Lasse Karstensen Date: Mon Oct 21 14:54:41 2013 +0200 Merge remote-tracking branch 'origin/3.0' into 3.0 From lkarsten at varnish-software.com Mon Jan 27 11:53:37 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 88c02fa Merge branch '3.0' of git.varnish-cache.org:varnish-cache into 3.0 Message-ID: commit 88c02fa94ac194def5d3dca208c0a290101e4075 Merge: 81c7e66 fc26e3f Author: Lasse Karstensen Date: Fri Jan 3 11:08:42 2014 +0100 Merge branch '3.0' of git.varnish-cache.org:varnish-cache into 3.0 From lkarsten at varnish-software.com Mon Jan 27 11:53:37 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 12:53:37 +0100 Subject: [3.0] 4ae3ffc Stop handling after gzip object end. Message-ID: commit 4ae3ffc3ab7cd358fa626caf3a9fab55f3bda22d Author: Lasse Karstensen Date: Fri Jan 3 15:58:47 2014 +0100 Stop handling after gzip object end. Junk after gzip body end would lead to a spinning thread. Fixes: #1086 diff --git a/bin/varnishd/cache_esi_fetch.c b/bin/varnishd/cache_esi_fetch.c index b870aa7..12ba133 100644 --- a/bin/varnishd/cache_esi_fetch.c +++ b/bin/varnishd/cache_esi_fetch.c @@ -289,6 +289,8 @@ vfp_esi_bytes_gg(struct sess *sp, struct http_conn *htc, size_t bytes) vef->bufp, dl); vef->npend += dl; } + if (i == VGZ_END) + break; } while (!VGZ_IbufEmpty(sp->wrk->vgz_rx)); } return (1); diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c index 07bdcac..96a430a 100644 --- a/bin/varnishd/cache_gzip.c +++ b/bin/varnishd/cache_gzip.c @@ -378,6 +378,9 @@ VGZ_WrwGunzip(const struct sess *sp, struct vgz *vg, const void *ibuf, /* XXX: VSL ? */ return (-1); } + else if (i == VGZ_END) { + break; + } if (obufl == *obufp || i == VGZ_STUCK) { sp->wrk->acct_tmp.bodybytes += *obufp; (void)WRW_Write(sp->wrk, obuf, *obufp); diff --git a/bin/varnishtest/tests/r01086.vtc b/bin/varnishtest/tests/r01086.vtc new file mode 100644 index 0000000..0fabfde --- /dev/null +++ b/bin/varnishtest/tests/r01086.vtc @@ -0,0 +1,41 @@ +varnishtest "#1086 junk after gzip from backend and streaming enabled" + +server s1 { + rxreq + txresp -nolen \ + -hdr "Content-Encoding: gzip" \ + -hdr "Transfer-Encoding: Chunked" + send "14\r\n" + # An empty gzip file: + sendhex "1f8b" + sendhex "08" + sendhex "00" + sendhex "00000000" + sendhex "00" + sendhex "03" + sendhex "0300" + sendhex "00000000" + sendhex "00000000" + send "\r\n" + + chunked "FOOBAR" + + chunkedlen 0 + +} -start + +varnish v1 -arg {-p diag_bitmap=0x00010000} -vcl+backend { + sub vcl_fetch { + set beresp.do_stream = true; + } +} + +varnish v1 -start + +client c1 { + txreq + rxresp + expect resp.status == 200 + expect resp.bodylen == 0 +} -run + From tfheen at varnish-software.com Mon Jan 27 12:30:54 2014 From: tfheen at varnish-software.com (Tollef Fog Heen) Date: Mon, 27 Jan 2014 13:30:54 +0100 Subject: [master] 3756761 Move builtin.vcl to doc, ship example.vcl too Message-ID: commit 37567613edcfd22e499a98fd6bf6e40067bc9f48 Author: Tollef Fog Heen Date: Mon Jan 27 13:30:50 2014 +0100 Move builtin.vcl to doc, ship example.vcl too diff --git a/etc/Makefile.am b/etc/Makefile.am index af964e9..d02d710 100644 --- a/etc/Makefile.am +++ b/etc/Makefile.am @@ -2,7 +2,8 @@ DISTCLEANFILES = builtin.vcl -dist_varnishconf_DATA = builtin.vcl +dist_doc_DATA = builtin.vcl \ + example.vcl builtin.vcl: $(top_srcdir)/bin/varnishd/builtin.vcl ( printf "This is the VCL configuration Varnish will automatically append to your VCL\nfile during compilation/loading. See the vcl(7) man page for details on syntax\nand semantics.\n\ From tfheen at err.no Mon Jan 20 11:21:55 2014 From: tfheen at err.no (Tollef Fog Heen) Date: Mon, 20 Jan 2014 12:21:55 +0100 Subject: [3.0] 059148a Make the varnish package depend on libvarnishapi1 >= binary:Version Message-ID: commit 059148a4c5bf24e84fd96fbe7260df085de6805b Author: Tollef Fog Heen Date: Mon Jan 20 12:21:52 2014 +0100 Make the varnish package depend on libvarnishapi1 >= binary:Version diff --git a/control b/control index 5c79daa..75b6111 100644 --- a/control +++ b/control @@ -27,7 +27,7 @@ Standards-Version: 3.9.3 Package: varnish Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, gcc ( >= 3.3), libc6-dev | libc6.1-dev | libc-dev, adduser +Depends: ${shlibs:Depends}, ${misc:Depends}, gcc (>= 3.3), libc6-dev | libc6.1-dev | libc-dev, adduser, libvarnishapi1 (>= ${binary:Version}) Suggests: varnish-doc Replaces: libvarnishapi1 (<< 3.0.0-5) Provides: ${Varnish:ABI} From lkarsten at varnish-software.com Mon Jan 27 13:09:43 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 14:09:43 +0100 Subject: [master] e90fce3 Be consistent with capitalisation and whitepace. Message-ID: commit e90fce30053424791fcb87af41c05b579be699fb Author: Lasse Karstensen Date: Mon Jan 27 14:07:50 2014 +0100 Be consistent with capitalisation and whitepace. diff --git a/doc/sphinx/installation/bugs.rst b/doc/sphinx/installation/bugs.rst index dde28bf..b1cb06a 100644 --- a/doc/sphinx/installation/bugs.rst +++ b/doc/sphinx/installation/bugs.rst @@ -31,9 +31,9 @@ Varnish is split over two processes, the manager and the child. The child does all the work, and the manager hangs around to resurect it, if it crashes. -Therefore, the first thing to do if you see a varnish crash, is to examine +Therefore, the first thing to do if you see a Varnish crash, is to examine your syslogs, to see if it has happened before. (One site is rumoured -to have had varnish restarting every 10 minutes and *still* provide better +to have had Varnish restarting every 10 minutes and *still* provide better service than their CMS system.) When it crashes, if at all possible, Varnish will spew out a crash dump @@ -116,7 +116,7 @@ able to figure that out. If one or more threads are spinning, use ``strace`` or ``ktrace`` or ``truss`` (or whatever else your OS provides) to get a trace of which system calls -the varnish process issues. Be aware that this may generate a lot +the Varnish process issues. Be aware that this may generate a lot of very repetitive data, usually one second worth is more than enough. Also, run ``varnishlog`` for a second, and collect the output diff --git a/doc/sphinx/installation/platformnotes.rst b/doc/sphinx/installation/platformnotes.rst index 048442c..bacc57e 100644 --- a/doc/sphinx/installation/platformnotes.rst +++ b/doc/sphinx/installation/platformnotes.rst @@ -26,7 +26,7 @@ performance. If you are running on 64bit OpenVZ (or Parallels VPS), you must reduce the maximum stack size before starting Varnish. -The default allocates to much memory per thread, which will make varnish fail +The default allocates to much memory per thread, which will make Varnish fail as soon as the number of threads (traffic) increases. Reduce the maximum stack size by running:: diff --git a/doc/sphinx/installation/prerequisites.rst b/doc/sphinx/installation/prerequisites.rst index 3508c1e..ad92ee0 100644 --- a/doc/sphinx/installation/prerequisites.rst +++ b/doc/sphinx/installation/prerequisites.rst @@ -8,12 +8,12 @@ In order for you to install Varnish you must have the following: - Linux - FreeBSD - Solaris (x86 only) - * root access to said system + * root access to said system. Varnish can be installed on other UNIX systems as well, but it is not -tested particularly well on these plattforms. Varnish is, from time to -time, said to work on: +tested particularly well on these platforms. Varnish is, from time to +time, said to work on: * 32 bit versions of the before-mentioned systems. * OS X diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index 834a776..d820d69 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -1,6 +1,6 @@ -======= -varnish -======= +=========== +Varnish CLI +=========== ------------------------------ Varnish Command Line Interface @@ -142,7 +142,7 @@ ping [timestamp] Ping the Varnish cache process, keeping the connection alive. quit - Close the connection to the varnish admin port. + Close the connection to the Varnish admin port. start Start the Varnish cache process if it is not already running. @@ -214,7 +214,7 @@ code and length field always is exactly 13 characters long, including the NL character. For your reference the sourcefile lib/libvarnish/cli_common.h contains -the functions varnish code uses to read and write CLI response. +the functions Varnish code uses to read and write CLI response. .. _ref_psk_auth: @@ -318,9 +318,9 @@ SEE ALSO HISTORY ======= -The varnish manual page was written by Per Buer in 2011. Some of the +The Varnish manual page was written by Per Buer in 2011. Some of the text was taken from the Varnish Cache wiki, the varnishd(7) man page -or the varnish source code. +or the Varnish source code. COPYRIGHT ========= @@ -328,4 +328,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2011 Varnish Software AS +* Copyright (c) 2011-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishadm.rst b/doc/sphinx/reference/varnishadm.rst index 3521474..95113fa 100644 --- a/doc/sphinx/reference/varnishadm.rst +++ b/doc/sphinx/reference/varnishadm.rst @@ -3,7 +3,7 @@ varnishadm ========== ---------------------------------- -Control a running varnish instance +Control a running Varnish instance ---------------------------------- :Author: Cecilie Fritzvold @@ -90,4 +90,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2011 Varnish Software AS +* Copyright (c) 2007-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index 201c99a..a430fc2 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -70,7 +70,7 @@ OPTIONS Specifies the hash algorithm. See Hash Algorithms for a list of supported algorithms. -i identity - Specify the identity of the varnish server. This can be accessed using server.identity + Specify the identity of the Varnish server. This can be accessed using server.identity from VCL -l shmlogsize diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst index ffc8289..017bb55 100644 --- a/doc/sphinx/reference/varnishhist.rst +++ b/doc/sphinx/reference/varnishhist.rst @@ -90,4 +90,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-2011 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishreplay.rst b/doc/sphinx/reference/varnishreplay.rst index da3df36..b8b89e9 100644 --- a/doc/sphinx/reference/varnishreplay.rst +++ b/doc/sphinx/reference/varnishreplay.rst @@ -20,14 +20,14 @@ varnishreplay [-D] -a address:port -r file DESCRIPTION =========== -The varnishreplay utility parses varnish logs and attempts to -reproduce the traffic. It is typcally used to *warm* up caches or +The varnishreplay utility parses Varnish logs and attempts to +reproduce the traffic. It is typically used to *warm* up caches or various forms of testing. The following options are available: --a backend Send the traffic over tcp to this server, specified by an - address and a port. This option is +-a backend Send the traffic over tcp to this server, specified by an + address and a port. This option is mandatory. Only IPV4 is supported at this time. -D Turn on debugging mode. @@ -54,4 +54,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2010 Varnish Software AS +* Copyright (c) 2007-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index c27af28..40951e1 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -125,4 +125,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-2011 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index a0df5e2..8a3124c 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -109,7 +109,7 @@ An example:: } -run When run, the above script will simulate a server (s1) that expects two -different requests. It will start a varnish server (v1) and add the backend +different requests. It will start a Varnish server (v1) and add the backend definition to the VCL specified (-vcl+backend). Finally it starts the c1-client, which is a single client sending two requests. diff --git a/doc/sphinx/reference/vcl.rst b/doc/sphinx/reference/vcl.rst index d769e81..9aea743 100644 --- a/doc/sphinx/reference/vcl.rst +++ b/doc/sphinx/reference/vcl.rst @@ -467,7 +467,7 @@ vcl_pass restart Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_hash @@ -497,7 +497,7 @@ vcl_hit restart Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_miss @@ -546,7 +546,7 @@ vcl_fetch restart Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_deliver @@ -560,7 +560,7 @@ vcl_deliver restart Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_error @@ -575,7 +575,7 @@ vcl_error restart Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_fini @@ -755,7 +755,7 @@ other words, they are available in vcl_fetch: beresp.do_stream Deliver the object to the client directly without fetching the whole - object into varnish. If this request is pass'ed it will not be + object into Varnish. If this request is pass'ed it will not be stored in memory. As of Varnish Cache 3.0 the object will marked as busy as it is delivered so only client can access the object. @@ -883,7 +883,7 @@ Grace and saint mode If the backend takes a long time to generate an object there is a risk of a thread pile up. In order to prevent this you can enable *grace*. -This allows varnish to serve an expired version of the object while a +This allows Varnish to serve an expired version of the object while a fresh object is being generated by the backend. The following vcl code will make Varnish serve expired objects. All @@ -1035,4 +1035,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-2011 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS diff --git a/doc/sphinx/reference/vmod.rst b/doc/sphinx/reference/vmod.rst index 88a511d..95987e1 100644 --- a/doc/sphinx/reference/vmod.rst +++ b/doc/sphinx/reference/vmod.rst @@ -25,9 +25,9 @@ function shown above. The full contents of the "std" module is documented in vmod_std(7). This part of the manual is about how you go about writing your own -VMOD, how the language interface between C and VCC works, where you +VMOD, how the language interface between C and VCC works, where you can find contributed VMODs etc. This explanation will use the "std" -VMOD as example, having a varnish source tree handy may be a good +VMOD as example, having a Varnish source tree handy may be a good idea. VMOD Directory @@ -35,7 +35,8 @@ VMOD Directory The VMOD directory is an up-to-date compilation of maintained extensions written for Varnish Cache: -https://www.varnish-cache.org/vmods + + https://www.varnish-cache.org/vmods The vmod.vcc file ================= @@ -47,11 +48,11 @@ data structures that does all the hard work. The std VMODs vmod.vcc file looks somewhat like this:: - Module std - Init init_function - Function STRING toupper(PRIV_CALL, STRING_LIST) - Function STRING tolower(PRIV_VCL, STRING_LIST) - Function VOID set_ip_tos(INT) + $Module std + $Init init_function + $Function STRING toupper(PRIV_CALL, STRING_LIST) + $Function STRING tolower(PRIV_VCL, STRING_LIST) + $Function VOID set_ip_tos(INT) The first line gives the name of the module, nothing special there. diff --git a/doc/sphinx/reference/vmod_std.rst b/doc/sphinx/reference/vmod_std.rst index d80cb5b..36a2678 100644 --- a/doc/sphinx/reference/vmod_std.rst +++ b/doc/sphinx/reference/vmod_std.rst @@ -153,8 +153,8 @@ Description fails, *fallback* will be returned. Example if (std.ip(req.http.X-forwarded-for, "0.0.0.0") ~ my_acl) { ... } - - + + SEE ALSO ======== @@ -174,4 +174,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2011 Varnish Software +* Copyright (c) 2011-2014 Varnish Software diff --git a/doc/sphinx/tutorial/backend_servers.rst b/doc/sphinx/tutorial/backend_servers.rst index ebc05ad..69d1c28 100644 --- a/doc/sphinx/tutorial/backend_servers.rst +++ b/doc/sphinx/tutorial/backend_servers.rst @@ -7,7 +7,7 @@ Varnish has a concept of "backend" or "origin" servers. A backend server is the server providing the content Varnish will accelerate. Our first task is to tell Varnish where it can find its content. Start -your favorite text editor and open the varnish default configuration +your favorite text editor and open the Varnish default configuration file. If you installed from source this is /usr/local/etc/varnish/default.vcl, if you installed from a package it is probably /etc/varnish/default.vcl. @@ -21,7 +21,7 @@ the configuration that looks like this::: } This means we set up a backend in Varnish that fetches content from -the host www.varnish-cache.org on port 80. +the host www.varnish-cache.org on port 80. Since you probably don't want to be mirroring varnish-cache.org we need to get Varnish to fetch content from your own origin diff --git a/doc/sphinx/users-guide/command-line.rst b/doc/sphinx/users-guide/command-line.rst index ea44323..65dec6a 100644 --- a/doc/sphinx/users-guide/command-line.rst +++ b/doc/sphinx/users-guide/command-line.rst @@ -24,7 +24,7 @@ You will most likely want to set this to ":80" which is the Well Known Port for HTTP. You can specify multiple addresses separated by a comma, and you -can use numeric or host/service names if you like, varnish will try +can use numeric or host/service names if you like, Varnish will try to open and service as many of them as possible, but if none of them can be opened, varnishd will not start. @@ -38,7 +38,7 @@ Here are some examples:: If your webserver runs on the same computer, you will have to move it to another port number first. - + -f *VCL-file* or -b *backend* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/doc/sphinx/users-guide/intro.rst b/doc/sphinx/users-guide/intro.rst index 3d2fb0d..e497e00 100644 --- a/doc/sphinx/users-guide/intro.rst +++ b/doc/sphinx/users-guide/intro.rst @@ -33,7 +33,7 @@ Interface, which can be used manually, from scripts or programs. The CLI offers almost full control of what Varnish actually does to your HTTP traffic, and we have gone to great lengths to ensure -that you should not need to restart the varnish processes, unless +that you should not need to restart the Varnish processes, unless you need to change something very fundamental. The CLI can be safely accessed remotely, using a simple and flexible diff --git a/doc/sphinx/users-guide/operation-logging.rst b/doc/sphinx/users-guide/operation-logging.rst index f15425d..856cbfa 100644 --- a/doc/sphinx/users-guide/operation-logging.rst +++ b/doc/sphinx/users-guide/operation-logging.rst @@ -18,7 +18,7 @@ is logging. Varnishlog gives you the raw logs, everything that is written to the logs. There are other clients as well, we'll show you these later. -In the terminal window you started varnish now type *varnishlog* and +In the terminal window you started Varnish now type *varnishlog* and press enter. You'll see lines like these scrolling slowly by.:: @@ -27,7 +27,7 @@ You'll see lines like these scrolling slowly by.:: 0 CLI - Wr 200 PONG 1273698726 1.0 These is the Varnish master process checking up on the caching process -to see that everything is OK. +to see that everything is OK. Now go to the browser and reload the page displaying your web app. You'll see lines like these.:: @@ -55,10 +55,10 @@ Now, you can filter quite a bit with varnishlog. The basic option you want to know are: -b - Only show log lines from traffic going between Varnish and the backend + Only show log lines from traffic going between Varnish and the backend servers. This will be useful when we want to optimize cache hit rates. --c +-c Same as -b but for client side traffic. -m tag:regex diff --git a/doc/sphinx/users-guide/operation-statistics.rst b/doc/sphinx/users-guide/operation-statistics.rst index ad57037..8736c5e 100644 --- a/doc/sphinx/users-guide/operation-statistics.rst +++ b/doc/sphinx/users-guide/operation-statistics.rst @@ -4,7 +4,7 @@ Statistics ---------- -Now that your varnish is up and running let's have a look at how it is +Now that your Varnish is up and running let's have a look at how it is doing. There are several tools that can help. varnishtop @@ -48,10 +48,10 @@ varnishstat Varnish has lots of counters. We count misses, hits, information about the storage, threads created, deleted objects. Just about everything. varnishstat will dump these counters. This is useful when -tuning varnish. +tuning Varnish. There are programs that can poll varnishstat regularly and make nice graphs of these counters. One such program is Munin. Munin can be found at http://munin-monitoring.org/ . There is a plugin for munin in -the varnish source code. +the Varnish source code. diff --git a/doc/sphinx/users-guide/purging.rst b/doc/sphinx/users-guide/purging.rst index 3c652ea..5604d96 100644 --- a/doc/sphinx/users-guide/purging.rst +++ b/doc/sphinx/users-guide/purging.rst @@ -11,7 +11,7 @@ bad for business. The solution is to notify Varnish when there is fresh content available. This can be done through three mechanisms. HTTP purging, -banning and forced cache misses. First, let me explain the HTTP purges. +banning and forced cache misses. First, let me explain the HTTP purges. HTTP Purges @@ -31,7 +31,7 @@ following VCL in place:: "localhost"; "192.168.55.0"/24; } - + sub vcl_recv { # allow PURGE from localhost and 192.168.55... @@ -42,14 +42,14 @@ following VCL in place:: return (lookup); } } - + sub vcl_hit { if (req.method == "PURGE") { purge; error 200 "Purged."; } } - + sub vcl_miss { if (req.method == "PURGE") { purge; @@ -93,7 +93,7 @@ the following command:: Quite powerful, really. Bans are checked when we hit an object in the cache, but before we -deliver it. *An object is only checked against newer bans*. +deliver it. *An object is only checked against newer bans*. Bans that only match against obj.* are also processed by a background worker threads called the *ban lurker*. The ban lurker will walk the @@ -168,7 +168,7 @@ Forcing a cache miss The final way to invalidate an object is a method that allows you to refresh an object by forcing a hash miss for a single request. If you set -req.hash_always_miss to true, varnish will miss the current object in the +req.hash_always_miss to true, Varnish will miss the current object in the cache, thus forcing a fetch from the backend. This can in turn add the freshly fetched object to the cache, thus overriding the current one. The old object will stay in the cache until ttl expires or it is evicted by diff --git a/doc/sphinx/users-guide/run_security.rst b/doc/sphinx/users-guide/run_security.rst index 7eda18e..a2557a2 100644 --- a/doc/sphinx/users-guide/run_security.rst +++ b/doc/sphinx/users-guide/run_security.rst @@ -79,9 +79,9 @@ only allow specific CLI commands. It is also possible to configure varnishd for "reverse mode", using the '-M' argument. In that case varnishd will attempt to open a TCP connection to the specified address, and initiate a CLI connection -to your central varnish management facility. +to your central Varnish management facility. -The connection is also in this case without secrecy, but +The connection is also in this case without secrecy, but the remote end must still satisfy -S/PSK authentication. Finally, if you run varnishd with the '-d' option, you get a CLI @@ -217,4 +217,4 @@ If you have "administrative" HTTP requests, for instance PURGE requests, we strongly recommend that you restrict them to trusted IP numbers/nets using VCL's Access Control Lists. -(XXX: missing ref to ACL) +.. (XXX: missing ref to ACL) diff --git a/doc/sphinx/users-guide/sizing-your-cache.rst b/doc/sphinx/users-guide/sizing-your-cache.rst index 7d48200..8f2dfba 100644 --- a/doc/sphinx/users-guide/sizing-your-cache.rst +++ b/doc/sphinx/users-guide/sizing-your-cache.rst @@ -19,7 +19,7 @@ task. A few things to consider: Be aware that every object that is stored also carries overhead that is kept outside the actually storage area. So, even if you specify -s -malloc,16G varnish might actually use **double** that. Varnish has a +malloc,16G Varnish might actually use **double** that. Varnish has a overhead of about 1k per object. So, if you have lots of small objects in your cache the overhead might be significant. diff --git a/doc/sphinx/users-guide/troubleshooting.rst b/doc/sphinx/users-guide/troubleshooting.rst index b6f6558..fa01890 100644 --- a/doc/sphinx/users-guide/troubleshooting.rst +++ b/doc/sphinx/users-guide/troubleshooting.rst @@ -5,7 +5,7 @@ Troubleshooting Varnish Sometimes Varnish misbehaves. In order for you to understand whats going on there are a couple of places you can check. varnishlog, -/var/log/syslog, /var/log/messages are all places where varnish might +/var/log/syslog, /var/log/messages are all places where Varnish might leave clues of whats going on. This section will guide you through basic troubleshooting in Varnish. @@ -19,7 +19,7 @@ permissions on /dev/null to other processes blocking the ports. Starting Varnish in debug mode to see what is going on. -Try to start varnish by:: +Try to start Varnish by:: # varnishd -f /usr/local/etc/varnish/default.vcl -s malloc,1G -T 127.0.0.1: 2000 -a 0.0.0.0:8080 -d @@ -31,7 +31,7 @@ listening on its port.:: storage_malloc: max size 1024 MB. Using old SHMFILE Platform: Linux,2.6.32-21-generic,i686,-smalloc,-hcritbit - 200 193 + 200 193 ----------------------------- Varnish Cache CLI. ----------------------------- @@ -45,7 +45,7 @@ instruct the master process to start the cache by issuing "start".:: start bind(): Address already in use - 300 22 + 300 22 Could not open sockets And here we have our problem. Something else is bound to the HTTP port diff --git a/doc/sphinx/users-guide/vcl-backends.rst b/doc/sphinx/users-guide/vcl-backends.rst index 7dc8c95..dc9a3cb 100644 --- a/doc/sphinx/users-guide/vcl-backends.rst +++ b/doc/sphinx/users-guide/vcl-backends.rst @@ -29,7 +29,7 @@ connect to port 8080 on localhost (127.0.0.1). Varnish can have several backends defined and can you can even join several backends together into clusters of backends for load balancing -purposes. +purposes. Multiple backends @@ -72,7 +72,7 @@ It's quite simple, really. Lets stop and think about this for a moment. As you can see you can define how you choose backends based on really arbitrary data. You want to send mobile devices to a different backend? No problem. if (req.User-agent ~ /mobile/) .. should do the -trick. +trick. Backends and virtual hosts in Varnish @@ -104,7 +104,7 @@ more tight, maybe relying on the == operator in stead, like this::: if (req.http.host == "foo.com" or req.http.host == "www.foo.com") { set req.backend = foo; } - } + } .. _users-guide-advanced_backend_servers-directors: @@ -181,7 +181,7 @@ Whats new here is the probe. Varnish will check the health of each backend with a probe. The options are url - What URL should varnish request. + What URL should Varnish request. interval How often should we poll @@ -193,10 +193,10 @@ window Varnish will maintain a *sliding window* of the results. Here the window has five checks. -threshold +threshold How many of the .window last polls must be good for the backend to be declared healthy. -initial +initial How many of the of the probes a good when Varnish starts - defaults to the same amount as the threshold. @@ -206,11 +206,11 @@ Now we define the director.:: { .backend = server1; } - # server2 + # server2 { .backend = server2; } - + } You use this director just as you would use any other director or diff --git a/doc/sphinx/users-guide/vcl-built-in-subs.rst b/doc/sphinx/users-guide/vcl-built-in-subs.rst index d1c31e6..0ab6ced 100644 --- a/doc/sphinx/users-guide/vcl-built-in-subs.rst +++ b/doc/sphinx/users-guide/vcl-built-in-subs.rst @@ -23,20 +23,20 @@ vcl_recv been received and parsed. Its purpose is to decide whether or not to serve the request, how to do it, and, if applicable, which backend to use. - + The vcl_recv subroutine may terminate with calling ``return()`` on one of the following keywords: error code [reason] Return the specified error code to the client and abandon the request. - pass + pass Switch to pass mode. Control will eventually pass to vcl_pass. - pipe + pipe Switch to pipe mode. Control will eventually pass to vcl_pipe. - lookup + lookup Look up the requested object in the cache. Control will eventually pass to vcl_hit or vcl_miss, depending on whether the object is in the cache. The ``bereq.method`` value will be set @@ -50,7 +50,7 @@ vcl_pipe on to the backend, and any further data from either client or backend is passed on unaltered until either end closes the connection. - + The vcl_pipe subroutine may terminate with calling return() with one of the following keywords: @@ -67,10 +67,10 @@ vcl_pass on to the backend, and the backend's response is passed on to the client, but is not entered into the cache. Subsequent requests submitted over the same client connection are handled normally. - + The vcl_pass subroutine may terminate with calling return() with one of the following keywords: - + error code [reason] Return the specified error code to the client and abandon the request. @@ -78,8 +78,8 @@ vcl_pass Proceed with pass mode. restart - Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + Restart the transaction. Increases the restart counter. If the number + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_miss @@ -88,7 +88,7 @@ vcl_miss Called after a cache lookup if the requested document was not found in the cache. Its purpose is to decide whether or not to attempt to retrieve the document from the backend, and which backend to use. - + The vcl_miss subroutine may terminate with calling return() with one of the following keywords: @@ -106,7 +106,7 @@ vcl_fetch ~~~~~~~~~ Called after a document has been successfully retrieved from the backend. - + The vcl_fetch subroutine may terminate with calling return() with one of the following keywords: @@ -117,7 +117,7 @@ of the following keywords: error code [reason] Return the specified error code to the client and abandon the request. - hit_for_pass + hit_for_pass Pass in fetch. Passes the object without caching it. This will create a so-called hit_for_pass object which has the side effect that the decision not to cache will be cached. This is to allow @@ -131,15 +131,15 @@ of the following keywords: object. restart - Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + Restart the transaction. Increases the restart counter. If the number + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_deliver ~~~~~~~~~~~ Called before a cached object is delivered to the client. - + The vcl_deliver subroutine may terminate with one of the following keywords: @@ -147,25 +147,25 @@ keywords: Deliver the object to the client. restart - Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + Restart the transaction. Increases the restart counter. If the number + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_error ~~~~~~~~~ -Called when we hit an error, either explicitly or implicitly due to +Called when we hit an error, either explicitly or implicitly due to backend or internal errors. The vcl_error subroutine may terminate by calling return with one of the following keywords: - + deliver Deliver the error object to the client. restart - Restart the transaction. Increases the restart counter. If the number - of restarts is higher than *max_restarts* varnish emits a guru meditation + Restart the transaction. Increases the restart counter. If the number + of restarts is higher than *max_restarts* Varnish emits a guru meditation error. vcl_fini diff --git a/doc/sphinx/whats-new/upgrading.rst b/doc/sphinx/whats-new/upgrading.rst index f1fcd99..97e3a0d 100644 --- a/doc/sphinx/whats-new/upgrading.rst +++ b/doc/sphinx/whats-new/upgrading.rst @@ -11,7 +11,7 @@ Much of the VCL syntax has changed in Varnish 4. We've tried to compile a list o Version statement ~~~~~~~~~~~~~~~~~ -To make sure that people have upgraded their VCL to the current version, varnish now requires the first line of VCL to indicate the VCL version number:: +To make sure that people have upgraded their VCL to the current version, Varnish now requires the first line of VCL to indicate the VCL version number:: vcl 4.0; @@ -30,7 +30,7 @@ Since the client director was already a special case of the hash director, it ha h.add_backend(b1, 1); h.add_backend(b2, 1); } - + sub vcl_recv { set req.backend = h.backend(client.ip); } From lkarsten at varnish-software.com Mon Jan 27 13:09:43 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Mon, 27 Jan 2014 14:09:43 +0100 Subject: [master] 90a4471 Merge branch 'master' of git.varnish-cache.org:varnish-cache Message-ID: commit 90a4471b9c75ea82a46e8fdc357bea18e0bece36 Merge: e90fce3 3756761 Author: Lasse Karstensen Date: Mon Jan 27 14:09:23 2014 +0100 Merge branch 'master' of git.varnish-cache.org:varnish-cache From phk at FreeBSD.org Mon Jan 27 14:51:49 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 27 Jan 2014 15:51:49 +0100 Subject: [master] 8815683 Minor polish Message-ID: commit 8815683613a7a1b3159bcf608a8336dda667d734 Author: Poul-Henning Kamp Date: Mon Jan 27 10:40:01 2014 +0000 Minor polish diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 426faa7..477aa6a 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-2011 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp @@ -1170,27 +1170,20 @@ ban_lurker(struct worker *wrk, void *priv) { struct vsl_log vsl; volatile double d; - int i; + + CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); + AZ(priv); VSL_Setup(&vsl, NULL, 0); - (void)priv; while (!ban_shutdown) { - i = 0; d = cache_param->ban_lurker_sleep; - if (d > 0.0) - i = ban_lurker_work(wrk, &vsl); + if (d <= 0.0 || !ban_lurker_work(wrk, &vsl)) + d = 0.609; // Random, non-magic ban_cleantail(); - if (ban_shutdown) - break; - if (i) - VTIM_sleep(d); - else - VTIM_sleep(0.609); // Random, non-magic + VTIM_sleep(d); } - pthread_exit(0); - NEEDLESS_RETURN(NULL); } From phk at FreeBSD.org Mon Jan 27 14:51:49 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 27 Jan 2014 15:51:49 +0100 Subject: [master] cfe912d Close a hypothetical loophole, that could let BAN'ed objects not get EXP'ed properly Message-ID: commit cfe912d93cc81d798142ff00231092e6c300d56e Author: Poul-Henning Kamp Date: Mon Jan 27 14:36:34 2014 +0000 Close a hypothetical loophole, that could let BAN'ed objects not get EXP'ed properly diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c index 0126357..f1b65f3 100644 --- a/bin/varnishd/cache/cache_expire.c +++ b/bin/varnishd/cache/cache_expire.c @@ -245,7 +245,7 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep) VSL(SLT_ExpKill, 0, "EXP_Rearm p=%p E=%.9f e=%.9f f=0x%x", oc, oc->timer_when, when, oc->flags); - if (oc->timer_when == when) + if (when > o->exp.t_origin && when > oc->timer_when) return; lru = oc_getlru(oc); diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index e9904b2..5d89c77 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -581,11 +581,6 @@ HSH_Purge(struct worker *wrk, struct objhead *oh, double ttl, double grace) */ continue; } - xxxassert(spc > sizeof *ocp); - - (void)oc_getobj(&wrk->stats, oc); - /* XXX: still needed ? */ - xxxassert(spc >= sizeof *ocp); oc->refcnt++; spc -= sizeof *ocp; From lkarsten at varnish-software.com Tue Jan 28 13:23:57 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 28 Jan 2014 14:23:57 +0100 Subject: [master] f2ea95a Run make check properly in parallel Message-ID: commit f2ea95a32cc351a58f82b03a006b43f9a1843769 Author: Lasse Karstensen Date: Tue Jan 28 14:01:24 2014 +0100 Run make check properly in parallel diff --git a/redhat/varnish.spec b/redhat/varnish.spec index eaf92f3..a740b78 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -153,7 +153,7 @@ rm -rf doc/sphinx/\=build %endif %endif -make check LD_LIBRARY_PATH="../../lib/libvarnish/.libs:../../lib/libvarnishcompat/.libs:../../lib/libvarnishapi/.libs:../../lib/libvcc/.libs:../../lib/libvgz/.libs" TESTS_PARALLELISM=1 VERBOSE=1 +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} From lkarsten at varnish-software.com Tue Jan 28 13:23:57 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 28 Jan 2014 14:23:57 +0100 Subject: [master] fd870fb Minor whitespace fix Message-ID: commit fd870fba0ecdcadcc63d6b7906c421f58aaebed8 Author: Lasse Karstensen Date: Tue Jan 28 14:22:05 2014 +0100 Minor whitespace fix diff --git a/redhat/varnish.spec b/redhat/varnish.spec index a740b78..edb6f02 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -98,7 +98,7 @@ cp bin/varnishd/default.vcl examples export CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=0" -# Remove "--disable static" if you want to build static libraries +# 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-rst2man --without-rst2html From lkarsten at varnish-software.com Tue Jan 28 13:23:57 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 28 Jan 2014 14:23:57 +0100 Subject: [master] 2bb6d93 Package builtin.vcl and example.vcl correctly. Message-ID: commit 2bb6d93a2e00a4677683f0b52fa99390b97a0a63 Author: Lasse Karstensen Date: Tue Jan 28 14:22:58 2014 +0100 Package builtin.vcl and example.vcl correctly. New world order says that builtin.vcl and example.vcl are documentation example, and that example.vcl should be the file that the init script try to use when starting varnishd. diff --git a/redhat/varnish.spec b/redhat/varnish.spec index edb6f02..0b53613 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -87,7 +87,7 @@ Documentation files for %name #%setup -q -n varnish-trunk mkdir examples -cp bin/varnishd/default.vcl examples +cp etc/builtin.vcl etc/example.vcl examples %build # No pkgconfig/libpcre.pc in rhel4 @@ -113,17 +113,6 @@ export CFLAGS="$CFLAGS -Wp,-D_FORTIFY_SOURCE=0" make %{?_smp_mflags} V=1 -head -6 etc/default.vcl > redhat/default.vcl - -cat << EOF >> redhat/default.vcl -backend default { - .host = "127.0.0.1"; - .port = "80"; -} -EOF - -tail -n +11 etc/default.vcl >> redhat/default.vcl - %if 0%{?fedora}%{?rhel} != 0 && 0%{?rhel} <= 4 && 0%{?fedora} <= 8 # Old style daemon function sed -i 's,--pidfile \$pidfile,,g; @@ -169,7 +158,7 @@ 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 redhat/default.vcl %{buildroot}%{_sysconfdir}/varnish/default.vcl +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 From lkarsten at varnish-software.com Tue Jan 28 14:19:35 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 28 Jan 2014 15:19:35 +0100 Subject: [master] a93acd2 Package all new example VCL files Message-ID: commit a93acd2fb33bb40b1e9c37f2b632e0ebc55e3663 Author: Lasse Karstensen Date: Tue Jan 28 15:19:32 2014 +0100 Package all new example VCL files diff --git a/redhat/varnish.spec b/redhat/varnish.spec index 0b53613..c441033 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -87,7 +87,6 @@ Documentation files for %name #%setup -q -n varnish-trunk mkdir examples -cp etc/builtin.vcl etc/example.vcl examples %build # No pkgconfig/libpcre.pc in rhel4 @@ -193,7 +192,8 @@ rm -rf %{buildroot} %{_mandir}/man3/*.3* %{_mandir}/man7/*.7* %doc LICENSE README redhat/README.redhat ChangeLog -%doc examples +%doc examples/* +%{_docdir}/varnish/ %dir %{_sysconfdir}/varnish/ %config(noreplace) %{_sysconfdir}/varnish/default.vcl %config(noreplace) %{_sysconfdir}/logrotate.d/varnish From lkarsten at varnish-software.com Tue Jan 28 14:39:14 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 28 Jan 2014 15:39:14 +0100 Subject: [master] 4f4e0bd Hopefully last nitpicking packaging commit for now Message-ID: commit 4f4e0bda9486aab9ab5264f0116353f04d78e954 Author: Lasse Karstensen Date: Tue Jan 28 15:39:11 2014 +0100 Hopefully last nitpicking packaging commit for now diff --git a/redhat/varnish.spec b/redhat/varnish.spec index c441033..451d131 100644 --- a/redhat/varnish.spec +++ b/redhat/varnish.spec @@ -86,8 +86,6 @@ Documentation files for %name %setup -n varnish-%{version}%{?vd_rc} #%setup -q -n varnish-trunk -mkdir examples - %build # No pkgconfig/libpcre.pc in rhel4 %if 0%{?rhel} == 4 @@ -192,7 +190,6 @@ rm -rf %{buildroot} %{_mandir}/man3/*.3* %{_mandir}/man7/*.7* %doc LICENSE README redhat/README.redhat ChangeLog -%doc examples/* %{_docdir}/varnish/ %dir %{_sysconfdir}/varnish/ %config(noreplace) %{_sysconfdir}/varnish/default.vcl From phk at FreeBSD.org Tue Jan 28 19:11:17 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 28 Jan 2014 20:11:17 +0100 Subject: [master] 6df57da Things you can do while hanging on the telephone: Make sure lines wrap properly and remove trailing blank lines. Message-ID: commit 6df57da0060f74902f8c8613bb18f664eaa6cc6c Author: Poul-Henning Kamp Date: Tue Jan 28 19:10:45 2014 +0000 Things you can do while hanging on the telephone: Make sure lines wrap properly and remove trailing blank lines. diff --git a/Makefile.inc.phk b/Makefile.inc.phk index 5c25d59..216dcad 100644 --- a/Makefile.inc.phk +++ b/Makefile.inc.phk @@ -7,7 +7,8 @@ WARNS ?= 1 .PHONY: depend all clean install test depend all clean install test: @$(MAKE) --no-print-directory -f Makefile.phk TGT=$@ real-$@ \ - $(shell env CC=$(CC) WARNS=$(WARNS) sh ${TOPDIR}/config.phk $(TOPDIR) $(CURDIR) ) + $(shell env CC=$(CC) WARNS=$(WARNS) \ + sh ${TOPDIR}/config.phk $(TOPDIR) $(CURDIR) ) CFLAGS += $(CF_CFLAGS) $(CF_CWFLAGS) CFLAGS += -I$(CURDIR) @@ -241,4 +242,3 @@ real-test: $(TODO_TEST) @true ####################################################################### - diff --git a/Makefile.phk b/Makefile.phk index 237992c..01d3e8c 100644 --- a/Makefile.phk +++ b/Makefile.phk @@ -12,4 +12,3 @@ top_install: @for d in man doc etc bin lib libexec ; do \ mkdir -p $(INSTALL_BASE)/$$d ; \ done - diff --git a/autogen.des b/autogen.des index d546bc7..a385c71 100755 --- a/autogen.des +++ b/autogen.des @@ -18,6 +18,7 @@ rm -f configure # autoconf prior to 2.62 has issues with zsh 4.2 and newer export CONFIG_SHELL=/bin/sh +env MAKE=gmake \ ./configure \ --enable-developer-warnings \ --enable-debugging-symbols \ diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 24c6eab..5e0dcd2 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -257,7 +257,8 @@ enum vfp_status { VFP_OK = 0, VFP_END = 1, }; -typedef enum vfp_status vfp_pull_f(struct busyobj *bo, void *p, ssize_t *len, intptr_t *priv); +typedef enum vfp_status + vfp_pull_f(struct busyobj *bo, void *p, ssize_t *len, intptr_t *priv); extern vfp_pull_f vfp_gunzip_pull; extern vfp_pull_f vfp_gzip_pull; diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index e5f3198..5a43c2e 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -455,9 +455,11 @@ cli_backend_set_health(struct cli *cli, const char * const *av, void *priv) static struct cli_proto backend_cmds[] = { { "backend.list", "backend.list", - "\tList all backends\n", 0, 1, "", cli_backend_list }, + "\tList all backends\n", + 0, 1, "", cli_backend_list }, { "backend.set_health", "backend.set_health matcher state", - "\tSet health status on a backend\n", 2, 2, "", cli_backend_set_health }, + "\tSet health status on a backend\n", + 2, 2, "", cli_backend_set_health }, { NULL } }; diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index ebbff7e..9bbc6c1 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -551,7 +551,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) if (bo->state != BOS_FAILED) VBO_setstate(bo, BOS_FINISHED); -VSLb(bo->vsl, SLT_Debug, "YYY REF %d %d", bo->refcount, bo->fetch_obj->objcore->refcnt); +VSLb(bo->vsl, SLT_Debug, "YYY REF %d %d", + bo->refcount, bo->fetch_obj->objcore->refcnt); return (F_STP_DONE); } diff --git a/bin/varnishd/cache/cache_http1_fetch.c b/bin/varnishd/cache/cache_http1_fetch.c index 89e858b..e25ced9 100644 --- a/bin/varnishd/cache/cache_http1_fetch.c +++ b/bin/varnishd/cache/cache_http1_fetch.c @@ -389,4 +389,3 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, struct req *req) } return (0); } - diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c index 12a4ba6..8d61a64 100644 --- a/bin/varnishd/cache/cache_http1_proto.c +++ b/bin/varnishd/cache/cache_http1_proto.c @@ -539,4 +539,3 @@ HTTP1_Write(const struct worker *w, const struct http *hp, int resp) l += WRW_Write(w, "\r\n", -1); return (l); } - diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 49c6712..3cfb36f 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -112,8 +112,10 @@ pan_ws(const struct ws *ws, int indent) if (VALID_OBJ(ws, WS_MAGIC)) { 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); + 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 diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h index a14e6b2..f38c84d 100644 --- a/bin/varnishd/hash/hash_slinger.h +++ b/bin/varnishd/hash/hash_slinger.h @@ -65,7 +65,6 @@ enum lookup_e { void HSH_Cleanup(struct worker *w); enum lookup_e HSH_Lookup(struct req *, struct objcore **, struct objcore **, int wait_for_busy, int always_insert); -// struct objcore *HSH_Lookup(struct req *, int wait_for_busy, int always_insert); void HSH_Ref(struct objcore *o); void HSH_Drop(struct worker *, struct object **); void HSH_Init(const struct hash_slinger *slinger); diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c index 621129d..b5aec87 100644 --- a/bin/varnishd/mgt/mgt_param.c +++ b/bin/varnishd/mgt/mgt_param.c @@ -57,31 +57,38 @@ static const int tab0 = 3; /*--------------------------------------------------------------------*/ static const char OBJ_STICKY_TEXT[] = - "\n\nNB: This parameter is evaluated only when objects are created." + "\n\n" + "NB: This parameter is evaluated only when objects are created." "To change it for all objects, restart or ban everything."; static const char DELAYED_EFFECT_TEXT[] = - "\n\nNB: This parameter may take quite some time to take (full) effect."; + "\n\n" + "NB: This parameter may take quite some time to take (full) effect."; static const char MUST_RESTART_TEXT[] = - "\n\nNB: This parameter will not take any effect until the " + "\n\n" + "NB: This parameter will not take any effect until the " "child process has been restarted."; static const char MUST_RELOAD_TEXT[] = - "\n\nNB: This parameter will not take any effect until the " + "\n\n" + "NB: This parameter will not take any effect until the " "VCL programs have been reloaded."; static const char EXPERIMENTAL_TEXT[] = - "\n\nNB: We do not know yet if it is a good idea to change " + "\n\n" + "NB: We do not know yet if it is a good idea to change " "this parameter, or if the default value is even sensible. " "Caution is advised, and feedback is most welcome."; static const char WIZARD_TEXT[] = - "\n\nNB: Do not change this parameter, unless a developer tell " + "\n\n" + "NB: Do not change this parameter, unless a developer tell " "you to do so."; static const char PROTECTED_TEXT[] = - "\n\nNB: This parameter is protected and can not be changed."; + "\n\n" + "NB: This parameter is protected and can not be changed."; /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/mgt/mgt_sandbox_solaris.c b/bin/varnishd/mgt/mgt_sandbox_solaris.c index c3dc8a5..255b99c 100644 --- a/bin/varnishd/mgt/mgt_sandbox_solaris.c +++ b/bin/varnishd/mgt/mgt_sandbox_solaris.c @@ -388,7 +388,10 @@ mgt_sandbox_solaris_waive(enum sandbox_e who) return; } - /* simple scheme: (inheritable subset-of effective) subset-of permitted */ + /* + * simple scheme: + * (inheritable subset-of effective) subset-of permitted + */ priv_emptyset(inheritable); mgt_sandbox_solaris_add_inheritable(inheritable, who); diff --git a/bin/varnishd/storage/stevedore_utils.c b/bin/varnishd/storage/stevedore_utils.c index 92f531b..081b93a 100644 --- a/bin/varnishd/storage/stevedore_utils.c +++ b/bin/varnishd/storage/stevedore_utils.c @@ -205,7 +205,7 @@ STV_FileSize(int fd, const char *size, unsigned *granularity, const char *ctx) if (l < 1024*1024) ARGV_ERR("(%s) size \"%s\": too small, " - "did you forget to specify M or G?\n", ctx, size); + "did you forget to specify M or G?\n", ctx, size); } /* diff --git a/bin/varnishtest/vtc_varnish.c b/bin/varnishtest/vtc_varnish.c index d00ec7c..99c54fa 100644 --- a/bin/varnishtest/vtc_varnish.c +++ b/bin/varnishtest/vtc_varnish.c @@ -630,7 +630,8 @@ varnish_cli(struct varnish *v, const char *cli, unsigned exp) */ static void -varnish_vcl(struct varnish *v, const char *vcl, enum VCLI_status_e expect, char **resp) +varnish_vcl(struct varnish *v, const char *vcl, enum VCLI_status_e expect, + char **resp) { struct vsb *vsb; enum VCLI_status_e u; diff --git a/config.phk b/config.phk index aa6856f..16c3571 100644 --- a/config.phk +++ b/config.phk @@ -210,7 +210,8 @@ ask_compiler CF_CFLAGS ' "-D_GNU_SOURCE=1" #endif - "-DVCC_CC=~\~exec $(CC) -D_THREAD_SAFE -std=gnu99 -g -O2 -Wall -Werror -pthread -fpic -shared -Wl,-x -o %o %s\~~" + "-DVCC_CC=~\~exec $(CC) -D_THREAD_SAFE -std=gnu99 -g " \ + "-O2 -Wall -Werror -pthread -fpic -shared -Wl,-x -o %o %s\~~" "-DVCC_WARNS=~\~$(CF_CWFLAGS)\~~" @@ -295,4 +296,3 @@ exit 0 # _FILE_OFFSET_BITS - # # #echo 'CF_CFLAGS="-Wall"' - diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index 0f4829b..5dee431 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -42,7 +42,8 @@ * Long Description (in RST "definition list" format) */ -#define NODEF_NOTICE "Note: This log record is masked by default and must be explicitly enabled\n\n" +#define NODEF_NOTICE \ + "NB: This log record is masked by default.\n\n" SLTM(Debug, SLT_F_BINARY, "Debug messages", "Debug messages can normally be ignored, but are sometimes" @@ -206,8 +207,8 @@ SLTM(FetchError, 0, "Error while fetching object", #undef SLTH #define SLTH(tag, ind, req, resp, sdesc, ldesc) \ - SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " sdesc, \ - ldesc) + SLTM(Beresp##tag, (resp ? 0 : SLT_F_UNUSED), "Backend response " \ + sdesc, ldesc) #include "tbl/vsl_tags_http.h" #undef SLTH diff --git a/include/vapi/vsc.h b/include/vapi/vsc.h index d0904eb..88be5d9 100644 --- a/include/vapi/vsc.h +++ b/include/vapi/vsc.h @@ -59,8 +59,10 @@ int VSC_Arg(struct VSM_data *vd, int arg, const char *opt); * 1 Handled. */ -struct VSC_C_mgt *VSC_Mgt(const struct VSM_data *vd, struct VSM_fantom *fantom); -struct VSC_C_main *VSC_Main(const struct VSM_data *vd, struct VSM_fantom *fantom); +struct VSC_C_mgt *VSC_Mgt(const struct VSM_data *vd, + struct VSM_fantom *fantom); +struct VSC_C_main *VSC_Main(const struct VSM_data *vd, + struct VSM_fantom *fantom); /* * Looks up and returns the management stats and the child main * stats structure. If fantom is non-NULL, it can later be used @@ -80,8 +82,8 @@ struct VSC_C_main *VSC_Main(const struct VSM_data *vd, struct VSM_fantom *fantom * non-NULL: Success */ -void *VSC_Get(const struct VSM_data *vd, struct VSM_fantom *fantom, const char *type, - const char *ident); +void *VSC_Get(const struct VSM_data *vd, struct VSM_fantom *fantom, + const char *type, const char *ident); /* * Looks up the given VSC type and identifier. If fantom is * non-NULL, it can if successful later be used with diff --git a/include/vrnd.h b/include/vrnd.h index ac46c0d..7cfab1d 100644 --- a/include/vrnd.h +++ b/include/vrnd.h @@ -29,4 +29,3 @@ */ void VRND_Seed(void); /* Seed random(3) properly */ - diff --git a/include/vrt.h b/include/vrt.h index 3d465c6..9b3664a 100644 --- a/include/vrt.h +++ b/include/vrt.h @@ -209,7 +209,8 @@ void VRT_error(const struct vrt_ctx *, unsigned, const char *); int VRT_switch_config(const char *); char *VRT_GetHdr(const struct vrt_ctx *, const struct gethdr_s *); -void VRT_SetHdr(const struct vrt_ctx *, const struct gethdr_s *, const char *, ...); +void VRT_SetHdr(const struct vrt_ctx *, const struct gethdr_s *, + const char *, ...); void VRT_handling(const struct vrt_ctx *, unsigned hand); void VRT_hashdata(const struct vrt_ctx *, const char *str, ...); diff --git a/lib/libvarnish/Makefile.phk b/lib/libvarnish/Makefile.phk index 677e687..2a0c37a 100644 --- a/lib/libvarnish/Makefile.phk +++ b/lib/libvarnish/Makefile.phk @@ -27,4 +27,3 @@ LIB_SRC += vtim.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk - diff --git a/lib/libvarnishapi/Makefile.phk b/lib/libvarnishapi/Makefile.phk index 8e86df4..2c3e907 100644 --- a/lib/libvarnishapi/Makefile.phk +++ b/lib/libvarnishapi/Makefile.phk @@ -33,5 +33,3 @@ include $(TOPDIR)/Makefile.inc.phk $(MADE_FILES): generate.py python generate.py - - diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index b9455db..363085a 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -163,7 +163,8 @@ VSL_ResetError(struct VSL_data *vsl) } static int -vsl_match_IX(struct VSL_data *vsl, const vslf_list *list, const struct VSL_cursor *c) +vsl_match_IX(struct VSL_data *vsl, const vslf_list *list, + const struct VSL_cursor *c) { enum VSL_tag_e tag; const char *cdata; diff --git a/lib/libvarnishcompat/execinfo.c b/lib/libvarnishcompat/execinfo.c index 7babdd4..a9b4471 100644 --- a/lib/libvarnishcompat/execinfo.c +++ b/lib/libvarnishcompat/execinfo.c @@ -140,7 +140,7 @@ getreturnaddr(int level) { switch(level) { -#define DO_P2_TIMES_0(x) case (x): return __builtin_return_address((x) + 1) +#define DO_P2_TIMES_0(x) case (x): return __builtin_return_address((x) + 1) DO_P2_TIMES_7(0); #undef DO_P2_TIMES_0 default: return NULL; @@ -152,7 +152,7 @@ getframeaddr(int level) { switch(level) { -#define DO_P2_TIMES_0(x) case (x): return __builtin_frame_address((x) + 1) +#define DO_P2_TIMES_0(x) case (x): return __builtin_frame_address((x) + 1) DO_P2_TIMES_7(0); #undef DO_P2_TIMES_0 default: return NULL; diff --git a/lib/libvarnishtools/Makefile.phk b/lib/libvarnishtools/Makefile.phk index 366a04d..0781a45 100644 --- a/lib/libvarnishtools/Makefile.phk +++ b/lib/libvarnishtools/Makefile.phk @@ -4,4 +4,3 @@ LIB_SRC += vut.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk - diff --git a/lib/libvcc/Makefile.phk b/lib/libvcc/Makefile.phk index 131f850..333bad4 100644 --- a/lib/libvcc/Makefile.phk +++ b/lib/libvcc/Makefile.phk @@ -23,4 +23,3 @@ include $(TOPDIR)/Makefile.inc.phk $(MADE_FILES): generate.py $(PYTHON) generate.py - diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py index dbffe99..a36c2d4 100755 --- a/lib/libvcc/generate.py +++ b/lib/libvcc/generate.py @@ -78,19 +78,58 @@ tokens = { # Our methods and actions returns =( - ('recv', "C", ('error', 'pass', 'pipe', 'hash', 'purge',)), - ('pipe', "C", ('error', 'pipe',)), - ('pass', "C", ('error', 'restart', 'fetch',)), - ('hash', "C", ('lookup',)), - ('purge', "C", ('error', 'fetch',)), - ('miss', "C", ('error', 'restart', 'pass', 'fetch',)), - ('hit', "C", ('error', 'restart', 'pass', 'fetch', 'deliver',)), - ('backend_fetch', "B", ('fetch', 'abandon')), - ('backend_response', "B", ('deliver', 'retry', 'abandon')), - ('deliver', "C", ('restart', 'deliver',)), - ('error', "C", ('restart', 'deliver',)), - ('init', "", ('ok',)), - ('fini', "", ('ok',)), + ('recv', + "C", + ('error', 'pass', 'pipe', 'hash', 'purge',) + ), + ('pipe', + "C", + ('error', 'pipe',) + ), + ('pass', + "C", + ('error', 'restart', 'fetch',) + ), + ('hash', + "C", + ('lookup',) + ), + ('purge', + "C", + ('error', 'fetch',) + ), + ('miss', + "C", + ('error', 'restart', 'pass', 'fetch',) + ), + ('hit', + "C", + ('error', 'restart', 'pass', 'fetch', 'deliver',) + ), + ('backend_fetch', + "B", + ('fetch', 'abandon') + ), + ('backend_response', + "B", + ('deliver', 'retry', 'abandon') + ), + ('deliver', + "C", + ('restart', 'deliver',) + ), + ('error', + "C", + ('restart', 'deliver',) + ), + ('init', + "", + ('ok',) + ), + ('fini', + "", + ('ok',) + ), ) ####################################################################### diff --git a/lib/libvcc/vcc_acl.c b/lib/libvcc/vcc_acl.c index 6f473e9..1ab670a 100644 --- a/lib/libvcc/vcc_acl.c +++ b/lib/libvcc/vcc_acl.c @@ -352,7 +352,8 @@ vcc_acl_emit(const struct vcc *tl, const char *acln, int anon) struct token *t; Fh(tl, 0, "\nstatic int\n"); - Fh(tl, 0, "match_acl_%s_%s(const struct vrt_ctx *ctx, const VCL_IP p)\n", + Fh(tl, 0, + "match_acl_%s_%s(const struct vrt_ctx *ctx, const VCL_IP p)\n", anon ? "anon" : "named", acln); Fh(tl, 0, "{\n"); Fh(tl, 0, "\tconst unsigned char *a;\n"); diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 5b8672a..959f203 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -131,8 +131,6 @@ class vmod(object): fo.write("int " + self.init) fo.write( "(struct vmod_priv *, const struct VCL_conf *);\n") - #fo.write("\n") - #fo.write("extern const void * const Vmod_" + self.nam + "_Id;\n") def c_typedefs_(self): l = list() diff --git a/lib/libvmod_debug/Makefile.phk b/lib/libvmod_debug/Makefile.phk index 98e52e7..a692640 100644 --- a/lib/libvmod_debug/Makefile.phk +++ b/lib/libvmod_debug/Makefile.phk @@ -4,4 +4,3 @@ VMOD_SRC += vmod_debug_obj.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk - diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 8d2919e..4f74a24 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -78,4 +78,3 @@ Foo indeed. $Method TIME .date() You never know when you need a date. - diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 46811d6..7109644 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -129,4 +129,3 @@ vmod_blob2hex(const struct vrt_ctx *ctx, VCL_BLOB b) vmod_priv_fini(b); return (s); } - diff --git a/lib/libvmod_directors/Makefile.phk b/lib/libvmod_directors/Makefile.phk index 424a275..bf0a921 100644 --- a/lib/libvmod_directors/Makefile.phk +++ b/lib/libvmod_directors/Makefile.phk @@ -7,4 +7,3 @@ VMOD_SRC += vdir.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk - diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index dacd648..c8a8c84 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -204,4 +204,3 @@ vdir_pick_be(struct vdir *vd, double w, unsigned nloops) vdir_unlock(vd); return (be); } - diff --git a/lib/libvmod_std/Makefile.phk b/lib/libvmod_std/Makefile.phk index ca093a0..1b3e34b 100644 --- a/lib/libvmod_std/Makefile.phk +++ b/lib/libvmod_std/Makefile.phk @@ -5,4 +5,3 @@ VMOD_SRC += vmod_std_fileread.c TOPDIR= $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk - diff --git a/lib/libvmod_std/vmod_std_fileread.c b/lib/libvmod_std/vmod_std_fileread.c index 5ddc6bf..4fce9a2 100644 --- a/lib/libvmod_std/vmod_std_fileread.c +++ b/lib/libvmod_std/vmod_std_fileread.c @@ -83,7 +83,8 @@ free_frfile(void *ptr) } VCL_STRING __match_proto__(td_std_fileread) -vmod_fileread(const struct vrt_ctx *ctx, struct vmod_priv *priv, VCL_STRING file_name) +vmod_fileread(const struct vrt_ctx *ctx, struct vmod_priv *priv, + VCL_STRING file_name) { struct frfile *frf = NULL; char *s; From phk at FreeBSD.org Tue Jan 28 20:11:45 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 28 Jan 2014 21:11:45 +0100 Subject: [master] 4fe2ad4 Add a WS_Printf() function and use it. Message-ID: commit 4fe2ad4a339bcb89980f4859e97b05006d13b4cd Author: Poul-Henning Kamp Date: Tue Jan 28 20:11:20 2014 +0000 Add a WS_Printf() function and use it. Other minor polish around workspaces. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index 5e0dcd2..6e522bb 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -1197,6 +1197,7 @@ char *WS_Alloc(struct ws *ws, unsigned bytes); void *WS_Copy(struct ws *ws, const void *str, int len); char *WS_Snapshot(struct ws *ws); int WS_Overflowed(const struct ws *ws); +void *WS_Printf(struct ws *ws, const char *fmt, ...) __printflike(2, 3); /* rfc2616.c */ void RFC2616_Ttl(struct busyobj *); diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 6c3abbc..ec28396 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -718,20 +718,17 @@ static void http_PutField(const struct http *to, int field, const char *string) { char *p; - unsigned l; CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); - l = strlen(string); - p = WS_Alloc(to->ws, l + 1); + p = WS_Copy(to->ws, string, -1); if (p == NULL) { VSLb(to->vsl, SLT_LostHeader, "%s", string); to->hd[field].b = NULL; to->hd[field].e = NULL; to->hdf[field] = 0; } else { - memcpy(p, string, l + 1L); to->hd[field].b = p; - to->hd[field].e = p + l; + to->hd[field].e = strchr(p, '\0'); to->hdf[field] = 0; http_VSLH(to, field); } diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c index 8d61a64..a896546 100644 --- a/bin/varnishd/cache/cache_http1_proto.c +++ b/bin/varnishd/cache/cache_http1_proto.c @@ -517,6 +517,7 @@ HTTP1_Write(const struct worker *w, const struct http *hp, int resp) hp->hd[HTTP_HDR_STATUS].b = WS_Alloc(hp->ws, 4); AN(hp->hd[HTTP_HDR_STATUS].b); + assert(hp->status >= 100 && hp->status <= 999); sprintf(hp->hd[HTTP_HDR_STATUS].b, "%3d", hp->status); hp->hd[HTTP_HDR_STATUS].e = hp->hd[HTTP_HDR_STATUS].b + 3; diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 3cfb36f..81b794d 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -109,7 +109,10 @@ pan_ws(const struct ws *ws, int indent) { VSB_printf(pan_vsp, "%*sws = %p {", indent, "", ws); - if (VALID_OBJ(ws, WS_MAGIC)) { + 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, @@ -128,8 +131,6 @@ pan_ws(const struct ws *ws, int indent) VSB_printf(pan_vsp, ",+%ld", (long) (ws->e - ws->s)); else VSB_printf(pan_vsp, ",%p", ws->e); - } else { - VSB_printf(pan_vsp, " BAD_MAGIC(0x%08x) ", ws->magic); } VSB_printf(pan_vsp, "},\n"); VSB_printf(pan_vsp, "%*s},\n", indent, "" ); diff --git a/bin/varnishd/cache/cache_vrt.c b/bin/varnishd/cache/cache_vrt.c index 7138da5..3d45e4c 100644 --- a/bin/varnishd/cache/cache_vrt.c +++ b/bin/varnishd/cache/cache_vrt.c @@ -313,27 +313,17 @@ VRT_IP_string(const struct vrt_ctx *ctx, VCL_IP ip) char * VRT_INT_string(const struct vrt_ctx *ctx, long num) { - char *p; - int size; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); - size = snprintf(NULL, 0, "%ld", num) + 1; - AN(p = WS_Alloc(ctx->ws, size)); - assert(snprintf(p, size, "%ld", num) < size); - return (p); + return (WS_Printf(ctx->ws, "%ld", num)); } char * VRT_REAL_string(const struct vrt_ctx *ctx, double num) { - char *p; - int size; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); - size = snprintf(NULL, 0, "%.3f", num) + 1; - AN(p = WS_Alloc(ctx->ws, size)); - assert(snprintf(p, size, "%.3f", num) < size); - return (p); + return (WS_Printf(ctx->ws, "%.3f", num)); } char * diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c index fb2d481..dad35f3 100644 --- a/bin/varnishd/cache/cache_vrt_var.c +++ b/bin/varnishd/cache/cache_vrt_var.c @@ -471,16 +471,12 @@ VRT_DO_EXP(beresp, ctx->bo->exp, keep, 0, ctx->bo->exp.t_origin,) const char * VRT_r_req_xid(const struct vrt_ctx *ctx) { - char *p; - int size; + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); - // XXX ? - size = snprintf(NULL, 0, "%u", ctx->req->vsl->wid & VSL_IDENTMASK) + 1; - AN(p = WS_Alloc(ctx->req->http->ws, size)); - assert(snprintf(p, size, "%u", ctx->req->vsl->wid & VSL_IDENTMASK) < size); - return (p); + return (WS_Printf(ctx->req->http->ws, "%u", + ctx->req->vsl->wid & VSL_IDENTMASK)); } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishd/cache/cache_ws.c b/bin/varnishd/cache/cache_ws.c index 0ee8124..5ed9040 100644 --- a/bin/varnishd/cache/cache_ws.c +++ b/bin/varnishd/cache/cache_ws.c @@ -30,6 +30,9 @@ #include "config.h" +#include +#include + #include "cache.h" void @@ -159,6 +162,28 @@ WS_Copy(struct ws *ws, const void *str, int len) return (r); } +void * +WS_Printf(struct ws *ws, const char *fmt, ...) +{ + unsigned u, v; + va_list ap; + char *p; + + WS_Assert(ws); + assert(ws->r == NULL); + u = WS_Reserve(ws, 0); + p = ws->f; + va_start(ap, fmt); + v = vsnprintf(p, u, fmt, ap); + if (v > u) { + WS_Release(ws, 0); + p = NULL; + } else { + WS_Release(ws, v); + } + return (p); +} + char * WS_Snapshot(struct ws *ws) { From lkarsten at varnish-software.com Wed Jan 29 09:15:11 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 29 Jan 2014 10:15:11 +0100 Subject: [master] 2011a6b Use gmake as a fallback if make doesn't exist Message-ID: commit 2011a6b2d87fae2042c6b5183ef41bb41a5b1bd1 Author: Lasse Karstensen Date: Wed Jan 29 10:14:14 2014 +0100 Use gmake as a fallback if make doesn't exist gmake doesn't exist on Linux servers. diff --git a/autogen.des b/autogen.des index a385c71..07afad4 100755 --- a/autogen.des +++ b/autogen.des @@ -18,7 +18,10 @@ rm -f configure # autoconf prior to 2.62 has issues with zsh 4.2 and newer export CONFIG_SHELL=/bin/sh -env MAKE=gmake \ +if [ ! -x "/usr/bin/xmake" -a "x${MAKE}" == "x"]; then + export MAKE=gmake +fi + ./configure \ --enable-developer-warnings \ --enable-debugging-symbols \ From phk at FreeBSD.org Wed Jan 29 09:50:57 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 29 Jan 2014 10:50:57 +0100 Subject: [master] bf4dbd5 Don't leak the workaround I need to run distcheck on FreeBSD Message-ID: commit bf4dbd5fc926cfbc2f83addafcc4fa07bf53df82 Author: Poul-Henning Kamp Date: Wed Jan 29 09:31:10 2014 +0000 Don't leak the workaround I need to run distcheck on FreeBSD diff --git a/autogen.des b/autogen.des index a385c71..8c2a3b2 100755 --- a/autogen.des +++ b/autogen.des @@ -18,7 +18,7 @@ rm -f configure # autoconf prior to 2.62 has issues with zsh 4.2 and newer export CONFIG_SHELL=/bin/sh -env MAKE=gmake \ +# env MAKE=gmake \ ./configure \ --enable-developer-warnings \ --enable-debugging-symbols \ From phk at FreeBSD.org Wed Jan 29 09:50:57 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 29 Jan 2014 10:50:57 +0100 Subject: [master] 8152f09 Merge branch 'master' of git.varnish-cache.org:varnish-cache Message-ID: commit 8152f09f0e4f9a74fbbd5931d027ad93c175fac3 Merge: bf4dbd5 2011a6b Author: Poul-Henning Kamp Date: Wed Jan 29 09:49:11 2014 +0000 Merge branch 'master' of git.varnish-cache.org:varnish-cache Conflicts: autogen.des From phk at FreeBSD.org Wed Jan 29 09:50:57 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 29 Jan 2014 10:50:57 +0100 Subject: [master] 08e2b3a Document why this hack is needed. Message-ID: commit 08e2b3a80049c6a16bef95b0615639e556a709fe Author: Poul-Henning Kamp Date: Wed Jan 29 09:50:27 2014 +0000 Document why this hack is needed. diff --git a/autogen.des b/autogen.des index 8c2a3b2..0cbbbc0 100755 --- a/autogen.des +++ b/autogen.des @@ -18,6 +18,8 @@ rm -f configure # autoconf prior to 2.62 has issues with zsh 4.2 and newer export CONFIG_SHELL=/bin/sh +# NB: Workaround for make distcheck not working with +# NB: FreeBSD's make on -current # env MAKE=gmake \ ./configure \ --enable-developer-warnings \ From phk at FreeBSD.org Wed Jan 29 11:19:02 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 29 Jan 2014 12:19:02 +0100 Subject: [master] 4067f50 Don't put objcores on the ban list until they go non-BUSY. Message-ID: commit 4067f504827b349ee61d481b5218b1e1b09afed1 Author: Poul-Henning Kamp Date: Wed Jan 29 11:18:33 2014 +0000 Don't put objcores on the ban list until they go non-BUSY. Fixes #1419 diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 477aa6a..1c6b0c8 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -1030,6 +1030,7 @@ ban_lurker_getfirst(struct vsl_log *vsl, struct ban *bt) * We got the lock, and the oc is not being * dismantled under our feet, run with it... */ + AZ(oc->flags & OC_F_BUSY); oc->refcnt += 1; VTAILQ_REMOVE(&bt->objcore, oc, ban_list); VTAILQ_INSERT_TAIL(&bt->objcore, oc, ban_list); diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 5d89c77..eb69164 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -667,10 +667,6 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc) CHECK_OBJ(oh, OBJHEAD_MAGIC); AN(oc->flags & OC_F_BUSY); - if (oc->flags & OC_F_PRIVATE) - AZ(oc->ban); - else - AN(oc->ban); assert(oh->refcnt > 0); /* XXX: pretouch neighbors on oh->objcs to prevent page-on under mtx */ @@ -683,6 +679,8 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc) if (oh->waitinglist != NULL) hsh_rush(ds, oh); Lck_Unlock(&oh->mtx); + if (!(oc->flags & OC_F_PRIVATE)) + BAN_NewObjCore(oc); } /*--------------------------------------------------------------------- diff --git a/bin/varnishd/storage/stevedore.c b/bin/varnishd/storage/stevedore.c index e1cc3c8..c2788a9 100644 --- a/bin/varnishd/storage/stevedore.c +++ b/bin/varnishd/storage/stevedore.c @@ -291,8 +291,6 @@ STV_MkObject(struct stevedore *stv, struct busyobj *bo, bo->stats->n_object++; o->objcore = bo->fetch_objcore; - if (!(o->objcore->flags & OC_F_PRIVATE)) - BAN_NewObjCore(o->objcore); o->objcore->methods = &default_oc_methods; o->objcore->priv = o; diff --git a/bin/varnishtest/tests/r01419.vtc b/bin/varnishtest/tests/r01419.vtc new file mode 100644 index 0000000..5165c63 --- /dev/null +++ b/bin/varnishtest/tests/r01419.vtc @@ -0,0 +1,43 @@ +varnishtest "Make sure banlurker skips busy objects" + +server s1 { + rxreq + send "HTTP/1.0 200 Ok\r\n" + sema r1 sync 2 + send "Foobar: blaf\r\n" + send "Content-Length: 10\r\n" + send "\r\n\r\n" + send "abcde" + sema r2 sync 2 + send "abcdefghij" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + set beresp.do_stream = false; + } +} -start + +varnish v1 -cliok {param.set debug +lurker} +varnish v1 -cliok {param.set ban_lurker_age 1} +varnish v1 -cliok {ban.list} + +client c1 { + txreq + rxresp + expect resp.status == 200 + expect resp.http.foobar == blaf +} -start + +sema r1 sync 2 +varnish v1 -cliok {ban.list} + +varnish v1 -cliok {ban obj.http.goo == bar} +varnish v1 -cliok {ban.list} +delay 2 +varnish v1 -cliok {ban.list} + + +sema r2 sync 2 + +client c1 -wait From lkarsten at varnish-software.com Wed Jan 29 13:19:02 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 29 Jan 2014 14:19:02 +0100 Subject: [master] ee55121 Replace non-breaking spaces to make pdflatex happy Message-ID: commit ee55121ab437f45df345290787d6b7f8bb70b409 Author: Lasse Karstensen Date: Wed Jan 29 13:17:20 2014 +0100 Replace non-breaking spaces to make pdflatex happy diff --git a/doc/sphinx/users-guide/devicedetection.rst b/doc/sphinx/users-guide/devicedetection.rst index fc612e7..e78ceda 100644 --- a/doc/sphinx/users-guide/devicedetection.rst +++ b/doc/sphinx/users-guide/devicedetection.rst @@ -21,8 +21,8 @@ that content is to be served to. Setting this header can be as simple as:: - sub vcl_recv {? - if (req.http.User-Agent ~ "(?i)iphone"?{ + sub vcl_recv { + if (req.http.User-Agent ~ "(?i)iphone" { set req.http.X-UA-Device = "mobile-iphone"; } } From lkarsten at varnish-software.com Wed Jan 29 13:19:02 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 29 Jan 2014 14:19:02 +0100 Subject: [master] 32b6b10 Rewrite odd UTF8 that makes pdflatex sad. Message-ID: commit 32b6b10f6dfe54795826e7c5f3521121550965c7 Author: Lasse Karstensen Date: Wed Jan 29 14:06:05 2014 +0100 Rewrite odd UTF8 that makes pdflatex sad. Mostly non-breaking space and angle brackets. Stick with what has worked for 51 years now, proper 7bit US-ASCII! ;-) diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index d820d69..33e9a67 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -127,7 +127,7 @@ help [command] param.set param value Set the parameter specified by param to the specified value. - See Run-Time Parameters for a list of parame? ters. + See Run-Time Parameters for a list of parameters. param.show [-l] [param] Display a list if run-time parameters and their values. @@ -179,7 +179,7 @@ vcl.show configname vcl.use configname Start using the configuration specified by configname for all - new requests. Existing requests will con? tinue using whichever + new requests. Existing requests will continue using whichever configuration was in use when they arrived. diff --git a/doc/sphinx/reference/varnishd.rst b/doc/sphinx/reference/varnishd.rst index a430fc2..48fd44c 100644 --- a/doc/sphinx/reference/varnishd.rst +++ b/doc/sphinx/reference/varnishd.rst @@ -19,11 +19,11 @@ HTTP accelerator daemon SYNOPSIS ======== -varnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config] +varnishd [-a address[:port]] [-b host[:port]] [-d] [-F] [-f config] [-g group] [-h type[,options]] [-i identity] - [-l shmlogsize] [-n name] [-P file] [-p param=value] + [-l shmlogsize] [-n name] [-P file] [-p param=value] [-s type[,options]] [-T address[:port]] [-t ttl] - [-r param[,param...]] [-u user] [-V] + [-r param[,param...]] [-u user] [-V] DESCRIPTION =========== @@ -41,14 +41,14 @@ OPTIONS name (?localhost?), an IPv4 dotted-quad (?127.0.0.1?), or an IPv6 address enclosed in square brackets (?[::1]?). If address is not specified, varnishd will listen on all available IPv4 and IPv6 interfaces. If port is not specified, the default HTTP port as - listed in /etc/services is used. Multiple listening addresses and ports can be speci? - fied as a whitespace- or comma-separated list. + listed in /etc/services is used. Multiple listening addresses and ports can be + specified as a whitespace or comma -separated list. -b host[:port] - Use the specified host as backend server. If port is not specified, + Use the specified host as backend server. If port is not specified, the default is 8080. --C Print VCL code compiled to C language and exit. Specify the VCL file +-C Print VCL code compiled to C language and exit. Specify the VCL file to compile with the -f option. -d Enables debugging mode: The parent process runs in the foreground with a CLI connection @@ -85,8 +85,8 @@ OPTIONS -P file Write the process's PID to the specified file. -p param=value - Set the parameter specified by param to the specified value. See Run-Time - Parameters for a list of parameters. This option can be used multiple + Set the parameter specified by param to the specified value. See Run-Time + Parameters for a list of parameters. This option can be used multiple times to specify multiple parameters. -S file Path to a file containing a secret used for authorizing access to the management port. @@ -108,11 +108,11 @@ OPTIONS -M address:port Connect to this port and offer the command line - interface. Think of it as a reverse shell. When running with + interface. Think of it as a reverse shell. When running with -M and there is no backend defined the child process (the cache) will not start initially. --t ttl +-t ttl Specifies a hard minimum time to live for cached documents. This is a shortcut for specifying the default_ttl run-time parameter. @@ -129,7 +129,7 @@ OPTIONS process should switch before it starts accepting connections. This is a shortcut for specifying the user run- time parameter. - + If specifying both a user and a group, the user should be specified first. @@ -250,7 +250,7 @@ The varnishd daemon was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS, Varnish Software AS and Varnish Software. This manual page was written by Dag-Erling Sm?rgrav with updates by -Stig Sandbeck Mathisen ?ssm at debian.org? +Stig Sandbeck Mathisen COPYRIGHT @@ -259,4 +259,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2011 Varnish Software AS +* Copyright (c) 2007-2014 Varnish Software AS diff --git a/doc/sphinx/reference/varnishhist.rst b/doc/sphinx/reference/varnishhist.rst index 017bb55..6446fb1 100644 --- a/doc/sphinx/reference/varnishhist.rst +++ b/doc/sphinx/reference/varnishhist.rst @@ -15,54 +15,54 @@ Varnish request histogram SYNOPSIS ======== -varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] +varnishhist [-b] [-C] [-c] [-d] [-I regex] [-i tag] [-m tag:regex ...] [-n varnish_name] [-r file] [-V] [-w delay] [-X regex] [-x tag] DESCRIPTION =========== The varnishhist utility reads varnishd(1) shared memory logs and -presents a continuously updated histogram show? ing the distribution +presents a continuously updated histogram showing the distribution of the last N requests by their processing. The value of N and the -vertical scale are dis? played in the top left corner. The horizontal +vertical scale are displayed in the top left corner. The horizontal scale is logarithmic. Hits are marked with a pipe character ("|"), and misses are marked with a hash character ("#"). The following options are available: --b Include log entries which result from communication with +-b Include log entries which result from communication with a backend server. If neither -b nor -c is specified, varnishhist acts as if they both were. -C Ignore case when matching regular expressions. --c Include log entries which result from communication with - a client. If neither -b nor -c is specified, +-c Include log entries which result from communication with + a client. If neither -b nor -c is specified, varnishhist acts as if they both were. --d Process old log entries on startup. Normally, varnishhist - will only process entries which are written to the +-d Process old log entries on startup. Normally, varnishhist + will only process entries which are written to the log after it starts. --I regex Include log entries which match the specified - regular expression. If neither -I nor -i is specified, +-I regex Include log entries which match the specified + regular expression. If neither -I nor -i is specified, all log entries are included. --i tag Include log entries with the specified tag. If neither +-i tag Include log entries with the specified tag. If neither -I nor -i is specified, all log entries are included. -m tag:regex only count transactions where tag matches regex. Multiple -m options are AND-ed together. --n Specifies the name of the varnishd instance to get logs +-n Specifies the name of the varnishd instance to get logs from. If -n is not specified, the host name is used. -r file Read log entries from file instead of shared memory. -V Display the version number and exit. --w delay Wait at least delay seconds between each update. The - default is 1. file instead of displaying them. The file +-w delay Wait at least delay seconds between each update. The + default is 1. file instead of displaying them. The file will be overwritten unless the -a option was specified. -X regex Exclude log entries which match the specified regular expression. @@ -75,7 +75,7 @@ SEE ALSO * varnishd(1) * varnishlog(1) * varnishncsa(1) -* varnishstat(1) +* varnishstat(1) * varnishtop(1) HISTORY diff --git a/doc/sphinx/reference/varnishlog.rst b/doc/sphinx/reference/varnishlog.rst index fc186cc..9d93fe1 100644 --- a/doc/sphinx/reference/varnishlog.rst +++ b/doc/sphinx/reference/varnishlog.rst @@ -68,9 +68,9 @@ HISTORY ======= The varnishlog utility was developed by Poul-Henning Kamp -?phk at phk.freebsd.dk? in cooperation with Verdens Gang AS, Varnish -Software AS and Varnish Software. This manual page was initially -written by Dag-Erling Sm?rgrav. + in cooperation with Verdens Gang AS and +Varnish Software AS. This manual page was initially written by Dag-Erling +Sm?rgrav. COPYRIGHT diff --git a/doc/sphinx/reference/varnishncsa.rst b/doc/sphinx/reference/varnishncsa.rst index f3b1f50..50dcfe6 100644 --- a/doc/sphinx/reference/varnishncsa.rst +++ b/doc/sphinx/reference/varnishncsa.rst @@ -115,7 +115,7 @@ Supported formatters are: Varnish:handling How the request was handled, whether it was a cache hit, miss, pass, pipe or error. - + VCL_Log:key Output value set by std.log("key:value") in VCL. @@ -140,7 +140,7 @@ HISTORY The varnishncsa utility was developed by Poul-Henning Kamp in cooperation with Verdens Gang AS and Varnish Software AS. This manual page was -written by Dag-Erling Sm?rgrav ?des at des.no?. +written by Dag-Erling Sm?rgrav . COPYRIGHT ========= diff --git a/doc/sphinx/reference/varnishstat.rst b/doc/sphinx/reference/varnishstat.rst index 40951e1..67829c0 100644 --- a/doc/sphinx/reference/varnishstat.rst +++ b/doc/sphinx/reference/varnishstat.rst @@ -70,26 +70,26 @@ When using the -1 option, the columns in the output are, from left to right: When using the -x option, the output is:: - - FIELD NAME - FIELD VALUE - FIELD DESCRIPTION - + + FIELD NAME + FIELD VALUE + FIELD DESCRIPTION + With -j the output format is:: { "timestamp": "YYYY-MM-DDTHH:mm:SS", "client_conn": { - "value": 0, "flag": "a", + "value": 0, "flag": "a", "description": "Client connections accepted" }, "client_drop": { - "value": 0, "flag": "a", + "value": 0, "flag": "a", "description": "Connection dropped, no sess/wrk" }, "LCK.backend.creat": { - "type": "LCK", "ident": "backend", "value": 1, + "type": "LCK", "ident": "backend", "value": 1, "flag": "a", "description": "Created locks" }, [..] @@ -114,9 +114,8 @@ HISTORY ======= The varnishstat utility was originally developed by Poul-Henning Kamp -?phk at phk.freebsd.dk? in cooperation with Verdens Gang AS, Varnish Software AS -and Varnish Software. Manual page written by Dag-Erling Sm?rgrav, -and Per Buer. + in cooperation with Verdens Gang AS and Varnish +Software AS. Manual page written by Dag-Erling Sm?rgrav and Per Buer. COPYRIGHT ========= diff --git a/doc/sphinx/reference/varnishtest.rst b/doc/sphinx/reference/varnishtest.rst index 8a3124c..52c642b 100644 --- a/doc/sphinx/reference/varnishtest.rst +++ b/doc/sphinx/reference/varnishtest.rst @@ -128,10 +128,10 @@ HISTORY ======= The varnishtest program was developed by Poul-Henning Kamp -?phk at phk.freebsd.dk? in cooperation with Varnish Software AS. + in cooperation with Varnish Software AS. This manual page was originally written by Stig Sandbeck Mathisen -?ssm at linpro.no? and updated by Kristian Lyngst?l -(kristian at varnish-cache.org). + and updated by Kristian Lyngst?l +. COPYRIGHT ========= @@ -139,4 +139,4 @@ COPYRIGHT This document is licensed under the same licence as Varnish itself. See LICENCE for details. -* Copyright (c) 2007-2011 Varnish Software AS +* Copyright (c) 2007-2014 Varnish Software AS From lkarsten at varnish-software.com Wed Jan 29 13:19:02 2014 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 29 Jan 2014 14:19:02 +0100 Subject: [master] 084f926 Use A4 by default, minor style cleanup Message-ID: commit 084f9267556da6c5509c8b98b64a9e5533f854d6 Author: Lasse Karstensen Date: Wed Jan 29 14:18:27 2014 +0100 Use A4 by default, minor style cleanup diff --git a/doc/sphinx/Makefile.am b/doc/sphinx/Makefile.am index 217d49f..54c01f6 100644 --- a/doc/sphinx/Makefile.am +++ b/doc/sphinx/Makefile.am @@ -4,7 +4,7 @@ # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build -PAPER = +PAPER = a4 BUILDDIR = =build # Internal variables. diff --git a/doc/sphinx/conf.py.in b/doc/sphinx/conf.py.in index 5cef666..d5415da 100644 --- a/doc/sphinx/conf.py.in +++ b/doc/sphinx/conf.py.in @@ -38,7 +38,7 @@ master_doc = 'index' # General information about the project. project = u'Varnish' -copyright = u'2010, Varnish Project' +copyright = u'2010-2014 (c) Varnish Software AS' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -96,7 +96,7 @@ html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -# +# # topp background: #437EB2 # left column: #EEEEEE; # h3: #222222; @@ -106,7 +106,7 @@ html_theme = 'default' html_theme_options = { "bgcolor" : "white", - + "relbarbgcolor" : "#437EB2", "relbartextcolor" : "white", @@ -116,7 +116,7 @@ html_theme_options = { "textcolor" : "#222222", "linkcolor" : "#336590", - + # "codebgcolor" : "#EEEEEE", "codetextcolor" : "#222222", @@ -212,7 +212,7 @@ latex_documents = [ #latex_use_parts = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. #latex_appendices = [] From martin at varnish-software.com Wed Jan 29 14:19:53 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:53 +0100 Subject: [master] ac647ac Port varnishtop to the new logging API Message-ID: commit ac647acd1a44ff770f7a76efe9e2beafa8286b52 Author: Guillaume Quintard Date: Mon Dec 2 15:13:30 2013 +0100 Port varnishtop to the new logging API diff --git a/bin/Makefile.am b/bin/Makefile.am index 124cb98..48a9a51 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -8,4 +8,5 @@ SUBDIRS = varnishadm varnishd varnishlog varnishtest varnishncsa if VARNISH_CURSES #SUBDIRS += varnishhist varnishstat varnishtop SUBDIRS += varnishstat +SUBDIRS += varnishtop endif diff --git a/bin/varnishtop/Makefile.am b/bin/varnishtop/Makefile.am index 54e672f..3a78c4e 100644 --- a/bin/varnishtop/Makefile.am +++ b/bin/varnishtop/Makefile.am @@ -7,8 +7,14 @@ bin_PROGRAMS = varnishtop dist_man_MANS = varnishtop.1 varnishtop_SOURCES = varnishtop.c \ - $(top_builddir)/lib/libvarnish/vas.c \ - $(top_builddir)/lib/libvarnish/version.c + $(top_srcdir)/lib/libvarnishtools/vut.c \ + $(top_srcdir)/lib/libvarnish/vas.c \ + $(top_srcdir)/lib/libvarnish/flopen.c \ + $(top_srcdir)/lib/libvarnish/version.c \ + $(top_srcdir)/lib/libvarnish/vpf.c \ + $(top_srcdir)/lib/libvarnish/vtim.c \ + $(top_srcdir)/lib/libvarnish/vsb.c + varnishtop_LDADD = \ $(top_builddir)/lib/libvarnishcompat/libvarnishcompat.la \ diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index e217f28..f2f9555 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -50,6 +50,7 @@ #include "vcs.h" #include "vtree.h" #include "vsb.h" +#include "vut.h" #if 0 #define AC(x) assert((x) != ERR) @@ -57,6 +58,9 @@ #define AC(x) x #endif +static const char progname[] = "varnishtop2"; +static float period = 60; /* seconds */ + struct top { uint8_t tag; char *rec_data; @@ -105,61 +109,63 @@ top_cmp(const struct top *tp, const struct top *tp2) } -static int -accumulate(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len, - unsigned spec, const char *ptr, uint64_t bm) +static int __match_proto__(VSLQ_dispatch_f) +accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], + void *priv) { struct top *tp, t; - const char *q; char *rd; unsigned int u; - int i; + unsigned tag; + const char *b, *e, *p; + unsigned len; + + struct VSL_transaction *tr; + for (tr = pt[0]; tr != NULL; tr = *++pt) { + while ((1 == VSL_Next(tr->c))) { + tag = VSL_TAG(tr->c->rec.ptr); + b = VSL_CDATA(tr->c->rec.ptr); + len = VSL_LEN(tr->c->rec.ptr); + assert(len > 0); + e = b + len; + u = 0; + for (p = b; p <= e; p++) { + u += *p; + } + + t.hash = u; + t.tag = tag; + t.clen = len; + t.count = 0; + rd = calloc(len+1, 1); + AN(rd); + memcpy(rd, VSL_CDATA(tr->c->rec.ptr), len); + rd[len] = '\0'; + t.rec_data = rd; + + AZ(pthread_mutex_lock(&mtx)); + tp = VRB_FIND(top_tree, &top_tree_head, &t); + if (tp) { + VRB_REMOVE(top_tree, &top_tree_head, tp); + tp->count += 1.0; + /* Reinsert to rebalance */ + VRB_INSERT(top_tree, &top_tree_head, tp); + free(rd); + } else { + ntop++; + tp = calloc(sizeof *tp, 1); + assert(tp != NULL); + tp->hash = u; + tp->count = 1.0; + tp->clen = len; + tp->tag = tag; + tp->rec_data = rd; + VRB_INSERT(top_tree, &top_tree_head, tp); + } + AZ(pthread_mutex_unlock(&mtx)); - (void)priv; - (void)fd; - (void)spec; - (void)bm; - // fprintf(stderr, "%p %08x %08x\n", p, p[0], p[1]); - - u = 0; - q = ptr; - for (i = 0; i < len; i++, q++) { - if (f_flag && (*q == ':' || isspace(*q))) { - len = q - ptr; - break; } - u += *q; } - t.hash = u; - t.tag = tag; - t.clen = len; - rd = malloc(len); - AN(rd); - memcpy(rd, ptr, len); - t.rec_data = rd; - - AZ(pthread_mutex_lock(&mtx)); - tp = VRB_FIND(top_tree, &top_tree_head, &t); - if (tp) { - VRB_REMOVE(top_tree, &top_tree_head, tp); - tp->count += 1.0; - /* Reinsert to rebalance */ - VRB_INSERT(top_tree, &top_tree_head, tp); - } else { - ntop++; - tp = calloc(sizeof *tp, 1); - assert(tp != NULL); - tp->rec_data = calloc(len + 1, 1); - assert(tp->rec_data != NULL); - tp->hash = u; - tp->count = 1.0; - tp->clen = len; - tp->tag = tag; - memcpy(tp->rec_data, ptr, len); - tp->rec_data[len] = '\0'; - VRB_INSERT(top_tree, &top_tree_head, tp); - } - AZ(pthread_mutex_unlock(&mtx)); return (0); } @@ -187,16 +193,18 @@ update(const struct VSM_data *vd, int period) AC(mvprintw(0, 0, "list length %u", ntop)); for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(top_tree, &top_tree_head, tp); + if (++l < LINES) { len = tp->clen; if (len > COLS - 20) len = COLS - 20; AC(mvprintw(l, 0, "%9.2f %-*.*s %*.*s\n", - tp->count, maxfieldlen, maxfieldlen, - VSL_tags[tp->tag], - len, len, tp->rec_data)); + tp->count, maxfieldlen, maxfieldlen, + VSL_tags[tp->tag], + len, len, tp->rec_data)); t = tp->count; } + (void)t; tp->count += (1.0/3.0 - tp->count) / (double)n; if (tp->count * 10 < t || l > LINES * 10) { VRB_REMOVE(top_tree, &top_tree_head, tp); @@ -209,27 +217,10 @@ update(const struct VSM_data *vd, int period) } static void * -accumulate_thread(void *arg) -{ - struct VSM_data *vd = arg; - int i; - - for (;;) { - - i = VSL_Dispatch(vd, accumulate, NULL); - if (i < 0) - break; - if (i == 0) - usleep(50000); - } - return (arg); -} - -static void -do_curses(struct VSM_data *vd, int period) +do_curses(void *arg) { - pthread_t thr; int i; + struct VSM_data *vd = (struct VSM_data *)arg; for (i = 0; i < 256; i++) { if (VSL_tags[i] == NULL) @@ -238,11 +229,6 @@ do_curses(struct VSM_data *vd, int period) maxfieldlen = strlen(VSL_tags[i]); } - if (pthread_create(&thr, NULL, accumulate_thread, vd) != 0) { - fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); - exit(1); - } - (void)initscr(); AC(raw()); AC(noecho()); @@ -269,54 +255,46 @@ do_curses(struct VSM_data *vd, int period) AC(redrawwin(stdscr)); AC(refresh()); break; - case '\003': /* Ctrl-C */ - AZ(raise(SIGINT)); - break; case '\032': /* Ctrl-Z */ AC(endwin()); AZ(raise(SIGTSTP)); break; + case '\003': /* Ctrl-C */ + printf("got ctrl-C\r\n"); case '\021': /* Ctrl-Q */ case 'Q': case 'q': + AZ(raise(SIGINT)); AC(endwin()); - return; + return NULL; default: AC(beep()); break; } } + return NULL; + } static void dump(void) { struct top *tp, *tp2; - printf("%d\n", ntop); - printf("%p\n", VRB_MIN(top_tree, &top_tree_head)); for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(top_tree, &top_tree_head, tp); if (tp->count <= 1.0) - break; + break; printf("%9.2f %s %*.*s\n", - tp->count, VSL_tags[tp->tag], - tp->clen, tp->clen, tp->rec_data); + tp->count, VSL_tags[tp->tag], + tp->clen, tp->clen, tp->rec_data); } } static void -do_once(struct VSM_data *vd) -{ - while (VSL_Dispatch(vd, accumulate, NULL) > 0) - ; - dump(); -} - -static void usage(void) { fprintf(stderr, - "usage: varnishtop %s [-1fV] [-n varnish_name]\n", VSL_USAGE); + "usage: varnishtop [-1fV] [-n varnish_name]\n"); exit(1); } @@ -325,14 +303,15 @@ main(int argc, char **argv) { struct VSM_data *vd; int o, once = 0; - float period = 60; /* seconds */ + pthread_t thr; vd = VSM_New(); + VUT_Init(progname); - while ((o = getopt(argc, argv, VSL_ARGS "1fVp:")) != -1) { + while ((o = getopt(argc, argv, "1fVp:")) != -1) { switch (o) { case '1': - AN(VSL_Arg(vd, 'd', NULL)); + VUT_Arg('d', NULL); once = 1; break; case 'f': @@ -343,7 +322,7 @@ main(int argc, char **argv) period = strtol(optarg, NULL, 0); if (errno != 0) { fprintf(stderr, - "Syntax error, %s is not a number", optarg); + "Syntax error, %s is not a number", optarg); exit(1); } break; @@ -354,7 +333,7 @@ main(int argc, char **argv) fprintf(stderr, "-m is not supported\n"); exit(1); default: - if (VSL_Arg(vd, o, optarg) > 0) + if (!VUT_Arg(o, optarg)) break; usage(); } @@ -365,10 +344,20 @@ main(int argc, char **argv) exit (1); } - if (once) { - do_once(vd); - } else { - do_curses(vd, period); + VUT.dispatch_f = &accumulate; + VUT.dispatch_priv = NULL; + if (!once){ + if (pthread_create(&thr, NULL, do_curses, vd) != 0) { + fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); + exit(1); + } } + VUT_Setup(); + VUT_Main(); + VUT_Fini(); + if (once) + dump(); + else + pthread_join(thr, NULL); exit(0); } diff --git a/configure.ac b/configure.ac index e22fc4e..38634b9 100644 --- a/configure.ac +++ b/configure.ac @@ -562,6 +562,7 @@ AC_CONFIG_FILES([ bin/varnishd/Makefile bin/varnishlog/Makefile bin/varnishstat/Makefile + bin/varnishtop/Makefile bin/varnishtest/Makefile bin/varnishncsa/Makefile doc/Makefile From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] ade4dff Fix whitespace Message-ID: commit ade4dff380ff5be428ea2914ab9065d62968e614 Author: Martin Blix Grydeland Date: Wed Jan 29 11:31:25 2014 +0100 Fix whitespace diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 05f9357..8be6c36 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -141,7 +141,7 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], rd = calloc(len+1, 1); AN(rd); memcpy(rd, VSL_CDATA(tr->c->rec.ptr), len); - rd[len] = '\0'; + rd[len] = '\0'; t.rec_data = rd; AZ(pthread_mutex_lock(&mtx)); @@ -151,7 +151,7 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], tp->count += 1.0; /* Reinsert to rebalance */ VRB_INSERT(top_tree, &top_tree_head, tp); - free(rd); + free(rd); } else { ntop++; tp = calloc(sizeof *tp, 1); @@ -160,7 +160,7 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], tp->count = 1.0; tp->clen = len; tp->tag = tag; - tp->rec_data = rd; + tp->rec_data = rd; VRB_INSERT(top_tree, &top_tree_head, tp); } AZ(pthread_mutex_unlock(&mtx)); From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] c105997 Add author Message-ID: commit c105997c8748940feefc9c47c49c8a0b3c830c52 Author: Martin Blix Grydeland Date: Wed Jan 29 11:30:55 2014 +0100 Add author diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index f2f9555..05f9357 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -5,6 +5,7 @@ * * Author: Poul-Henning Kamp * Author: Dag-Erling Sm?rgrav + * Author: Guillaume Quintard * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] ac8c50e Don't trigger unused variables warnings Message-ID: commit ac8c50e163b192f2520800a217e2bac13021b9d7 Author: Martin Blix Grydeland Date: Wed Jan 29 11:32:00 2014 +0100 Don't trigger unused variables warnings diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 8be6c36..e79f682 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -121,6 +121,8 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], const char *b, *e, *p; unsigned len; + (void)vsl; + (void)priv; struct VSL_transaction *tr; for (tr = pt[0]; tr != NULL; tr = *++pt) { while ((1 == VSL_Next(tr->c))) { From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 367f8b5 Don't trigger name shadows global warning Message-ID: commit 367f8b5160812b39b4b13681e9f106a5f01dd688 Author: Martin Blix Grydeland Date: Wed Jan 29 11:32:30 2014 +0100 Don't trigger name shadows global warning diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index e79f682..3392ce1 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -174,7 +174,7 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], } static void -update(const struct VSM_data *vd, int period) +update(const struct VSM_data *vd, int p) { struct top *tp, *tp2; int l, len; @@ -189,7 +189,7 @@ update(const struct VSM_data *vd, int period) last = now; l = 1; - if (n < period) + if (n < p) n++; AC(erase()); AC(mvprintw(0, 0, "%*s", COLS - 1, VSM_Name(vd))); From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 07e159c Rename to varnishtop2 to varnishtop in usage output Message-ID: commit 07e159ccfc6fbd8421ba89cb764940b950025bf5 Author: Martin Blix Grydeland Date: Wed Jan 29 11:32:57 2014 +0100 Rename to varnishtop2 to varnishtop in usage output diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3392ce1..ed56833 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -59,7 +59,7 @@ #define AC(x) x #endif -static const char progname[] = "varnishtop2"; +static const char progname[] = "varnishtop"; static float period = 60; /* seconds */ struct top { From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 316d15b Rename varnishncsa2 to varnishncsa in usage output Message-ID: commit 316d15b37a6a07e1479cd2192f6ee262cd906500 Author: Martin Blix Grydeland Date: Wed Jan 29 11:37:58 2014 +0100 Rename varnishncsa2 to varnishncsa in usage output diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index f6a5c87..c7157f4 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -82,7 +82,7 @@ #define TIME_FMT "[%d/%b/%Y:%T %z]" #define FORMAT "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" -static const char progname[] = "varnishncsa2"; +static const char progname[] = "varnishncsa"; struct format; struct fragment; From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 4492226 Apply VSL_Match on records. Message-ID: commit 44922267c8fbea587e3143c13a635c71d25bb338 Author: Martin Blix Grydeland Date: Wed Jan 29 11:45:43 2014 +0100 Apply VSL_Match on records. This allows using the -ixIX options to filter which records are counted. diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index ed56833..65aa6a9 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -120,12 +120,14 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], unsigned tag; const char *b, *e, *p; unsigned len; + struct VSL_transaction *tr; - (void)vsl; (void)priv; - struct VSL_transaction *tr; + for (tr = pt[0]; tr != NULL; tr = *++pt) { while ((1 == VSL_Next(tr->c))) { + if (!VSL_Match(vsl, tr->c)) + continue; tag = VSL_TAG(tr->c->rec.ptr); b = VSL_CDATA(tr->c->rec.ptr); len = VSL_LEN(tr->c->rec.ptr); From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 47d2153 Sort out options parsing for varnishtop Message-ID: commit 47d2153fb0040be763091932fcc051add175b4b9 Author: Martin Blix Grydeland Date: Wed Jan 29 13:50:59 2014 +0100 Sort out options parsing for varnishtop diff --git a/bin/varnishtop/Makefile.am b/bin/varnishtop/Makefile.am index 3a78c4e..a38e293 100644 --- a/bin/varnishtop/Makefile.am +++ b/bin/varnishtop/Makefile.am @@ -7,6 +7,8 @@ bin_PROGRAMS = varnishtop dist_man_MANS = varnishtop.1 varnishtop_SOURCES = varnishtop.c \ + varnishtop_options.h \ + varnishtop_options.c \ $(top_srcdir)/lib/libvarnishtools/vut.c \ $(top_srcdir)/lib/libvarnish/vas.c \ $(top_srcdir)/lib/libvarnish/flopen.c \ @@ -21,9 +23,31 @@ varnishtop_LDADD = \ $(top_builddir)/lib/libvarnishapi/libvarnishapi.la \ @CURSES_LIB@ ${RT_LIBS} ${LIBM} ${PTHREAD_LIBS} -varnishtop.1: $(top_srcdir)/doc/sphinx/reference/varnishtop.rst +noinst_PROGRAMS = varnishtop_opt2rst +varnishtop_opt2rst_SOURCES = \ + varnishtop_options.h \ + varnishtop_options.c \ + $(top_srcdir)/lib/libvarnishtools/opt2rst.c + +BUILT_SOURCES = varnishtop_options.rst varnishtop_synopsis.rst +EXTRA_DIST = $(BUILT_SOURCES) +MAINTAINERCLEANFILES = $(EXTRA_DIST) + +varnishtop_options.rst: + ./varnishtop_opt2rst options > $@ +varnishtop_synopsis.rst: + ./varnishtop_opt2rst synopsis > $@ + +if HAVE_RST2MAN +varnishtop_options.rst varnishtop_synopsis.rst: varnishtop_opt2rst +endif + +varnishtop.1: \ + $(top_srcdir)/doc/sphinx/reference/varnishtop.rst \ + varnishtop_options.rst \ + varnishtop_synopsis.rst if HAVE_RST2MAN - ${RST2MAN} $? $@ + ${RST2MAN} $(top_srcdir)/doc/sphinx/reference/varnishtop.rst $@ else @echo "========================================" @echo "You need rst2man installed to make dist" diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 65aa6a9..7190257 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -45,8 +45,9 @@ #include #include -#include "vapi/vsl.h" #include "vapi/vsm.h" +#include "vapi/vsl.h" +#include "vapi/voptget.h" #include "vas.h" #include "vcs.h" #include "vtree.h" @@ -296,11 +297,15 @@ dump(void) } static void -usage(void) +usage(int status) { - fprintf(stderr, - "usage: varnishtop [-1fV] [-n varnish_name]\n"); - exit(1); + const char **opt; + + fprintf(stderr, "Usage: %s \n\n", progname); + fprintf(stderr, "Options:\n"); + for (opt = vopt_usage; *opt != NULL; opt +=2) + fprintf(stderr, " %-25s %s\n", *opt, *(opt + 1)); + exit(status); } int @@ -313,7 +318,7 @@ main(int argc, char **argv) vd = VSM_New(); VUT_Init(progname); - while ((o = getopt(argc, argv, "1fVp:")) != -1) { + while ((o = getopt(argc, argv, vopt_optstring)) != -1) { switch (o) { case '1': VUT_Arg('d', NULL); @@ -322,6 +327,9 @@ main(int argc, char **argv) case 'f': f_flag = 1; break; + case 'h': + /* Usage help */ + usage(0); case 'p': errno = 0; period = strtol(optarg, NULL, 0); @@ -331,16 +339,9 @@ main(int argc, char **argv) exit(1); } break; - case 'V': - VCS_Message("varnishtop"); - exit(0); - case 'm': - fprintf(stderr, "-m is not supported\n"); - exit(1); default: if (!VUT_Arg(o, optarg)) - break; - usage(); + usage(1); } } diff --git a/bin/varnishtop/varnishtop_options.c b/bin/varnishtop/varnishtop_options.c new file mode 100644 index 0000000..58d132e --- /dev/null +++ b/bin/varnishtop/varnishtop_options.c @@ -0,0 +1,34 @@ +/*- + * Copyright (c) 2014 Varnish Software AS + * All rights reserved. + * + * Author: Martin Blix Grydeland + * + * 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. + * + * Option definitions for varnishtop + */ + +#include +#define VOPT_DEFINITION +#define VOPT_INC "varnishtop_options.h" +#include "vapi/voptget.h" diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h new file mode 100644 index 0000000..33135a8 --- /dev/null +++ b/bin/varnishtop/varnishtop_options.h @@ -0,0 +1,50 @@ +/*- + * Copyright (c) 2014 Varnish Software AS + * All rights reserved. + * + * Author: Martin Blix Grydeland + * + * 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. + * + * Option definitions for varnishtop + */ + +#include "vapi/vapi_options.h" +#include "vut_options.h" + +VSL_OPT_b +VSL_OPT_c +VSL_OPT_C +VUT_OPT_d +VUT_OPT_D +VUT_OPT_h +VSL_OPT_i +VSL_OPT_I +VSL_OPT_L +VUT_OPT_n +VUT_OPT_N +VUT_OPT_q +VUT_OPT_r +VSL_OPT_T +VSL_OPT_x +VSL_OPT_X +VUT_OPT_V From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 7630265 Reintroduce the -1, -f and -p options to varnishtop Message-ID: commit 763026598b03334fa5d1f8d8ed15b4092d931d15 Author: Martin Blix Grydeland Date: Wed Jan 29 14:39:51 2014 +0100 Reintroduce the -1, -f and -p options to varnishtop diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index 33135a8..5256b1d 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -31,17 +31,41 @@ #include "vapi/vapi_options.h" #include "vut_options.h" +#define TOP_OPT_1 \ + VOPT("1", "[-1]", "Run once", \ + "Instead of a continously updated display, print the" \ + " statistics once and exit. Implies ``-d``." \ + ) + +#define TOP_OPT_f \ + VOPT("f", "[-f]", "First field only", \ + "Sort and group only on the first field of each log entry." \ + " This is useful when displaying e.g. stataddr entries," \ + " where the first field is the client IP address." \ + ) + +#define TOP_OPT_p \ + VOPT("p:", "-p period", "Sampling period", \ + "Specified the number of seconds to measure over, the" \ + " default is 60 seconds. The first number in the list is" \ + " the average number of requests seen over this time" \ + " period." \ + ) + +TOP_OPT_1 VSL_OPT_b VSL_OPT_c VSL_OPT_C VUT_OPT_d VUT_OPT_D +TOP_OPT_f VUT_OPT_h VSL_OPT_i VSL_OPT_I VSL_OPT_L VUT_OPT_n VUT_OPT_N +TOP_OPT_p VUT_OPT_q VUT_OPT_r VSL_OPT_T From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 41b9a00 Reintroduce code to handle -f option Message-ID: commit 41b9a000e2999c7d078bd266b1fa0a58df65f78f Author: Martin Blix Grydeland Date: Wed Jan 29 15:09:00 2014 +0100 Reintroduce code to handle -f option diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 7190257..3863119 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -131,13 +131,18 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], continue; tag = VSL_TAG(tr->c->rec.ptr); b = VSL_CDATA(tr->c->rec.ptr); - len = VSL_LEN(tr->c->rec.ptr); - assert(len > 0); - e = b + len; + e = b + VSL_LEN(tr->c->rec.ptr); u = 0; for (p = b; p <= e; p++) { + if (*p == '\0') + break; + if (f_flag && (*p == ':' || isspace(*p))) + break; u += *p; } + len = p - b; + if (len == 0) + continue; t.hash = u; t.tag = tag; From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 03b751b Update copyright Message-ID: commit 03b751b16616895f3517bfdc79a678727d520062 Author: Martin Blix Grydeland Date: Wed Jan 29 15:09:21 2014 +0100 Update copyright diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3863119..23fcdec 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -1,6 +1,6 @@ /*- * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2011 Varnish Software AS + * Copyright (c) 2006-2014 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 5acc552 Update varnishtop documentation Message-ID: commit 5acc552c0f74f9874a99bdbe8c57d32aa9757de5 Author: Martin Blix Grydeland Date: Wed Jan 29 15:09:56 2014 +0100 Update varnishtop documentation diff --git a/doc/sphinx/reference/varnishtop.rst b/doc/sphinx/reference/varnishtop.rst index 86e6cf6..23298d5 100644 --- a/doc/sphinx/reference/varnishtop.rst +++ b/doc/sphinx/reference/varnishtop.rst @@ -1,12 +1,13 @@ -============ +========== varnishtop -============ +========== ------------------------- Varnish log entry ranking ------------------------- :Author: Dag-Erling Sm?rgrav +:Author: Martin Blix Grydeland :Date: 2010-05-31 :Version: 1.0 :Manual section: 1 @@ -16,9 +17,8 @@ Varnish log entry ranking SYNOPSIS ======== -varnishtop [-1] [-b] [-C] [-c] [-d] [-f] [-I regex] -[-i tag] [-n varnish_name] [-r file] [-V] [-X regex] -[-x tag] +.. include:: ../../../bin/varnishtop/varnishtop_synopsis.rst +varnishtop |synopsis| DESCRIPTION =========== @@ -32,48 +32,7 @@ recorded in the log. The following options are available: --1 Instead of presenting of a continuously updated display, - print the statistics once and exit. Implies ``-d``. - --b Include log entries which result from communication - with a backend server. If neither ``-b`` nor ``-c`` is - specified, varnishtop acts as if they both were. - --C Ignore case when matching regular expressions. - --c Include log entries which result from communication - with a client. If neither ``-b`` nor ``-c`` is specified, - varnishtop acts as if they both were. - --d Process old log entries on startup. Normally, varnishtop - will only process entries which are written to the log - after it starts. - --f Sort and group only on the first field of each log entry. - This is useful when displaying e.g. stataddr entries, - where the first field is the client IP address. - --I regex Include log entries which match the specified regular - expression. If neither ``-I`` nor ``-i`` is specified, all log - entries are included. - --i tag Include log entries with the specified tag. If neither ``-I`` - nor ``-i`` is specified, all log entries are included. - --p period Specifies the number of seconds to measure over, the default - is 60 seconds. The first number in the list is the average - number of requests seen over this time period. - --n Specifies the name of the varnishd instance to get logs from. - If ``-n`` is not specified, the host name is used. - --r file Read log entries from file instead of shared memory. - --V Display the version number and exit. - --X regex Exclude log entries which match the specified regular expression. - --x tag Exclude log entries with the specified tag. +.. include:: ../../../bin/varnishtop/varnishtop_options.rst EXAMPLES ======== @@ -81,12 +40,12 @@ EXAMPLES The following example displays a continuously updated list of the most frequently requested URLs:: - varnishtop -i RxURL + varnishtop -i ReqURL The following example displays a continuously updated list of the most commonly used user agents:: - varnishtop -i RxHeader -C -I ^User-Agent + varnishtop -C -I ReqHeader:User-Agent SEE ALSO ======== @@ -112,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-2011 Varnish Software AS +* Copyright (c) 2006-2014 Varnish Software AS From martin at varnish-software.com Wed Jan 29 14:19:54 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 15:19:54 +0100 Subject: [master] 22dddf3 Update Makefile.phk to handle varnishtop Message-ID: commit 22dddf3c55ada965940aa339d7467a84037b1483 Author: Martin Blix Grydeland Date: Wed Jan 29 15:12:39 2014 +0100 Update Makefile.phk to handle varnishtop diff --git a/bin/Makefile.phk b/bin/Makefile.phk index 933c9d8..5380231 100644 --- a/bin/Makefile.phk +++ b/bin/Makefile.phk @@ -6,7 +6,7 @@ SUBDIRS += varnishncsa SUBDIRS += varnishtest SUBDIRS += varnishstat # SUBDIRS += varnishhist -# SUBDIRS += varnishtop +SUBDIRS += varnishtop TOPDIR = $(CURDIR)/.. include $(TOPDIR)/Makefile.inc.phk diff --git a/bin/varnishtop/Makefile.phk b/bin/varnishtop/Makefile.phk index 1b922f3..3c5684c 100644 --- a/bin/varnishtop/Makefile.phk +++ b/bin/varnishtop/Makefile.phk @@ -1,9 +1,15 @@ -PROG_SRC = varnishtop.c +PROG_SRC += varnishtop.c +PROG_SRC += varnishtop_options.c -LD_ADD += ${LIB_VARNISH} +LD_ADD += ${LIB_VARNISHTOOLS} LD_ADD += ${LIB_VARNISHAPI} +LD_ADD += ${LIB_VARNISH} LD_ADD += ${LIB_PCRE} -LD_ADD += ${LIB_CURSES} +LD_ADD += -lm + +TODO_ALL += build_man TOPDIR = $(CURDIR)/../.. include $(TOPDIR)/Makefile.inc.phk + +.PHONY: build_man From martin at varnish-software.com Wed Jan 29 16:29:03 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 17:29:03 +0100 Subject: [master] 2dc3e7e Fix formatting of -p option Message-ID: commit 2dc3e7ed476f4379b8be9c4662fd442c4845d399 Author: Martin Blix Grydeland Date: Wed Jan 29 17:28:32 2014 +0100 Fix formatting of -p option diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index 5256b1d..51c877d 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -45,7 +45,7 @@ ) #define TOP_OPT_p \ - VOPT("p:", "-p period", "Sampling period", \ + VOPT("p:", "[-p period]", "Sampling period", \ "Specified the number of seconds to measure over, the" \ " default is 60 seconds. The first number in the list is" \ " the average number of requests seen over this time" \ From martin at varnish-software.com Wed Jan 29 16:29:03 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 29 Jan 2014 17:29:03 +0100 Subject: [master] 22ac7f8 Enable grouping mode option in varnishtop Message-ID: commit 22ac7f849c019ccb42e970fe1bf4ccae56dd8f29 Author: Martin Blix Grydeland Date: Wed Jan 29 17:28:48 2014 +0100 Enable grouping mode option in varnishtop diff --git a/bin/varnishtop/varnishtop_options.h b/bin/varnishtop/varnishtop_options.h index 51c877d..592694a 100644 --- a/bin/varnishtop/varnishtop_options.h +++ b/bin/varnishtop/varnishtop_options.h @@ -59,6 +59,7 @@ VSL_OPT_C VUT_OPT_d VUT_OPT_D TOP_OPT_f +VUT_OPT_g VUT_OPT_h VSL_OPT_i VSL_OPT_I From tfheen at varnish-software.com Thu Jan 30 07:10:04 2014 From: tfheen at varnish-software.com (Tollef Fog Heen) Date: Thu, 30 Jan 2014 08:10:04 +0100 Subject: [master] 34afd2c Remove debugging output Message-ID: commit 34afd2cd38970f210f8b0d606b4ac0fba4a5c24b Author: Tollef Fog Heen Date: Thu Jan 30 08:09:33 2014 +0100 Remove debugging output This upsets coverity and doesn't add value, so remove the printf line. diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index fbc8dc8..b5d5c7c 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -271,7 +271,6 @@ do_curses(void *arg) AZ(raise(SIGTSTP)); break; case '\003': /* Ctrl-C */ - printf("got ctrl-C\r\n"); case '\021': /* Ctrl-Q */ case 'Q': case 'q': From tfheen at varnish-software.com Thu Jan 30 07:10:04 2014 From: tfheen at varnish-software.com (Tollef Fog Heen) Date: Thu, 30 Jan 2014 08:10:04 +0100 Subject: [master] f1851f9 Drop obsolete VSM_Open Message-ID: commit f1851f9e19fea8677ec961ec3f2a774588cfb35a Author: Tollef Fog Heen Date: Thu Jan 30 08:09:16 2014 +0100 Drop obsolete VSM_Open This is no longer needed and breaks -n diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 23fcdec..fbc8dc8 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -350,11 +350,6 @@ main(int argc, char **argv) } } - if (VSM_Open(vd)) { - fprintf(stderr, "%s\n", VSM_Error(vd)); - exit (1); - } - VUT.dispatch_f = &accumulate; VUT.dispatch_priv = NULL; if (!once){ From daghf at varnish-software.com Thu Jan 30 10:43:55 2014 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Thu, 30 Jan 2014 11:43:55 +0100 Subject: [master] d43af81 Fix missing dependency in libvmod_debug makefile. Message-ID: commit d43af818662a8c5cf3330c850f42c79b62b07baf Author: Dag Haavi Finstad Date: Thu Jan 30 11:43:08 2014 +0100 Fix missing dependency in libvmod_debug makefile. Fixes: #1418 diff --git a/lib/libvmod_debug/Makefile.am b/lib/libvmod_debug/Makefile.am index 18d5ecf..89df1b2 100644 --- a/lib/libvmod_debug/Makefile.am +++ b/lib/libvmod_debug/Makefile.am @@ -22,7 +22,7 @@ nodist_libvmod_debug_la_SOURCES = \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build -vmod_debug.lo: vcc_if.h +vmod_debug.lo vmod_debug_obj.lo: vcc_if.h vcc_if.c vcc_if.h: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmod_srcdir)/vmod.vcc From daghf at varnish-software.com Thu Jan 30 10:56:02 2014 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Thu, 30 Jan 2014 11:56:02 +0100 Subject: [master] fafe433 Add missing vcc_if.h deps in libvmod_directors. Message-ID: commit fafe4334b1ca7be8f22fb502f27fb98c06fec7ea Author: Dag Haavi Finstad Date: Thu Jan 30 11:55:38 2014 +0100 Add missing vcc_if.h deps in libvmod_directors. diff --git a/lib/libvmod_directors/Makefile.am b/lib/libvmod_directors/Makefile.am index 5706ab8..d44839d 100644 --- a/lib/libvmod_directors/Makefile.am +++ b/lib/libvmod_directors/Makefile.am @@ -26,7 +26,7 @@ nodist_libvmod_directors_la_SOURCES = \ vcc_if.h # BUILT_SOURCES is only a hack and dependency tracking does not help for the first build -vdir.lo: vcc_if.h +vdir.lo fall_back.lo hash.lo random.lo round_robin.lo: vcc_if.h vcc_if.c vcc_if.h: $(vmodtool) $(vmod_srcdir)/vmod.vcc @PYTHON@ $(vmodtool) $(vmod_srcdir)/vmod.vcc From martin at varnish-software.com Thu Jan 30 13:02:08 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:08 +0100 Subject: [master] ae00276 Improve -n and -N VSM handling. Message-ID: commit ae002768a6d38bd251b218e2c45d7dcf8b0efe63 Author: Martin Blix Grydeland Date: Thu Jan 30 13:32:49 2014 +0100 Improve -n and -N VSM handling. This makes sure that VSM_Name always has something sensible to return. diff --git a/lib/libvarnishapi/vsm.c b/lib/libvarnishapi/vsm.c index f036d99..f05f184 100644 --- a/lib/libvarnishapi/vsm.c +++ b/lib/libvarnishapi/vsm.c @@ -69,6 +69,7 @@ VSM_New(void) if (vd == NULL) return (vd); + REPLACE(vd->name, ""); vd->vsm_fd = -1; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); @@ -126,38 +127,45 @@ VSM_ResetError(struct VSM_data *vd) /*--------------------------------------------------------------------*/ int -VSM_n_Arg(struct VSM_data *vd, const char *opt) +VSM_n_Arg(struct VSM_data *vd, const char *arg) { + char *name = NULL; + char *fname = NULL; CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); - AN(opt); - if (vd->fname) { + if (vd->head) + return (vsm_diag(vd, "VSM_n_Arg: Already open\n")); + if (VIN_N_Arg(arg, &name, NULL, &fname)) + return (vsm_diag(vd, "Invalid instance name: %s\n", + strerror(errno))); + AN(name); + AN(fname); + + if (vd->name) + free(vd->name); + vd->name = name; + if (vd->fname) free(vd->fname); - vd->fname = NULL; - } + vd->fname = fname; vd->N_opt = 0; - REPLACE(vd->n_opt, opt); - if (VIN_N_Arg(vd->n_opt, NULL, NULL, &vd->fname)) - return (vsm_diag(vd, "Invalid instance name: %s\n", - strerror(errno))); + return (1); } /*--------------------------------------------------------------------*/ int -VSM_N_Arg(struct VSM_data *vd, const char *opt) +VSM_N_Arg(struct VSM_data *vd, const char *arg) { CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); - AN(opt); + AN(arg); - if (vd->n_opt) { - free(vd->n_opt); - vd->n_opt = NULL; - } - REPLACE(vd->fname, opt); + if (vd->head) + return (vsm_diag(vd, "VSM_N_Arg: Already open\n")); + REPLACE(vd->name, arg); + REPLACE(vd->fname, arg); vd->N_opt = 1; return (1); } @@ -170,7 +178,7 @@ VSM_Name(const struct VSM_data *vd) CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); - return (vd->n_opt); + return (vd->name); } /*--------------------------------------------------------------------*/ @@ -182,11 +190,11 @@ VSM_Delete(struct VSM_data *vd) CHECK_OBJ_NOTNULL(vd, VSM_MAGIC); VSM_Close(vd); - free(vd->n_opt); - free(vd->fname); if (vd->vsc != NULL) VSC_Delete(vd); VSM_ResetError(vd); + free(vd->name); + free(vd->fname); FREE_OBJ(vd); } @@ -214,11 +222,13 @@ VSM_Open(struct VSM_data *vd) /* Already open */ return (0); - if (!vd->n_opt && !vd->N_opt) - (void)VSM_n_Arg(vd, ""); - - AZ(vd->head); - AN(vd->fname); + if (vd->fname == NULL) { + /* Use default (hostname) */ + i = VSM_n_Arg(vd, ""); + if (i < 0) + return (i); + AN(vd->fname); + } vd->vsm_fd = open(vd->fname, O_RDONLY); if (vd->vsm_fd < 0) diff --git a/lib/libvarnishapi/vsm_api.h b/lib/libvarnishapi/vsm_api.h index dc1430b..1d73773 100644 --- a/lib/libvarnishapi/vsm_api.h +++ b/lib/libvarnishapi/vsm_api.h @@ -39,7 +39,7 @@ struct VSM_data { struct vsb *diag; - char *n_opt; + char *name; char *fname; int N_opt; From martin at varnish-software.com Thu Jan 30 13:02:08 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:08 +0100 Subject: [master] c385dbf API documentation fixes. Message-ID: commit c385dbf63d57f23702a5fdaa2e5ebd3640ce58a7 Author: Martin Blix Grydeland Date: Thu Jan 30 13:33:31 2014 +0100 API documentation fixes. diff --git a/include/vapi/vsm.h b/include/vapi/vsm.h index d92ab85..7db5199 100644 --- a/include/vapi/vsm.h +++ b/include/vapi/vsm.h @@ -93,7 +93,8 @@ void VSM_ResetError(struct VSM_data *vd); int VSM_n_Arg(struct VSM_data *vd, const char *n_arg); /* * Configure which varnishd instance to access. - * Can also be, and normally is done through VSC_Arg()/VSL_Arg(). + * Uses hostname if n_arg is NULL or "". + * * Returns: * 1 on success * <0 on failure, VSM_Error() returns diagnostic string @@ -107,8 +108,6 @@ int VSM_N_Arg(struct VSM_data *vd, const char *N_arg); * bypasses abandonment checks and allows looking at stale VSM * files without a running Varnish instance. * - * Can also be, and normally is done through VSC_Arg()/VSL_Arg(). - * * Returns: * 1 on success */ From martin at varnish-software.com Thu Jan 30 13:02:08 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:08 +0100 Subject: [master] f09b51f Add a VUT.name desc string of the currently open VSM context. Message-ID: commit f09b51fbad14ec5c11e6422dd1efd429436a684d Author: Martin Blix Grydeland Date: Thu Jan 30 13:34:58 2014 +0100 Add a VUT.name desc string of the currently open VSM context. diff --git a/include/vut.h b/include/vut.h index ba109f4..a0b9df2 100644 --- a/include/vut.h +++ b/include/vut.h @@ -35,6 +35,7 @@ typedef int VUT_cb_f(void); struct VUT { const char *progname; + char *name; /* Options */ int d_opt; diff --git a/lib/libvarnishtools/vut.c b/lib/libvarnishtools/vut.c index 4ca7fbc..f465b1f 100644 --- a/lib/libvarnishtools/vut.c +++ b/lib/libvarnishtools/vut.c @@ -173,6 +173,7 @@ void VUT_Init(const char *progname) { VUT.progname = progname; + REPLACE(VUT.name, ""); VUT.g_arg = VSL_g_vxid; AZ(VUT.vsl); VUT.vsl = VSL_New(); @@ -189,9 +190,10 @@ VUT_Setup(void) /* Input */ if (VUT.r_arg && VUT.vsm) VUT_Error(1, "Can't have both -n and -r options"); - if (VUT.r_arg) + if (VUT.r_arg) { + REPLACE(VUT.name, VUT.r_arg); c = VSL_CursorFile(VUT.vsl, VUT.r_arg, 0); - else { + } else { if (VUT.vsm == NULL) /* Default uses VSM with n=hostname */ VUT.vsm = VSM_New(); @@ -199,6 +201,7 @@ VUT_Setup(void) if (VSM_Open(VUT.vsm)) VUT_Error(1, "Can't open VSM file (%s)", VSM_Error(VUT.vsm)); + REPLACE(VUT.name, VSM_Name(VUT.vsm)); c = VSL_CursorVSM(VUT.vsl, VUT.vsm, (VUT.d_opt ? VSL_COPT_TAILSTOP : VSL_COPT_TAIL) | VSL_COPT_BATCH); @@ -242,6 +245,7 @@ VUT_Fini(void) { free(VUT.r_arg); free(VUT.P_arg); + free(VUT.name); vut_vpf_remove(); AZ(VUT.pfh); From martin at varnish-software.com Thu Jan 30 13:02:09 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:09 +0100 Subject: [master] d1dd526 Use VUT.name as descriptive name of VSM context. Message-ID: commit d1dd52656a35e2ef61086f394201aa4179a8c85b Author: Martin Blix Grydeland Date: Thu Jan 30 13:36:21 2014 +0100 Use VUT.name as descriptive name of VSM context. Fixes issue where a 2nd VSM context is used to get the current name, not taking any -n/-N arguments into account diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index b5d5c7c..4a6038e 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -182,7 +182,7 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[], } static void -update(const struct VSM_data *vd, int p) +update(int p) { struct top *tp, *tp2; int l, len; @@ -200,7 +200,7 @@ update(const struct VSM_data *vd, int p) if (n < p) n++; AC(erase()); - AC(mvprintw(0, 0, "%*s", COLS - 1, VSM_Name(vd))); + AC(mvprintw(0, 0, "%*s", COLS - 1, VUT.name)); AC(mvprintw(0, 0, "list length %u", ntop)); for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(top_tree, &top_tree_head, tp); @@ -231,8 +231,8 @@ static void * do_curses(void *arg) { int i; - struct VSM_data *vd = (struct VSM_data *)arg; + (void)arg; for (i = 0; i < 256; i++) { if (VSL_tags[i] == NULL) continue; @@ -249,7 +249,7 @@ do_curses(void *arg) AC(erase()); for (;;) { AZ(pthread_mutex_lock(&mtx)); - update(vd, period); + update(period); AZ(pthread_mutex_unlock(&mtx)); timeout(1000); @@ -315,11 +315,9 @@ usage(int status) int main(int argc, char **argv) { - struct VSM_data *vd; int o, once = 0; pthread_t thr; - vd = VSM_New(); VUT_Init(progname); while ((o = getopt(argc, argv, vopt_optstring)) != -1) { @@ -349,20 +347,21 @@ main(int argc, char **argv) } } - VUT.dispatch_f = &accumulate; - VUT.dispatch_priv = NULL; - if (!once){ - if (pthread_create(&thr, NULL, do_curses, vd) != 0) { - fprintf(stderr, "pthread_create(): %s\n", strerror(errno)); + VUT_Setup(); + if (!once) { + if (pthread_create(&thr, NULL, do_curses, NULL) != 0) { + fprintf(stderr, "pthread_create(): %s\n", + strerror(errno)); exit(1); } } - VUT_Setup(); + VUT.dispatch_f = &accumulate; + VUT.dispatch_priv = NULL; VUT_Main(); - VUT_Fini(); if (once) dump(); else pthread_join(thr, NULL); + VUT_Fini(); exit(0); } From martin at varnish-software.com Thu Jan 30 13:02:09 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:09 +0100 Subject: [master] 0ade45c Long line fix Message-ID: commit 0ade45c1838eef6653c8771c422d63621991ded4 Author: Martin Blix Grydeland Date: Thu Jan 30 13:38:50 2014 +0100 Long line fix diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 4a6038e..3e94445 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -337,7 +337,7 @@ main(int argc, char **argv) period = strtol(optarg, NULL, 0); if (errno != 0) { fprintf(stderr, - "Syntax error, %s is not a number", optarg); + "Syntax error, %s is not a number", optarg); exit(1); } break; From martin at varnish-software.com Thu Jan 30 13:02:09 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:09 +0100 Subject: [master] 139a4ce Display EOF upon hitting end of input Message-ID: commit 139a4ce232ac7fe2fd2b96f41e25d44d58d6c2d1 Author: Martin Blix Grydeland Date: Thu Jan 30 13:51:09 2014 +0100 Display EOF upon hitting end of input diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3e94445..3bb12b3 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -62,6 +62,7 @@ static const char progname[] = "varnishtop"; static float period = 60; /* seconds */ +static int end_of_file = 0; struct top { uint8_t tag; @@ -200,7 +201,11 @@ update(int p) if (n < p) n++; AC(erase()); - AC(mvprintw(0, 0, "%*s", COLS - 1, VUT.name)); + if (end_of_file) + AC(mvprintw(0, COLS - 1 - strlen(VUT.name) - 5, "%s (EOF)", + VUT.name)); + else + AC(mvprintw(0, COLS - 1 - strlen(VUT.name), "%s", VUT.name)); AC(mvprintw(0, 0, "list length %u", ntop)); for (tp = VRB_MIN(top_tree, &top_tree_head); tp != NULL; tp = tp2) { tp2 = VRB_NEXT(top_tree, &top_tree_head, tp); @@ -358,6 +363,7 @@ main(int argc, char **argv) VUT.dispatch_f = &accumulate; VUT.dispatch_priv = NULL; VUT_Main(); + end_of_file = 1; if (once) dump(); else From martin at varnish-software.com Thu Jan 30 13:02:09 2014 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 30 Jan 2014 14:02:09 +0100 Subject: [master] 83196f4 Stop updating counters after hitting EOF Message-ID: commit 83196f45f6d9d44ee127f38b6889fa36146b2a71 Author: Martin Blix Grydeland Date: Thu Jan 30 13:53:42 2014 +0100 Stop updating counters after hitting EOF diff --git a/bin/varnishtop/varnishtop.c b/bin/varnishtop/varnishtop.c index 3bb12b3..761c3f3 100644 --- a/bin/varnishtop/varnishtop.c +++ b/bin/varnishtop/varnishtop.c @@ -220,7 +220,8 @@ update(int p) len, len, tp->rec_data)); t = tp->count; } - (void)t; + if (end_of_file) + continue; tp->count += (1.0/3.0 - tp->count) / (double)n; if (tp->count * 10 < t || l > LINES * 10) { VRB_REMOVE(top_tree, &top_tree_head, tp); From fgsch at lodoss.net Thu Jan 30 15:23:23 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 30 Jan 2014 16:23:23 +0100 Subject: [master] 2ccf1b6 Some minor improvements Message-ID: commit 2ccf1b62fff566763df7f483f5044268e6254cf4 Author: Federico G. Schwindt Date: Thu Jan 30 15:21:28 2014 +0000 Some minor improvements diff --git a/etc/example.vcl b/etc/example.vcl index c9b9aad..c093552 100644 --- a/etc/example.vcl +++ b/etc/example.vcl @@ -1,14 +1,15 @@ # # This is an example VCL file for Varnish. +# # It does not do anything by default, delegating control to the builtin vcl. # The builtin VCL is called when there is no explicit explicit return # statement. - +# # See the VCL tutorial at https://www.varnish-cache.org/docs/trunk/tutorial/ -# See http://varnish-cache.org/trac/wiki/VCLExamples for more examples. +# and http://varnish-cache.org/trac/wiki/VCLExamples for more examples. -# Marker to tell the VCL compiler that this VCL has been adapted to the new 4.0 -# format. +# Marker to tell the VCL compiler that this VCL has been adapted to the +# new 4.0 format. vcl 4.0; # Default backend definition. Set this to point to your content server. @@ -25,7 +26,6 @@ sub vcl_recv { sub vcl_backend_response { # Happens after we have read the response headers from the backend. # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_fetch -# } sub vcl_deliver { @@ -33,4 +33,3 @@ sub vcl_deliver { # response to the client. # See http://www.varnish-cache.org/docs/3.0/tutorial/vcl.html#vcl_fetch } - From phk at FreeBSD.org Thu Jan 30 21:14:00 2014 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Thu, 30 Jan 2014 22:14:00 +0100 Subject: [master] 2f017f0 Add two counters to keep track of the exp inbox traffic Message-ID: commit 2f017f0d8f3c409a25722253c2480dbfa929048f Author: Poul-Henning Kamp Date: Thu Jan 30 21:13:44 2014 +0000 Add two counters to keep track of the exp inbox traffic diff --git a/bin/varnishd/cache/cache_expire.c b/bin/varnishd/cache/cache_expire.c index f1b65f3..eeda901 100644 --- a/bin/varnishd/cache/cache_expire.c +++ b/bin/varnishd/cache/cache_expire.c @@ -117,6 +117,7 @@ exp_mail_it(struct objcore *oc) VTAILQ_INSERT_HEAD(&exphdl->inbox, oc, lru_list); else VTAILQ_INSERT_TAIL(&exphdl->inbox, oc, lru_list); + VSC_C_main->exp_mailed++; AZ(pthread_cond_signal(&exphdl->condvar)); Lck_Unlock(&exphdl->mtx); } @@ -583,6 +584,7 @@ exp_thread(struct worker *wrk, void *priv) oc = VTAILQ_FIRST(&ep->inbox); if (oc != NULL) { VTAILQ_REMOVE(&ep->inbox, oc, lru_list); + VSC_C_main->exp_received++; tnext = 0; } else if (tnext > t) { VSL_Flush(&ep->vsl, 0); diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h index 9d7da8c..d72b325 100644 --- a/include/tbl/vsc_f_main.h +++ b/include/tbl/vsc_f_main.h @@ -561,6 +561,18 @@ VSC_F(bans_persisted_fragmentation, uint64_t, 0, 'g', diag, /*--------------------------------------------------------------------*/ +VSC_F(exp_mailed, uint64_t, 0, 'c', diag, + "Number of objects mailed to expiry thread", + "Number of objects mailed to expiry thread for handling." +) + +VSC_F(exp_received, uint64_t, 0, 'c', diag, + "Number of objects received by expiry thread", + "Number of objects received by expiry thread for handling." +) + +/*--------------------------------------------------------------------*/ + VSC_F(hcb_nolock, uint64_t, 1, 'a', debug, "HCB Lookups without lock", "" From fgsch at lodoss.net Fri Jan 31 10:42:51 2014 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 31 Jan 2014 11:42:51 +0100 Subject: [master] ea100e0 Update tests so they compile at the very least Message-ID: commit ea100e0a8612811cb3d05cccdca2f609ade84b44 Author: Federico G. Schwindt Date: Fri Jan 31 10:40:57 2014 +0000 Update tests so they compile at the very least diff --git a/bin/varnishtest/tests.disabled/r00693.vtc b/bin/varnishtest/tests.disabled/r00693.vtc index bf94f6b..4947dbc 100644 --- a/bin/varnishtest/tests.disabled/r00693.vtc +++ b/bin/varnishtest/tests.disabled/r00693.vtc @@ -41,7 +41,7 @@ varnish v1 -arg "-p workspace_client=3072" -vcl+backend { } sub vcl_hash { hash_data(req.url); - return (hash); + return (lookup); } } -start diff --git a/bin/varnishtest/tests.disabled/r00978.vtc b/bin/varnishtest/tests.disabled/r00978.vtc index 8d52e60..e02be57 100644 --- a/bin/varnishtest/tests.disabled/r00978.vtc +++ b/bin/varnishtest/tests.disabled/r00978.vtc @@ -23,7 +23,7 @@ varnish v1 -vcl+backend { } } sub vcl_backend_response { - if (req.url == "/") { + if (bereq.url == "/") { set beresp.do_esi = true; } set beresp.do_stream = true; diff --git a/bin/varnishtest/tests.disabled/t00001.vtc b/bin/varnishtest/tests.disabled/t00001.vtc index 4250b1a..a94e956 100644 --- a/bin/varnishtest/tests.disabled/t00001.vtc +++ b/bin/varnishtest/tests.disabled/t00001.vtc @@ -23,10 +23,10 @@ server s1 { varnish v1 -vcl+backend { sub vcl_backend_response { - if (req.url == "/foo") { + if (bereq.url == "/foo") { set beresp.do_gzip = true; } - if (req.url == "/barf") { + if (bereq.url == "/barf") { set beresp.do_gunzip = true; } set beresp.do_stream = true;